factory module

Define a class to create the proper Instrument.

STRING_TO_INSTRUMENT_CLASS = {   'CurrentCalibre': <class 'multipac_testbench.instruments.step_constant.CurrentCalibre'>,     'CurrentProbe': <class 'multipac_testbench.instruments.current_probe.CurrentProbe'>,     'DiffPenning': <class 'multipac_testbench.instruments.penning.DiffPenning'>,     'ElectricFieldProbe': <class 'multipac_testbench.instruments.electric_field.field_probe.FieldProbe'>,     'FieldProbe': <class 'multipac_testbench.instruments.electric_field.field_probe.FieldProbe'>,     'ForwardPower': <class 'multipac_testbench.instruments.power.ForwardPower'>,     'FrequencySetpoint': <class 'multipac_testbench.instruments.step_constant.FrequencySetpoint'>,     'OpticalFibre': <class 'multipac_testbench.instruments.optical_fibre.OpticalFibre'>,     'Penning': <class 'multipac_testbench.instruments.penning.Penning'>,     'PolarizationSetpoint': <class 'multipac_testbench.instruments.step_constant.PolarizationSetpoint'>,     'PostTrigger': <class 'multipac_testbench.instruments.step_constant.PostTrigger'>,     'PowerSetpoint': <class 'multipac_testbench.instruments.step_constant.PowerSetpoint'>,     'PreTrigger': <class 'multipac_testbench.instruments.step_constant.PreTrigger'>,     'RPACurrent': <class 'multipac_testbench.instruments.rpa.RPACurrent'>,     'RPAPotential': <class 'multipac_testbench.instruments.rpa.RPAPotential'>,     'ReflectedPower': <class 'multipac_testbench.instruments.power.ReflectedPower'>,     'Sync': <class 'multipac_testbench.instruments.power.Sync'>,     'Trigger': <class 'multipac_testbench.instruments.step_constant.Trigger'>}
class InstrumentFactory(freq_mhz=None, is_raw=False, create_virtual_instruments=True, commented_lines=None)[source]

Bases: object

Class to create instruments.

Parameters:
  • freq_mhz (float | None, default: None)

  • is_raw (bool, default: False)

  • create_virtual_instruments (bool, default: True)

  • commented_lines (Sequence[str] | None, default: None)

_commented_lines: Sequence[str]
run(name, df_data, class_name, column_header=None, header_key=None, **instruments_kw)[source]

Take the proper subclass, instantiate it and return it.

Parameters:
  • name (str) – Name of the instrument. For clarity, it should match the name of a column in df_data when it is possible.

  • df_data (DataFrame) – Content of the multipactor tests results CSV file.

  • class_name (Literal['CurrentCalibre', 'CurrentProbe', 'DiffPenning', 'ElectricFieldProbe', 'FieldProbe', 'ForwardPower', 'FrequencySetpoint', 'OpticalFibre', 'Penning', 'PolarizationSetpoint', 'PostTrigger', 'PowerSetpoint', 'PreTrigger', 'RPACurrent', 'RPAPotential', 'ReflectedPower', 'Sync', 'Trigger']) – Name of the instrument class, as given in the TOML file.

  • column_header (str | list[str] | None, default: None) – Name of the column(s) from which the data of the instrument will be taken. The default is None, in which case column_header is set to name. In general it is not necessary to provide it. An exception is when several CSV columns should be loaded in the instrument.

  • header_key (str | None, default: None) – Key to look for in a power step CSV header. Used to instantiate StepConstant in the context of PowerStep.

  • instruments_kw (Any) – Other keyword arguments in the TOML file.

Return type:

Instrument | None

Returns:

Instrument properly subclassed.

run_virtual(instruments, is_global=False, **kwargs)[source]

Add the implemented VirtualInstrument.

Parameters:
Return type:

list[VirtualInstrument]

Returns:

The created virtual instruments.

Create ReflectionCoefficient and SWR.

Parameters:

instruments (Sequence[Instrument])

Return type:

list[VirtualInstrument]

Create RPA.

Parameters:

instruments (Sequence[Instrument])

Return type:

RPA | None

Create DiffPenning.

Parameters:

instruments (Sequence[Instrument])

Return type:

list[DiffPenning] | None

_get_constructor(class_name)[source]

Get fail-safe proper instrument constructor.

Parameters:

class_name (Literal['CurrentCalibre', 'CurrentProbe', 'DiffPenning', 'ElectricFieldProbe', 'FieldProbe', 'ForwardPower', 'FrequencySetpoint', 'OpticalFibre', 'Penning', 'PolarizationSetpoint', 'PostTrigger', 'PowerSetpoint', 'PreTrigger', 'RPACurrent', 'RPAPotential', 'ReflectedPower', 'Sync', 'Trigger'])

Return type:

type[Instrument]