mpylab.device.prb_virtual module¶
Virtual field probe driver for UI and workflow tests.
- class mpylab.device.prb_virtual.FIELDPROBE(**kw)
Bases:
FIELDPROBESynthesize field components from expressions or a coupled RF source.
- Parameters:
kw (mapping) – Keyword arguments forwarded to the base field probe, including
SearchPaths.
- BindVirtualDevices(devices)
Attach graph-local devices used by source coupling.
- Parameters:
devices (mapping) – Graph device instances indexed by graph name.
- GetBatteryState()
Return virtual battery state.
- Returns:
(0, battery_state)with a relative numeric value.- Return type:
tuple
- GetData()
Calculate three probe-coordinate field components.
- Returns:
(0, [probe_x, probe_y, probe_z])with threescuq.Quantityvalues in volts per metre.- Return type:
tuple
- GetDataNB(retrigger=False)
Return field data through the non-blocking interface.
- Parameters:
retrigger (bool or str, optional) – Trigger again before returning when true or equal to
"on".- Returns:
Same result as
GetData().- Return type:
tuple
- GetDescription()
Return virtual instrument identification.
- Returns:
(0, identification).- Return type:
tuple
- GetFreq()
Return virtual operating frequency.
- Returns:
(0, frequency)in hertz.- Return type:
tuple
- GetWaveform()
Return the marker for unsupported waveform access.
- Returns:
(-1, None, None, None, None).- Return type:
tuple
- Init(ini=None, channel=None, ignore_bus=None)
Initialize component expressions and optional source coupling.
- Parameters:
ini (path-like or file-like, optional) – Virtual field-probe configuration source.
channel (int or str, optional) – Measurement channel; channel one is used by default.
- Returns:
Device status; zero indicates success.
- Return type:
int
- Quit()
Close the virtual driver.
- Returns:
Zero.
- Return type:
int
- SetFreq(freq)
Set virtual operating frequency.
- Parameters:
freq (float) – Frequency in hertz.
- Returns:
(0, frequency).- Return type:
tuple
- Trigger()
Trigger acquisition as a virtual no-op.
- Returns:
(0, 0).- Return type:
tuple of int
- Zero(state='on')
Set the virtual zero-state flag.
- Parameters:
state (str or bool-like, optional) –
"on"selects the on state; every other value selects off.- Returns:
(0, state)with canonical"on"or"off".- Return type:
tuple
- conftmpl = {'channel_%d': {'efield_per_sqrt_w': <class 'str'>, 'name': <class 'str'>, 'source': <class 'str'>, 'source_compression_slope': <class 'str'>, 'source_compression_start_dbm': <class 'str'>, 'source_gain_db': <class 'str'>, 'uncertainty': <class 'str'>, 'unit': <class 'str'>, 'x': <class 'str'>, 'y': <class 'str'>, 'z': <class 'str'>}, 'description': {'description': <class 'str'>, 'deviceid': <class 'str'>, 'driver': <class 'str'>, 'nr_of_channels': <class 'int'>, 'serialnr': <class 'str'>, 'type': <class 'str'>, 'vendor': <class 'str'>}, 'init_value': {'fstart': <class 'float'>, 'fstep': <class 'float'>, 'fstop': <class 'float'>, 'gpib': <class 'int'>, 'virtual': <function strbool>, 'visa': <class 'str'>}}
- query(cmd, tmpl=None, send_opc=False)
Write a command and return its virtual response.
- Parameters:
cmd (str) – SCPI-like command.
tmpl (str, optional) – Regular expression used to parse the response.
send_opc (bool, optional) – Return an operation-complete response after a non-query command.
- Returns:
Raw or parsed response.
- Return type:
str or dict
- read(tmpl=None)
Read the last virtual SCPI response.
- Parameters:
tmpl (str, optional) – Regular expression with named groups used to parse the response.
- Returns:
Raw response when
tmplis omitted, otherwise matching named groups or an empty dictionary.- Return type:
str or dict
- write(cmd)
Handle one command through the virtual SCPI facade.
- Parameters:
cmd (str) – SCPI-like command supported by the virtual driver.
- Returns:
Zero after processing the command.
- Return type:
int