mpylab.device.networkanalyzer module

This is mpylab.device.networkanalyzer

author:

Christian Albrecht

license:

GPL-3 or higher

class mpylab.device.networkanalyzer.NETWORKANALYZER(SearchPaths=None)

Bases: DRIVER

Parent class of all py-drivers for networkanalyzer analyzers.

This Driver use the new dirver framework!

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,
             'visa': str,
             'nr_of_channels': int,
             'virtual': strbool},
        'channel_%d':
            {'unit': str,
             'SetRefLevel': float,
             'SetRBW': float,
             'SetSpan': float,
             'CreateWindow': str,
             'CreateTrace': str,
             'SetSweepCount': int,
             'SetSweepPoints': int,
             'SetSweepType': str
             }}

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.

  • Section channel_%d
    • unit:

    • SetRefLevel: Reference Level (for further information see function description)

    • SetRBW: Resolution Bandwidth (for further information see function description)

    • SetSpan: Span of Device (for further information see function description)

    • CreateWindow: Name of the first Window (for further information see function description)

    • CreateTrace: Name of the first Trace (for further information see function description)

    • SetSweepCount: Sets the number of sweeps to be measured in single sweep mode. (for further information see function description)

    • SetSweepPoints: Sweep Points (for further information see function description)

    • SetSweepType: Sweep Type (for further information see function description)

The _commands dictionary:

_commands defines functions that should be available in concrete driver implementations derived from this class.

Convention example:

_commands={"function_name": {'parameter': tuple_of_parameter_names_or_None,
                             'returntype': python_type_or_r_type},
            ...}

Historical note: r_types and Meta_Driver are archived under mpylab.device.legacy and are not used by active drivers. See also mpylab.device.legacy.meta_driver.Meta_Driver.

Possibility lists: Possibilities define valid values for specific parameters. For example, sparam is restricted to values like ('S11', 'S12', 'S21', 'S22'). A fuzzy string compare may map small typos to known valid entries.

Possibility lists can be defined in a concrete driver class or in a base class. Defining them in shared base classes is recommended so valid values remain consistent across drivers.

Methods:

SetCenterFreq(cfreq):

Set the CenterFreq of the Device.

Parameters:

cfreq (float) – CenterFreq for the device

Returns:

CenterFreq which is set on the Device after the set command

Return type:

float

GetCenterFreq():
Get the CenterFreq of the Device
Returns:

CenterFreq which is set on the Device

Return type:

float

SetSpan(span):
Set the Span of the Device.
Defines the width of the measurement and display range for a frequency sweep.
Parameters:

span (float) – Span in Hz

Returns:

Span which is set on the Device after the set command

Return type:

float

GetSpan():
Get the Span of the Device
Returns:

Span which is set on the Device

Return type:

float

SetStartFreq(stfreq):
Set the Start Frequency of the Device
Parameters:

stfreq (float) – Start Frequency of the Device

Returns:

Start Frequency which is set on the Device after the set command

Return type:

float

GetStartFreq():
Get the Start Frequency of the Device
Returns:

Start Frequency which is set on the Device after the set command

Return type:

float

SetStopFreq(spfreq):
Set the Stop Frequency of the Device
Parameters:

spfreq (float) – Stop Frequency of the Device

Returns:

Stop Frequency which is set on the Device after the set command

Return type:

float

GetStopFreq():
Get the Stop Frequency of the Device
Returns:

Stop Frequency which is set on the Device

Return type:

float

SetRBW(rbw):
Set the Resolution Bandwidth of the Device
Parameters:

rbw (float) – Resolution Bandwidth of the Device

Returns:

Resolution Bandwidth which is set on the Device after the set command

Return type:

float

GetRBW():
Get the Resolution Bandwidth of the Device
Returns:

Resolution Bandwidth which is set on the Device

Return type:

float

SetRefLevel(reflevel):
Set the Reference Level of the currently active Trace.
Parameters:

reflevel (float) – Reference Level of the Device

Returns:

Reference Level which is set on the Device after the set command

Return type:

float

GetRefLevel():
Get the Reference Level of the currently active Trace.
Returns:

Reference Level which is set on the Device

Return type:

float

SetDivisionValue(divivalue):
Sets the value between two grid graticules (value per division) for the diagram area.
Parameters:

divivalue (float) – Division Value of the Device

Returns:

Division Value which is set on the Device after the set command

Return type:

float

GetDivisionValue():
Gets the value between two grid graticules (value per division) for the diagram area.
Returns:

Division Value which is set on the Device

Return type:

float

CreateTrace(tracename, sparam):
Creates a Trace and assigns the given name to it.
Parameters:
  • tracename (String) – Name of the new Trace

  • sparam (String) – S-parameter as String; (‘S11’, ‘S12’, ‘S21’, ‘S22’)

Returns:

Name of the new Trace

Return type:

String

DelTrace(traceName):
Deletes a trace with a specified trace name.
Parameters:

traceName (String) – Name of the Trace which should deleted

Return type:

None

SetTrace(traceName):
Selects an existing trace as the active trace.
Parameters:

traceName (String) – Name of the trace which should be selected.

Returns:

Name of the currently active Trace after the set command

Return type:

String

GetTrace():
Gets the Name of the currently active Trace
Returns:

Name of the currently active Trace

Return type:

String

SetSparameter(sparam):
Assigns the s-parameter to the currently active Trace.
See also SetTrace()
Parameters:

sparam (String) – S-parameter as String; (‘S11’, ‘S12’, ‘S21’, ‘S22’)

Returns:

S-parameter of the currently active Trace which is set on the Device after the set command

Return type:

String

GetTrace():
Gets s-parameter of the currently active Trace.
See also SetTrace()
Returns:

S-parameter of the currently active Trace which is set on the Device

Return type:

String

SetChannel(chan):
Sets the Channel Number of the Device
Parameters:

chan (Integer) – Number of the Channel

Returns:

Channel Number of the Device after the set command

Return type:

Integer

GetChannel():
Gets the Channel Number of the Device
Returns:

Channel Number of the Device

Return type:

Integer

SetSweepType(sweepType):
Selects the sweep type and the position of the sweep points across the sweep range.
Parameters:

sweepType (String) – sweep type as String (‘LINEAR’,’LOGARITHMIC’)

Returns:

sweep type which is set on the device after the set command

Return type:

String

GetSweepType():
Selects the sweep type and the position of the sweep points across the sweep range.
Returns:

sweep type which is set on the Device

Return type:

String

SetSweepCount(sweepCount):
Sets the number of sweeps to be measured in single sweep mode.
Parameters:

sweepCount (Integer) – Reference Level of the Device

Returns:

Sweep Count which is set on the Device after the set command

Return type:

Integer

Parameters:

SearchPaths (sequence of path-like, optional) – Directories searched for device INI files and referenced data files.

conftmpl = {'channel_%d': {'CreateTrace': <class 'str'>, 'CreateWindow': <class 'str'>, 'SetRBW': <class 'float'>, 'SetRefLevel': <class 'float'>, 'SetSpan': <class 'float'>, 'SetSweepCount': <class 'int'>, 'SetSweepPoints': <class 'int'>, 'SetSweepType': <class 'str'>, '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>, 'visa': <class 'str'>}}
sparam_possib = ('S11', 'S12', 'S21', 'S22')
sweepMode_possib = ('CONTINUOUS', 'SINGLE')
sweepType_possib = ('LINEAR', 'LOGARITHMIC')
triggerMode_possib = ('IMMEDIATE', 'EXTERNAL')