instruments package

Submodules

instruments.keithley_2401 module

class instruments.keithley_2401.Instrument(logger, config)[source]

Bases: object

A class used to represent and control an instrument.

rm

a pyvisa ResourceManager object

Type:

ResourceManager

inst

the instrument object

Type:

object

close(logger)[source]

Closes the instrument.

init(logger)[source]

Initializes the instrument.

reset(logger)[source]

Resets the instrument.

write(logger, command)[source]

Sends a command to the instrument.

query(logger, command)[source]

Sends a command and receives a response from the instrument.

set_output_state(logger, state)[source]

Sets the output state of the instrument.

set_output_value(logger, func, value)[source]

Sets the output value of the instrument.

get_output_value(logger, func)[source]

Measures the output value from the instrument.

fetch(logger)[source]

Fetches data from the instrument.

read(logger)[source]

Reads data from the instrument.

get_timer(logger)[source]

Gets the timer value of the instrument.

reset_timer(logger)[source]

Resets the instrument’s timer.

set_mode_fixed(logger, func)[source]

Sets the instrument’s measurement mode to fixed.

set_src_func(logger, func)[source]

Sets the source function of the instrument.

set_func_range(logger, func, range=':AUTO ON')[source]

Sets the range of the instrument.

set_func_step(logger, func, step)[source]

Sets the step value of the instrument.

set_sense_func(logger, func)[source]

Sets the sense function of the instrument.

set_func_cplc(logger, func, value)[source]

Sets the compliance of the instrument.

set_func_nplc(logger, func, value)[source]

Sets the integration time of the instrument.

close(logger)[source]

Closes instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

fetch(logger)[source]

Fetches instrument and returns list of values.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

get_output_value(logger, func)[source]

Measures output value of voltage, current or resistance.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage/Resistance)

get_timer(logger)[source]

Returns timer value of the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

init(logger)[source]

Initializes instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

query(logger, command)[source]

Queries instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • command (str) – the command to be queried from the instrument

read(logger)[source]

Reads instrument and returns list of values.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

reset(logger)[source]

Resets instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

reset_timer(logger)[source]

Resets timer of the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages

set_func_cplc(logger, func, value)[source]

Sets compliance of voltage or current.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage)

  • value (float) – the compliance value to be set on the instrument

set_func_nplc(logger, func, value)[source]

Sets integration time for current or voltage.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (current or voltage)

  • value (float) – the value to set the integration time to

set_func_range(logger, func, range=':AUTO ON')[source]

Sets range of voltage, current, or resistance.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage/Resistance)

  • range (str) – the range to be set on the instrument (default is ‘:AUTO ON’)

set_func_step(logger, func, step)[source]

Sets step for the given function.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage)

  • step (float) – the step value to be set on the instrument

set_mode_fixed(logger, func)[source]

Sets measurement mode to fixed for the given function.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage)

set_output_state(logger, state)[source]

Sets output state of the instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • state (str) – the state to be set on the instrument (ON/OFF)

set_output_value(logger, func, value)[source]

Sets output value of voltage or current.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage)

  • value (float) – the value to be set on the instrument

set_sense_func(logger, func)[source]

Sets sense function of voltage, current or resistance.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the sense function of the instrument (Current/Voltage/Resistance)

set_src_func(logger, func)[source]

Sets source function of voltage or current.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • func (str) – the function of the instrument (Current/Voltage)

write(logger, command)[source]

Writes command to instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages

  • command (str) – the command to be written to the instrument

instruments.sim module

class instruments.sim.Instrument(logger, config)[source]

Bases: object

close(logger)[source]

Closes the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

fetch(logger)[source]

Fetches the instrument and returns a list of values.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

get_output_value(logger, func)[source]

Measures the output value for a given function (voltage, current, or resistance).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function for which the output value is being measured (Voltage/Current/Resistance).

get_timer(logger)[source]

Returns the timer value of the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

init(logger)[source]

Initializes the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

query(logger, command)[source]

Sends a query to the instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • command (str) – the query to be sent to the instrument.

read(logger)[source]

Reads the instrument and returns a list of values.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

reset(logger)[source]

Resets the instrument to default settings.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

reset_timer(logger)[source]

Resets the timer of the instrument.

Parameters:

logger (Logger) – the Logger object for logging debug and error messages.

set_func_cplc(logger, func, value)[source]

Sets the compliance for a given function (voltage or current).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function of the instrument (Voltage/Current).

  • value (float) – the compliance value to be set on the instrument.

set_func_nplc(logger, func, value)[source]

Sets the integration time for a given function (voltage or current).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function of the instrument (Voltage/Current).

  • value (float) – the integration time to be set on the instrument.

set_func_range(logger, func, range=':AUTO ON')[source]

Sets the range of the given function on the instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function of the instrument (Voltage/Current).

  • range (str) – the range to be set on the instrument (default is ‘:AUTO ON’).

set_func_step(logger, func, step)[source]

Sets the step for a given function.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function of the instrument (Voltage/Current).

  • step (float) – the step value to be set on the instrument.

set_mode_fixed(logger, func)[source]

Sets the measurement mode of the instrument to ‘fixed’.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function for which the measurement mode is being set.

set_output_state(logger, state)[source]

Sets the output state of the instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • state (str) – the desired state of the instrument output (ON/OFF).

set_output_value(logger, func, value)[source]

Sets the output value for a given function (voltage or current).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the function for which the output value is being set (Voltage/Current).

  • value (float) – the desired output value.

set_sense_func(logger, func)[source]

Sets the sense function of the instrument (voltage, current, or resistance).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the sense function to be set on the instrument (Voltage/Current/Resistance).

set_src_func(logger, func)[source]

Sets the source function of the instrument (voltage or current).

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • func (str) – the source function to be set on the instrument (Voltage/Current).

write(logger, command)[source]

Writes a command to the instrument.

Parameters:
  • logger (Logger) – the Logger object for logging debug and error messages.

  • command (str) – the command to be written to the instrument.

Module contents