Instrument management

Use the InstrumentManager() to start experiments and control your PalmSens instrument.

For example, to connect:

import pypalmsens

with pypalmsens.connect as manager:
        method = pypalmsens.ChronoAmperometry()
        measurement = await manager.measure(method)

or using InstrumentManager() directly as a context manager:

instruments = discover()

with pypalmsens.InstrumentManager(instruments[0]) as manager:
    measurement = manager.measure(method)

or managing the instrument connection yourself:

instruments = discover_async()

manager = pypalmsens.InstrumentManager(instruments[0])
manager.connect()
...
await manager.disconnect()

For more information, see xref:measuring.adoc

pypalmsens

Classes:

Functions:

  • connect – Connect to instrument and return InstrumentManager.

  • discover – Discover instruments.

InstrumentManager

InstrumentManager(instrument, *, callback=None)

Instrument manager for PalmSens instruments.

Parameters:

  • instrument (Instrument) – Instrument to connect to, use discover() to find connected instruments.

  • callback (link:#typing.Optional[link:#pypalmsens._instruments._common.Callback]) – If specified, call this function on every new set of data points. New data points are batched, and contain all points since the last time it was called. Each point is a dictionary containing frequency, z_re, z_im for impedimetric techniques and index, x, x_unit, x_type, y, y_unit and y_type for non-impedimetric techniques.

Functions:

Attributes:

  • callback – This callback is called on every data point.

  • instrument – Instrument to connect to.

callback

callback = callback

This callback is called on every data point.

instrument

instrument = instrument

Instrument to connect to.

is_connected

is_connected()

Return True if an instrument connection exists.

connect

connect()

Connect to instrument.

set_cell

set_cell(cell_on)

Turn the cell on or off.

Parameters:

  • cell_on (bool) – If true, turn on the cell

set_potential

set_potential(potential)

Set the potential of the cell.

Parameters:

  • potential (float) – Potential in V

set_current_range

set_current_range(current_range)

Set the current range for the cell.

Parameters:

  • current_range (CURRENT_RANGE) – Set the current range, use pypalmsens.settings.CURRENT_RANGE.

read_current

read_current()

Read the current in µA.

Returns:

  • float – Current in µA.”

read_potential

read_potential()

Read the potential in V.

Returns:

  • float – Potential in V.

get_instrument_serial

get_instrument_serial()

Return instrument serial number.

Returns:

  • str – Instrument serial.

validate_method

validate_method(psmethod)

Validate method.

measure

measure(method)

Start measurement using given method parameters.

Parameters:

wait_digital_trigger

wait_digital_trigger(wait_for_high)

Wait for digital trigger.

Parameters:

  • wait_for_high – …

abort

abort()

Abort measurement.

initialize_multiplexer

initialize_multiplexer(mux_model)

Initialize the multiplexer.

Parameters:

  • mux_model (int) – The model of the multiplexer. 0 = 8 channel, 1 = 16 channel, 2 = 32 channel.

Returns:

  • int – Number of available multiplexes channels

set_mux8r2_settings

set_mux8r2_settings(connect_sense_to_working_electrode=False, combine_reference_and_counter_electrodes=False, use_channel_1_reference_and_counter_electrodes=False, set_unselected_channel_working_electrode=0)

Set the settings for the Mux8R2 multiplexer.

Parameters:

  • connect_sense_to_working_electrode (bool) – Connect the sense electrode to the working electrode. Default is False.

  • combine_reference_and_counter_electrodes (bool) – Combine the reference and counter electrodes. Default is False.

  • use_channel_1_reference_and_counter_electrodes (bool) – Use channel 1 reference and counter electrodes for all working electrodes. Default is False.

  • set_unselected_channel_working_electrode (int) – Set the unselected channel working electrode to disconnected/floating (0), ground (1), or standby potential (2). Default is 0.

set_multiplexer_channel

set_multiplexer_channel(channel)

Sets the multiplexer channel.

Parameters:

  • channel (int) – Index of the channel to set.

disconnect

disconnect()

Disconnect from the instrument.

connect

connect(instrument=None)

Connect to instrument and return InstrumentManager.

Parameters:

  • instrument (Instrument) – Connect to this instrument. If not specified, automatically discover and connect to the first instrument.

Returns:

  • manager (InstrumentManager) – Return instance of InstrumentManager connected to the given instrument. The connection will be terminated after the context ends.

discover

discover(ftdi=False, usbcdc=True, bluetooth=False, serial=True)

Discover instruments.

Parameters:

  • ftdi (bool) – If True, discover ftdi devices

  • usbcdc (bool) – If True, discover usbcdc devices (Windows only)

  • bluetooth (bool) – If True, discover bluetooth devices (Windows only)

  • serial (bool) – If True, discover serial devices