3. pyB12MPS Module

In this section the functions of the B12MPS module are explained. In general, most functions can be used to query a parameter, while some functions can query and set (send) a value to the MPS.

For example the command:

B12MPS.freq()

will return the current microwave frequency of the MPS, while:

B12MPS.freq(9.554)

will set the microwave frequency to 9.554 GHz.

3.1. pyB12MPS Functions

ampgain(gain=None)

Advanced feature to adjust gain for calibration of MPS

Parameters

gain (None, float, int) – Amplifier gain in dBm

Returns

if gain is None, returns the current amplifier gain value in dBm

Return type

float

ampstatus(ampState=None)

Query MPS microwave amplifier status

lockState

Description

0

Amplifier Off

1

Amplifier On

2

Amplifier Ext

Returns

Amplifier status of MPS

Return type

ampState (int)

amptemp()

Query the MPS amplifier temperature

Returns

Amplifier temperature in degrees C

Return type

ampTemp (float)

close()

Close serial port

debug(debugMode=None)

Query/Set debug mode of MPS

Parameters

debugMode (None, int) – If None, query the debug mode. Otherwise set the debug mode.

Returns

If query, returns current debug mode of MPS

Return type

debugMode (int)

detectArduinoSerialPort()

Return the serial port for the Arduino

Returns

Arduino serial port. If Arduino serial port is not found, uses the default serial port.

Return type

str

firmware()

Query the MPS firmware version

Returns

Firmware version

Return type

firmwareVersion (str)

flush()

Flush the MPS Serial Buffer

freq(freqValue=None)

Set/Query Microwave Frequency

Parameters

freqValue (int, float) – Set Frequency in GHz, by default this parameter is None and the frequency is queried

Returns

frequency in GHz

Example:

microwaveFrequency = freq() # Query Microwave Frequency

freq(9.4) # Set Microwave Frequency to 9.4 GHz
id()

Query the instrument identificationstring of MPS

Returns

ID of instrument: “Bridge12 MPS”

Return type

idString (str)

in_waiting()

Return bytes in MPS serial port

Returns

number of bytes at serial port

Return type

value (int)

listPorts()

List the serial ports available. This function is for troubleshooting when the serial port of the MPS is unknown.

Returns

Dictionary of Serial Ports. Key is serial port. Value is description.

Return type

portsAvailable (dict)

Example:

portsAvailable = listPorts() # Return Dictionary of Serial Ports Available
lockdelay(delay=None)

Set/Query lock delay in ms

Parameters

delay (None, int, float) – Frequency lock delay in ms

Returns

If delay is None, returns lock delay value

Return type

delayReading (int)

Example:

delay = lockdelay() # Query the Frequency Lock Delay in ms

lockdelay(100) # Set the Frequency Lock Delay to 100 ms
lockstatus(lockState=None, verifyOperateMode=True)

Set/Query the frequency lock, must be performed in operate mode

lockState

Description

0

Disable Frequency Lock

1

Enable Frequency Lock

Parameters
  • lockState (None, int) – if lockState is not None, sets the lock state

  • verifyOperateMode (bool) – If True, verifies that the operate mode is enabled before setting the lock state

Warning

The frequency lock can only be enabled in operate mode (screen() returns 1).

Returns

Frequency lock state of MPS

Return type

lockState (int)

Example:

lockState = lockstatus() # Query the Frequency Lock Status

lockstatus(0) # Diable Frequency Lock
lockstatus(1) # Enable Frequency Lock
lockstep(step=None)

Set/Query Lock frequency step in kHz

Parameters

step (None, int, float) – Frequency lock step in kHz

Returns

If step is None, returns current lock step value in kHz

Return type

stepReading (int)

Example:

step = lockstep() # Query the Lock Frequency Step in kHz

lockstep(20) # Set the Frequency Lock Step to 20 kHz
open()

Initialize MPS serial port connection

power(powerValue=None)

Set/Query Microwave Power

Parameters

powerValue (None, int, float) – Set Power in dBm, by default this parameter is None and the power is queried

Returns

Microwave power in dBm

Return type

powerValue (float)

Example:

powerValue = power() # Query Microwave Power

power(10) # Set microwave power to 10 dBm
rfstatus(rfState=None, verifyWaveguideStatus=True)

Set/Query the RF status

rfState

Description

0

Disable RF Output

1

Enable RF Output

2

External Trigger Microwave Output

Parameters
  • rfState (None, int) – RF Status value

  • verifyWaveguideStatus (bool) – Check if waveguide status is Enabled (True by default).

Returns

If rfStatus is not None, returns queried RF status

Return type

rfStateReading (int)

Warning

The microwave output (rfstatus(1)) can only be enabled if the waveguide switch is set to DNP mode (wgstatus() returns 1).

Example:

rfState = rfstatus() # Query the RF State

rfstatus(0) # Disable Microwave Output
rfstatus(1) # Enable Microwave Output
rfstatus(2) # Enable External Trigger of Microwave Output
rfsweepdata()

Get data from RF sweep

Returns

Tuning curve from previous rf sweep

Return type

numpy.array

Example:

data = mps.rfsweepdata()
rfsweepdosweep()

Start single RF Sweep.

Example:

mps.rfsweepdosweep()
rfsweepdwelltime(dwellTime=None)

Rf sweep dwell time in us

Parameters

dwellTime – If dwellTime is not None, value to set the RF sweep dwell time in us

Returns

If dwellTime is None, the current value of the rf sweep dwell time in us.

Return type

float

Example:

rfsweepdwelltime(50) # set rf sweep dwell time to 50 us
dwellTime = rfsweepdwelltime() # Query the rf sweep dwell time
rfsweepinitialdwelltime(dwellTime=None)

Rf sweep dwell time in ms for first point

Parameters

dwellTime – If dwellTime is not None, value to set the RF sweep dwell time for the first point in ms

Returns

If dwellTime is None, the current value of the RF sweep dwell time for the first point in ms.

Return type

float

Example:

mps.rfsweepinitialdwelltime(100) # Set the dwell time for the first point to 100 ms
dwellTime = mps.rfsweepinitialdwelltime() # Query the dwell time for the first point in ms
rfsweepnpts(rfSweepNptsValue=None)

Set/query number of points in RF sweep

Parameters

rfsweepnpts (int) – Set number of points in RF sweep. If empty, number of points is queried

Returns

If rfSweepNptsValue argument is None, the number of point in the rf sweep

Return type

int

Example:

pts = rfsweepnpts() # query the number of points in rf sweep
rfsweepnpts(100) # set the number of points in rf sweep to 100
rfsweeppower(tunePower=None)

Set/Query Power for RF Sweep

Parameters

tunePower (None, float, int) – If not None, sets the rf sweep power to this value in dBm. Otherwise queries the current rf sweep power.

Returns

If tunePower argument is None, the current rf sweep power.

Return type

float

Example:

mps.rfsweeppower(15) # set rf sweep power to 15 dBm
tunePower = mps.rfsweepPower()
rfsweepsw(rfSweepSwValue=None)

Set/query predefined RF sweep width (MHs)

rfsweepsw

Value

0

250 MHz

1

100 MHz

2

50 MHz

3

10 MHz

Parameters

rfsweepsw (int) – rfsweepsw variable which determines the rf sweep width. If None, number of points is queried

Returns

rf sweep width

Return type

int

Example:

mps.rfsweepsw(0) # set rf sweep width to 250 MHz
sweepWidth = mps.rfsweepsw() # Query current rf sweep width
rxdiodesn()

Query serial number of Rx diode

Returns

Serial number string of Rx diode

Return type

serialNumberRx (str)

rxpowerdbm()

Query the Rx diode reading in dBm

Returns

Reciever monitor power reading in dBm

Return type

rxPower (float)

Example:

rxPower = rxpowerdbm() # Query Rx diode power reading
rxpowermv()

Query the Rx diode reading in mV

Returns

Receiver monitor voltage reading in mV

Return type

rxVoltage (float)

Example:

rxVoltage = rxpowermv() # Query Rx diode voltage
screen(screenState=None)

Set/Query Screen Status

screen

Description

0

Main Screen

1

Operate Screen

2

Sweep Screen

3

Advanced Screen

Parameters

screenState (None, int) – If screenState is not None, sets the screen state

Returns

If screenState is None, returns the screen state

Return type

screenStateReading (int)

Example:

screenState = screen() # Query the Screen Status

screenstatus(0) # Set Screen to Main Screen
screenstatus(1) # Set Screen to Operate Screen
screenstatus(2) # Set Screen to Sweep Screen
screenstatus(3) # Set Screen to Advanced Screen
send_command(command, recv=False)

Send string command to python MPS server

Parameters
  • command (str) – string command to be sent to MPS Server

  • recv (bool) – True if serial port should be read after writing. False by default.

Returns

if recv = True, returns string received from MPS Server

Return type

recv_string (str)

Example:

send_command('freq 9300000') # Set Frequency to 9.3 GHz

freqStringkHz = send_command('freq?',recv = True) # Query the microwave frequency in kHz
freqValue = float(freqStringkHz) / 1.e6 # Convert frequency string float in units of GHz

send_command('_stop_') # Stop the python server
serialNumber()

Query serial number of MPS

Returns

Serial number string of MPS

Return type

serialNumber (str)

start(serialPort=None, host=None, port=None)

Start python TCP server

Parameters
  • serialPort (None, str) – If given, serial port to establish MPS connection.

  • ip (None, str) – If given, the IP address to use for the server

  • port (None, str) –

Example:

start() # Start python server with automatically detected serial port or default serial port (defined in configuration file)

start('COM5') # Start python server using "COM5" as serial port
stop()

Stop python server

systemReady()

Query python server for initialized status of MPS

isMPSReady

Description

0

MPS Serial Connection Not Initialized

1

MPS Serial Connection Initialized

Returns

RF Status value

Return type

isMPSReady (int)

systemstatus()

Returns dictionary of MPS status

Keys

freq

power

rxpowermv

txpowermv

rfstatus

wgstatus

ampstatus

amptemp

lockstatus

screen

Returns

dictionary of system status variables

Return type

dict

test()

Test Server Connection

Returns

A value of zero (0) indicates normal operation of the server. Any other value indicates a server error.

Return type

serverErrorIndicator

txdiodesn()

Query serial number of Tx diode

Returns

Serial number string of Tx diode

Return type

serialNumberTx (str)

txpowerdbm()

Returns transmitter power monitor in dBm

Returns

Transmitter power monitor voltage in dBm

Return type

txPower (float)

Example:

txPower = txpowerdbm() # Query Tx diode power reading
txpowermv()

Returns transmitter power monitor in mV

Returns

Transmitter power monitor voltage in mV

Return type

txVoltage (float)

Example:

txVoltage = txpowermv() # Query Tx diode voltage
wgstatus(wgStatus=None)

Set/Query the waveguide switch (wg) status

wgStatus

Description

0

Disable Waveguide Switch (EPR Mode)

1

Enable Waveguide Switch (DNP Mode)

Parameters

wgStatus (None, int) – wg status value

Returns

If wgStatus is not None, returns queried wg status

Return type

wgStatusReading (int)

Example:

wgState = wgstatus() # Query the Waveguide State

wgstatus(0) # Switch to EPR Mode
wgstatus(1) # Switch to DNP Mode

3.2. Example - pyB12MPS Module

import B12MPS as mps

serverTest = mps.test()

if serverTest != 0:
    mps.start()

mps.freq(9.6) # Set microwave frequency to 9.6 GHz

mps.power(10) # Set microwave power to 10 dBm

mps.stop()