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:
-
InstrumentManager – Instrument manager for PalmSens instruments.
Functions:
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 andindex
,x
,x_unit
,x_type
,y
,y_unit
andy_type
for non-impedimetric techniques.
Functions:
-
is_connected – Return True if an instrument connection exists.
-
connect – Connect to instrument.
-
set_cell – Turn the cell on or off.
-
set_potential – Set the potential of the cell.
-
set_current_range – Set the current range for the cell.
-
read_current – Read the current in µA.
-
read_potential – Read the potential in V.
-
get_instrument_serial – Return instrument serial number.
-
validate_method – Validate method.
-
measure – Start measurement using given method parameters.
-
wait_digital_trigger – Wait for digital trigger.
-
abort – Abort measurement.
-
initialize_multiplexer – Initialize the multiplexer.
-
set_mux8r2_settings – Set the settings for the Mux8R2 multiplexer.
-
set_multiplexer_channel – Sets the multiplexer channel.
-
disconnect – Disconnect from the instrument.
Attributes:
-
callback – This callback is called on every data point.
-
instrument – Instrument to connect to.
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
.
get_instrument_serial
get_instrument_serial()
Return instrument serial number.
Returns:
-
str – Instrument serial.
measure
measure(method)
Start measurement using given method parameters.
Parameters:
-
method (MethodSettings) – Method parameters for measurement
wait_digital_trigger
wait_digital_trigger(wait_for_high)
Wait for digital trigger.
Parameters:
-
wait_for_high – …
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.
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.