3. pyB12MPS Module
In this section the methods of the MPS class 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:
mps.freq()
will return the current microwave frequency of the MPS, while:
mps.freq(9.554)
will set the microwave frequency to 9.554 GHz.
3.1. pyB12MPS Functions
- class MPS(port=None)
- 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
ampState
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)
- detectMPSSerialPort()
Return the serial port for the MPS
- Returns:
MPS serial port. If MPS 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 identification string of MPS
- Returns:
ID of instrument: “Bridge12 MPS”
- Return type:
idString (str)
- 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)
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
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
- 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)
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
- 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:
Receiver 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)
- 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
- triglength(length=None)
Set/Query trigger pulse length in us
- Parameters:
length (None, float, int) – If given, the length of the trigger pulse in us. If None, queries the trigger pulse length.
- Returns:
(int) trigger pulse length in us.
Example:
triglength(100) # Set trigger pulse length to 100 us triglength() # query the trigger pulse length
- 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 pyB12MPS
mps = pyB12MPS.MPS()
mps.freq(9.6) # Set microwave frequency to 9.6 GHz
mps.power(10) # Set microwave power to 10 dBm
mps.close() # Stop the server