mpylab.device.nport module¶
Base driver for passive n-port style data models.
- class mpylab.device.nport.ANTENNA(SearchPaths=None)
Bases:
NPORTPassive antenna model based on interpolated n-port data.
- class mpylab.device.nport.CABLE(SearchPaths=None)
Bases:
NPORTPassive cable model based on interpolated n-port data.
- exception mpylab.device.nport.LegacyNPortInterpolationWarning
Bases:
FutureWarningWarning for the historically ambiguous
INTERPOLATION = LOG.
- class mpylab.device.nport.NPORT(SearchPaths=None)
Bases:
DRIVERBase class for passive frequency-dependent n-port models.
Channels such as S-parameters, antenna factors, or insertion losses are loaded from DAT data and interpolated at the frequency selected through
SetFreq().- Parameters:
SearchPaths (sequence of path-like, optional) – Directories searched for device INI files and referenced DAT files.
- GetChannels()
Return available data-channel names.
- Returns:
(0, channels)with an immutable sequence of names.- Return type:
tuple
- GetData(what)
Return an interpolated channel value at the current frequency.
- Parameters:
what (str) – Channel name. Matching ignores case and spaces.
- Returns:
(status, value)wherevalueis normally ascuq.Quantity;(-1, None)indicates an unknown channel or an unset frequency.- Return type:
tuple
- GetDescription()
Return the configured device description.
- Returns:
(0, description).- Return type:
tuple
- GetFreq()
Return the interpolation frequency.
- Returns:
(0, frequency)with a value in hertz, orNonebefore the first call toSetFreq().- Return type:
tuple
- GetVirtual()
Return the runtime virtual-mode flag.
- Returns:
(0, virtual).- Return type:
tuple
- Init(ini=None, channel=None, ignore_bus=None)
Load channel datasets and initialize their interpolators.
- Parameters:
ini (path-like or file-like) – NPORT configuration source.
channel (int or str, optional) – Initial logical channel passed to the base driver.
ignore_bus (bool or None, optional) – Skip communication-bus initialization.
Noneselects the passive NPORT default ofTrue.
- Returns:
Device status; zero indicates success.
- Return type:
int
- Quit()
Close the passive driver state.
- Returns:
Device status; zero indicates success.
- Return type:
int
- SetFreq(freq)
Set the interpolation frequency.
- Parameters:
freq (float) – Frequency in hertz; it must be finite and non-negative.
- Returns:
(0, frequency).- Return type:
tuple
- SetVirtual(virtual)
Set the runtime virtual-mode flag.
- Parameters:
virtual (bool) – Requested virtual-mode state.
- Returns:
Device status; zero indicates success.
- Return type:
int
- conftmpl = {'channel_%d': {'complex_interpolation': <class 'str'>, 'db_factor': <class 'float'>, 'file': <function _file_source>, 'frequency_interpolation': <class 'str'>, 'interpolation': <class 'str'>, 'max_gap_factor': <class 'float'>, 'max_interpolation_error_factor': <class 'float'>, 'max_phase_step_deg': <class 'float'>, 'name': <class 'str'>, 'unit': <class 'str'>, 'value_interpolation': <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>}}
- mpylab.device.nport.main()
Run a simple manual test for NPORT interpolation behavior.