mpylab.device.powermeter module¶
mpylab.device.powermeter module.
- class mpylab.device.powermeter.POWERMETER(SearchPaths=None)
Bases:
DRIVERChild class for all py-drivers for power meters.
The parent class is
mpylab.device.driver.DRIVER.The configuration template for this device class is:
conftmpl={'description': {'description': str, 'type': str, 'vendor': str, 'serialnr': str, 'deviceid': str, 'driver': str}, 'init_value': {'fstart': float, 'fstop': float, 'fstep': float, 'gpib': int, 'virtual': strbool, 'nr_of_channels': int}, 'channel_%d': {'name': str, 'filter': int, 'unit': str, 'resolution': int, 'rangemode': str, 'manrange': float, 'swr1': float, 'swr2': float, 'sensor': str, 'interpolation': str, 'file': _file_source}}
The meaning is:
- Section description
description: string describing the instrument
type: string with the instrument type (here: POWERMETER)
vendor: string ddescribing the vendor/manufactor
serialnr: string with a unique identification
deviceid: string with an internal id
driver: filename of the instrument driver (.py, .pyc, .pyd, .dll)
- Section init_value
fstart: lowest possible frequency in Hz of the device
fstop: highest possible frequency in Hz of the device
fstep: smallest frequency step in Hz of the device
gpib: GPIB address of the device
virtual: 0, false or 1, true. Virtual device are usefull for testing and debugging.
nr_of_channels: indicates how many channel sections follow
- Section channel_%d (%d may be 1, 2, …)
name: a string identifying the channel.
filter: device specific integer specifying the filter used
unit: a string containing the unit of the returned power readings. However,
scuqwill ignore dB-settings, and the returned power will contain the unit anyway.resolution: device specific integer giving the resolutuion of the returned power
rangemode: ‘auto’, ‘autoonce’, or ‘manual’
manrange: fload specifiing the range in manual range mode
swr: VSWR of the measured two port. May be used in uncertainty calculations
sensor: string specifying the used power sensor. May be used in uncertainty calculations.
- Parameters:
SearchPaths (sequence of path-like, optional) – Directories searched for device INI files and referenced limit data.
- GetData()
Read one power value including mismatch uncertainty.
- Returns:
(status, power)wherepoweris ascuq.Quantity, orNoneif communication failed.- Return type:
tuple
- GetDataNB(retrigger=False)
Read power through the non-blocking driver interface.
The base implementation delegates to blocking
GetData().- Parameters:
retrigger (bool or str, optional) – Trigger a new acquisition after reading when true or equal to
"on".- Returns:
(status, power)wherepoweris ascuq.Quantitywhen available.- Return type:
tuple
- GetFreq()
Read the sensor correction frequency.
- Returns:
(status, frequency)with the value in hertz, orNonewhen unavailable.- Return type:
tuple
- GetSafetyLimit(what)
Return a named safety limit at the current frequency.
- Parameters:
what (str) – Limit-channel name, for example
MAXIN.- Returns:
(0, limit)with an interpolatedscuq.Quantity, or(-1, None)if the limit or current frequency is unavailable.- Return type:
tuple
- Init(ini=None, channel=None, ignore_bus=None)
Initialize the power meter and its optional safety limits.
- Parameters:
ini (path-like or file-like, optional) – Device configuration source.
channel (int or str, optional) – Initial measurement channel.
ignore_bus (bool or None, optional) – Bus policy.
Noneselects normal hardware communication.
- Returns:
Device status; zero indicates success.
- Return type:
int
- RANGE = ('MANUAL', 'AUTO', 'AUTOONCE')
- SetFreq(freq)
Set and read back the sensor correction frequency.
- Parameters:
freq (float) – Requested frequency in hertz.
- Returns:
(status, frequency)with the read-back value in hertz.- Return type:
tuple
- Trigger()
Trigger a single power measurement.
- Returns:
Device status; zero indicates success.
- Return type:
int
- Zero(state='on')
Set the power-meter zero-correction state.
- Parameters:
state (str or bool-like, optional) –
"on"enables zero correction; every other value disables it.- Returns:
(status, 0).- Return type:
tuple of int
- ZeroCorrection = ('OFF', 'ON')
- conftmpl = {'channel_%d': {'file': <function _file_source>, 'filter': <class 'int'>, 'interpolation': <class 'str'>, 'manrange': <class 'float'>, 'name': <class 'str'>, 'rangemode': <class 'str'>, 'resolution': <class 'int'>, 'sensor': <class 'str'>, 'swr1': <class 'float'>, 'swr2': <class 'float'>, 'unit': <class 'str'>}, 'description': {'description': <class 'str'>, 'deviceid': <class 'str'>, 'driver': <class 'str'>, 'serialnr': <class 'str'>, 'type': <class 'str'>, 'vendor': <class 'str'>}, 'init_value': {'fstart': <class 'float'>, 'fstep': <class 'float'>, 'fstop': <class 'float'>, 'gpib': <class 'int'>, 'nr_of_channels': <class 'int'>, 'virtual': <function strbool>}}
- get_standard_mismatch_uncertainty()
Calculate relative standard uncertainty caused by mismatch.
swr1andswr2are read from the active channel configuration. The result is on a linear relative scale. An expanded uncertainty is obtained by applying the desired coverage factor.- Returns:
Relative standard uncertainty for a U-shaped phase distribution.
- Return type:
float
- Raises:
ValueError – If either configured VSWR is non-finite or smaller than one.
- update_internal_unit(ch=None, unit=None)
Select the internal unit used to interpret power readings.
- Parameters:
ch (int, optional) – Channel number for multichannel devices, starting at one. The active channel is used when omitted.
unit (str or scuq.units.Unit, optional) – Device-side unit. The current internal unit is retained when omitted.
posibilities:: (The table shows the) – Unit SCPI notation Watt W dB DB dBm DBM dBuV DBUV