cohesivm.channels

This module contains the Channel Abstract Base Class which should be inherited by device channels. The main responsibility is to execute actions on the physical device channels for which the device connection is stored.

Furthermore, all possible channel methods are defined in the Channel in order for a Measurement to recognize them. Trait classes, e.g., Voltmeter, will inherit these methods and set the ones that must be implemented abstract. Then they can be used to be implemented in a device module and for the compatibility check of the Experiment.

class Channel(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: ABC

Contains the properties and methods to operate a physical device channel. The implementation of a child class must define the get_property() and set_property() methods which are used to configure the channel. Practically, the child class will inherit a trait class (child class of this class) which additionally defines the specific methods which must be implemented.

Parameters:
  • identifier – String identifier of the channel.

  • settings – Dictionary of channel settings.

property identifier: str

String identifier of the channel.

property settings: DatabaseDict

Dictionary of channel settings.

property connection: Any | None

Holds the resource of the device connection while a connection is established through using the connect() contextmanager.

abstract set_property(name: str, value: Any) None[source]

Sets a property/device-setting to the provided value.

Parameters:
  • name – The name of the property/device-setting to be set.

  • value – The value to which the property/device-setting should be set.

abstract get_property(name: str) Any[source]

Retrieves the current value of a property/device-setting.

Parameters:

name – The name of the property/device-setting to get.

Returns:

The value of the property/device-setting.

apply_settings() None[source]

Applies the settings.

change_setting(setting, value) None[source]

Modifies the settings and overwrites the settings on the device.

Parameters:
  • setting – String key of the setting in the settings.

  • value – New value of the setting.

Raises:

KeyError – If setting is not a valid setting identifier string.

abstract enable() None[source]

Enables the channel. Must be executed before any channel method can be run.

abstract disable() None[source]

Disables the channel.

measure_voltage() float[source]

Measures the voltage.

Returns:

Measurement result in V.

measure_current() float[source]

Measures the current.

Returns:

Measurement result in A.

source_voltage(voltage: float) None[source]

Sets the DC output voltage to the defined value.

Parameters:

voltage – Output voltage of the DC power source in V.

source_current(current: float) None[source]

Sets the DC output current to the defined value.

Parameters:

current – Output current of the DC power source in A.

source_voltage_and_measure(voltage: float) Tuple[float, float][source]

Sets the DC output voltage to the defined value and measures the current.

Parameters:

voltage – Output voltage of the power source in V.

Returns:

Measurement result: (voltage (V), current (A)).

source_current_and_measure(current: float) Tuple[float, float][source]

Sets the DC output current to the defined value and measures the voltage.

Parameters:

current – Output current of the current source in A.

Returns:

Measurement result: (current (A), voltage (V)).

sweep_voltage_and_measure(start_voltage: float, end_voltage: float, voltage_step: float, hysteresis: bool) list[tuple[float, float]][source]

Sweeps over the specified voltage range and measures the current for each voltage step.

Parameters:
  • start_voltage – Begin of the measurement range in V.

  • end_voltage – End of the measurement range in V.

  • voltage_step – Voltage change for each datapoint in V. Must be larger than 0.

  • hysteresis – Flags if the voltage range should be measured a second time in reverse order directly after the initial measurement.

Returns:

Measurement results: [(voltage1 (V), current1 (A)), (voltage2 (V), current2 (A)), …]

set_oscillator_frequency(frequency: float) None[source]

Sets the AC frequency of the oscillator to the defined value.

Parameters:

frequency – Oscillator frequency in Hz.

set_oscillator_voltage(voltage: float) None[source]

Sets the AC voltage of the oscillator to the defined value.

Parameters:

voltage – Oscillator voltage level in V.

set_oscillator_current(current: float) None[source]

Sets the AC current of the oscillator to the defined value.

Parameters:

current – Oscillator current level in A.

measure_impedance() Tuple[float, float][source]

Performs an impedance measurement and returns the magnitude and phase angle of the complex impedance vector.

Returns:

Measurement result as tuple: (magnitude (1), phase (deg))

class Voltmeter(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Measures the electric potential difference between two points in a circuit.

abstract measure_voltage() float[source]

Measures the voltage.

Returns:

Measurement result in V.

class Amperemeter(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Measures the current flowing through a circuit.

abstract measure_current() float[source]

Measures the current.

Returns:

Measurement result in A.

class VoltageSource(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Supplies a constant DC voltage.

abstract source_voltage(voltage: float) None[source]

Sets the DC output voltage to the defined value.

Parameters:

voltage – Output voltage of the DC power source in V.

class CurrentSource(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Supplies a constant DC current.

abstract source_current(current: float) None[source]

Sets the DC output current to the defined value.

Parameters:

current – Output current of the DC power source in A.

class VoltageSMU(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Combines the functions of a voltage source and current measurement device.

abstract source_voltage_and_measure(voltage: float) Tuple[float, float][source]

Sets the DC output voltage to the defined value and measures the current.

Parameters:

voltage – Output voltage of the power source in V.

Returns:

Measurement result: (voltage (V), current (A)).

class CurrentSMU(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Combines the functions of a current source and voltage measurement device.

abstract source_current_and_measure(current: float) Tuple[float, float][source]

Sets the DC output current to the defined value and measures the voltage.

Parameters:

current – Output current of the current source in A.

Returns:

Measurement result: (current (A), voltage (V)).

class SweepVoltageSMU(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Implements hardware sweep capabilities of a voltage SMU channel.

abstract sweep_voltage_and_measure(start_voltage: float, end_voltage: float, voltage_step: float, hysteresis: bool) list[tuple[float, float]][source]

Sweeps over the specified voltage range and measures the current for each voltage step.

Parameters:
  • start_voltage – Begin of the measurement range in V.

  • end_voltage – End of the measurement range in V.

  • voltage_step – Voltage change for each datapoint in V. Must be larger than 0.

  • hysteresis – Flags if the voltage range should be measured a second time in reverse order directly after the initial measurement.

Returns:

Measurement results: [(voltage1 (V), current1 (A)), (voltage2 (V), current2 (A)), …]

class LCRMeter(identifier: str | None = None, settings: DatabaseDict | None = None)[source]

Bases: Channel

Enables the measurement of the inductance (L), capacitance (C), and resistance (R) of an electronic component.

abstract source_voltage(voltage: float) None[source]

Sets the DC output voltage to the defined value.

Parameters:

voltage – Output voltage of the DC power source in V.

abstract source_current(current: float) None[source]

Sets the DC output current to the defined value.

Parameters:

current – Output current of the DC power source in A.

abstract set_oscillator_frequency(frequency: float)[source]

Sets the AC frequency of the oscillator to the defined value.

Parameters:

frequency – Oscillator frequency in Hz.

abstract set_oscillator_voltage(voltage: float) None[source]

Sets the AC voltage of the oscillator to the defined value.

Parameters:

voltage – Oscillator voltage level in V.

abstract set_oscillator_current(current: float) None[source]

Sets the AC current of the oscillator to the defined value.

Parameters:

current – Oscillator current level in A.

abstract measure_impedance() Tuple[float, float][source]

Performs an impedance measurement and returns the magnitude and phase angle of the complex impedance vector.

Returns:

Measurement result as tuple: (magnitude (1), phase (deg))