Skip to content

Modules

harp.devices.olfactometer #

Channel3RangeConfig #

Bases: IntEnum

Available flow ranges for channel 3 (ml/min).

Attributes:

Name Type Description
FLOW_RATE100 int

No description currently available

FLOW_RATE1000 int

No description currently available

ChannelsTargetFlowPayload dataclass #

ChannelsTargetFlowPayload(Channel0: float, Channel1: float, Channel2: float, Channel3: float, Channel4: float)

Parameters:

Name Type Description Default
Channel0 float
required
Channel1 float
required
Channel2 float
required
Channel3 float
required
Channel4 float
required

DI0TriggerConfig #

Bases: IntEnum

Specifies the configuration of the digital input 0 (DIN0).

Attributes:

Name Type Description
SYNC int

No description currently available

ENABLE_FLOW_WHILE_HIGH int

No description currently available

VALVE_TOGGLE int

No description currently available

DO0SyncConfig #

Bases: IntEnum

Available configurations when using DO0 pin to report firmware events.

Attributes:

Name Type Description
NONE int

No description currently available

MIMIC_ENABLE_FLOW int

No description currently available

DO1SyncConfig #

Bases: IntEnum

Available configurations when using DO1 pin to report firmware events.

Attributes:

Name Type Description
NONE int

No description currently available

MIMIC_ENABLE_FLOW int

No description currently available

Device #

The Device class provides the interface for interacting with Harp devices. This implementation of the Harp device was based on the official documentation available on the harp-tech website.

Attributes:

Name Type Description
WHO_AM_I int

The device ID number. A list of devices can be found here

DEFAULT_DEVICE_NAME str

The device name, i.e. "Behavior". This name is derived by cross-referencing the WHO_AM_I identifier with the corresponding device name in the device_names dictionary

HW_VERSION_H int

The major hardware version

HW_VERSION_L int

The minor hardware version

ASSEMBLY_VERSION int

The version of the assembled components

HARP_VERSION_H int

The major Harp core version

HARP_VERSION_L int

The minor Harp core version

FIRMWARE_VERSION_H int

The major firmware version

FIRMWARE_VERSION_L int

The minor firmware version

DEVICE_NAME str

The device name stored in the Harp device

SERIAL_NUMBER (int, optional)

The serial number of the device

__enter__() #

Support for using Device with 'with' statement.

Returns:

Type Description
Device

The Device instance

__exit__(exc_type, exc_val, exc_tb) #

Cleanup resources when exiting the 'with' block.

Parameters:

Name Type Description Default
exc_type Exception type or None

Type of the exception that caused the context to be exited

required
exc_val Exception or None

Exception instance that caused the context to be exited

required
exc_tb traceback or None

Traceback if an exception occurred

required

__init__(serial_port, dump_file_path=None, read_timeout_s=1, timeout_strategy=TimeoutStrategy.RAISE) #

Parameters:

Name Type Description Default
serial_port str

The serial port used to establish the connection with the Harp device. It must be denoted as /dev/ttyUSBx in Linux and COMx in Windows, where x is the number of the serial port

required
dump_file_path Optional[str]

The binary file to which all Harp messages will be written

None
read_timeout_s float

TODO

1

alive_en(enable) #

Sets the ALIVE_EN bit of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the ALIVE_EN bit. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

connect() #

Connects to the Harp device.

disconnect() #

Disconnects from the Harp device.

dump_registers() #

Asserts the DUMP bit to dump the values of all core and app registers as Harp Read Reply Messages. More information on the DUMP bit can be found here.

Returns:

Type Description
list

The list containing the reply Harp messages for all the device's registers

event_count() #

Gets the number of events in the event queue.

Returns:

Type Description
int

The number of events in the event queue

get_events() #

Gets all events from the event queue.

Returns:

Type Description
list

The list containing every Harp event message that were on the queue

info() #

Prints the device information.

load() #

Loads the data stored in the device's common registers.

mute_reply(enable) #

Sets the MUTE_REPLY bit of the device.

Parameters:

Name Type Description Default
enable bool

If True, the Replies to all the Commands are muted. If False, un-mutes them

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

op_led_en(enable) #

Sets the operation LED of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the operation LED. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

read_float(address) #

Reads the value of a register of type Float.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_operation_ctrl() #

Reads the OPERATION_CTRL register of the device.

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

read_s16(address) #

Reads the value of a register of type S16.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s32(address) #

Reads the value of a register of type S32.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s64(address) #

Reads the value of a register of type S64.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_s8(address) #

Reads the value of a register of type S8.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u16(address) #

Reads the value of a register of type U16.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u32(address) #

Reads the value of a register of type U32.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u64(address) #

Reads the value of a register of type U64.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

read_u8(address) #

Reads the value of a register of type U8.

Parameters:

Name Type Description Default
address int

The register to be read

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message that will contain the value read from the register

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

reset_device(reset_mode=ResetMode.RST_DEF) #

Resets the device and reboots with all the registers with the default values. Beware that the EEPROM will be erased. More information on the reset device register can be found here.

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

send(message, *, expect_reply=True, timeout_strategy=None) #

Sends a Harp message and (optionally) waits for a reply.

Parameters:

Name Type Description Default
message HarpMessage

The HarpMessage to be sent to the device

required
expect_reply bool

If False, do not wait for a reply (fire-and-forget)

True
timeout_strategy TimeoutStrategy | None

Override the device-level timeout strategy for this call

None

Returns:

Type Description
ReplyHarpMessage | None

Reply (or None when allowed by the timeout strategy or expect_reply=False)

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

set_clock_config(clock_config) #

Sets the clock configuration of the device.

Parameters:

Name Type Description Default
clock_config ClockConfig

The clock configuration value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

set_mode(mode) #

Sets the operation mode of the device.

Parameters:

Name Type Description Default
mode DeviceMode

The new device mode value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

set_timestamp_offset(timestamp_offset) #

When the value of this register is above 0 (zero), the device's timestamp will be offset by this amount. The register is sensitive to 500 microsecond increments. This register is non-volatile.

Parameters:

Name Type Description Default
timestamp_offset int

The timestamp offset value

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

visual_en(enable) #

Sets the status led of the device.

Parameters:

Name Type Description Default
enable bool

If True, enables the status led. If False, disables it

required

Returns:

Type Description
bool

True if the operation was successful, False otherwise

write_float(address, value) #

Writes the value of a register of type Float.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value float | list[float]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_operation_ctrl(mode=None, mute_rpl=None, visual_en=None, op_led_en=None, alive_en=None) #

Writes the OPERATION_CTRL register of the device.

Parameters:

Name Type Description Default
mode OperationMode

The new operation mode value

None
mute_rpl bool

If True, the Replies to all the Commands are muted

None
visual_en bool

If True, enables the status led

None
op_led_en bool

If True, enables the operation LED

None
alive_en bool

If True, enables the ALIVE_EN bit

None

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

write_s16(address, value) #

Writes the value of a register of type S16.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s32(address, value) #

Writes the value of a register of type S32.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s64(address, value) #

Writes the value of a register of type S64.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_s8(address, value) #

Writes the value of a register of type S8.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u16(address, value) #

Writes the value of a register of type U16.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u32(address, value) #

Writes the value of a register of type U32.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u64(address, value) #

Writes the value of a register of type U64.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

write_u8(address, value) #

Writes the value of a register of type U8.

Parameters:

Name Type Description Default
address int

The register to be written on

required
value int | list[int]

The value to be written to the register

required

Returns:

Type Description
ReplyHarpMessage

The reply to the Harp message

Raises:

Type Description
HarpTimeoutError

If no reply is received and the effective strategy requires raising

DigitalOutputs #

Bases: IntFlag

Specifies the states of the digital outputs.

Attributes:

Name Type Description
DO0 int

No description currently available

DO1 int

No description currently available

DigitalState #

Bases: IntEnum

The state of a digital pin.

Attributes:

Name Type Description
LOW int

No description currently available

HIGH int

No description currently available

EndValves #

Bases: IntFlag

Specifies the states of the end valves.

Attributes:

Name Type Description
END_VALVE0 int

No description currently available

END_VALVE1 int

No description currently available

VALVE_DUMMY int

No description currently available

FlowmeterPayload dataclass #

FlowmeterPayload(Channel0: int, Channel1: int, Channel2: int, Channel3: int, Channel4: int)

Parameters:

Name Type Description Default
Channel0 int
required
Channel1 int
required
Channel2 int
required
Channel3 int
required
Channel4 int
required

HarpMessage #

The HarpMessage class implements the Harp message as described in the protocol.

Attributes:

Name Type Description
frame bytearray

The bytearray containing the whole Harp message

message_type MessageType

The message type

length int

The length parameter of the Harp message

address int

The address of the register to which the Harp message refers to

port int

Indicates the origin or destination of the Harp message in case the device is a hub of Harp devices. The value 255 points to the device itself (default value).

payload_type PayloadType

The payload type

checksum int

The sum of all bytes contained in the Harp message

address property #

The address of the register to which the Harp message refers to.

Returns:

Type Description
int

The address of the register to which the Harp message refers to

checksum property #

The sum of all bytes contained in the Harp message.

Returns:

Type Description
int

The sum of all bytes contained in the Harp message

frame property #

The bytearray containing the whole Harp message.

Returns:

Type Description
bytearray

The bytearray containing the whole Harp message

length property #

The length parameter of the Harp message.

Returns:

Type Description
int

The length parameter of the Harp message

message_type property #

The message type.

Returns:

Type Description
MessageType

The message type

payload property #

The payload sent in the write Harp message.

Returns:

Type Description
Union[int, list[int]]

The payload sent in the write Harp message

payload_type property #

The payload type.

Returns:

Type Description
PayloadType

The payload type

port property writable #

Indicates the origin or destination of the Harp message in case the device is a hub of Harp devices. The value 255 points to the device itself (default value).

Returns:

Type Description
int

The port value

__repr__() #

Prints debug representation of the reply message.

Returns:

Type Description
str

The debug representation of the reply message

__str__() #

Prints friendly representation of a Harp message.

Returns:

Type Description
str

The representation of the Harp message

calculate_checksum() #

Calculates the checksum of the Harp message.

Returns:

Type Description
int

The value of the checksum

create(message_type, address, payload_type, value=None) staticmethod #

Creates a Harp message.

Parameters:

Name Type Description Default
message_type MessageType

The message type. It can only be of type READ or WRITE

required
address int

The address of the register that the message will interact with

required
payload_type PayloadType

The payload type

required
value Optional[int | list[int] | float | list[float]]

The payload of the message. If message_type == MessageType.WRITE, the value cannot be None

None

parse(frame) staticmethod #

Parses a bytearray to a (reply) Harp message.

Parameters:

Name Type Description Default
frame bytearray

The bytearray will be parsed into a (reply) Harp message

required

Returns:

Type Description
ReplyHarpMessage

The Harp message object parsed from the original bytearray

HarpReadException #

Bases: HarpException

Exception raised when there is an error reading from a register in the Harp device.

HarpWriteException #

Bases: HarpException

Exception raised when there is an error writing to a register in the Harp device.

MessageType #

Bases: IntEnum

An enumeration of the allowed message types of a Harp message. More information on the MessageType byte of a Harp message can be found here.

Attributes:

Name Type Description
READ int

The value that corresponds to a Read Harp message (1)

WRITE int

The value that corresponds to a Write Harp message (2)

EVENT int

The value that corresponds to an Event Harp message (3). Messages of this type are only meant to be send by the device

READ_ERROR int

The value that corresponds to a Read Error Harp message (9). Messages of this type are only meant to be send by the device

WRITE_ERROR int

The value that corresponds to a Write Error Harp message (10). Messages of this type are only meant to be send by the device

MimicOutputs #

Bases: IntEnum

Specifies the target IO on which to mimic the specified register.

Attributes:

Name Type Description
NONE int

No description currently available

DO0 int

No description currently available

DO1 int

No description currently available

OdorValves #

Bases: IntFlag

Specifies the states of the odor valves.

Attributes:

Name Type Description
VALVE0 int

No description currently available

VALVE1 int

No description currently available

VALVE2 int

No description currently available

VALVE3 int

No description currently available

Olfactometer #

Bases: Device

Olfactometer class for controlling the device.

read_channel0_actual_flow() #

Reads the contents of the Channel0ActualFlow register.

Returns:

Type Description
float

Value read from the Channel0ActualFlow register.

read_channel0_duty_cycle() #

Reads the contents of the Channel0DutyCycle register.

Returns:

Type Description
float

Value read from the Channel0DutyCycle register.

read_channel0_target_flow() #

Reads the contents of the Channel0TargetFlow register.

Returns:

Type Description
float

Value read from the Channel0TargetFlow register.

read_channel0_user_calibration() #

Reads the contents of the Channel0UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel0UserCalibration register.

read_channel1_actual_flow() #

Reads the contents of the Channel1ActualFlow register.

Returns:

Type Description
float

Value read from the Channel1ActualFlow register.

read_channel1_duty_cycle() #

Reads the contents of the Channel1DutyCycle register.

Returns:

Type Description
float

Value read from the Channel1DutyCycle register.

read_channel1_target_flow() #

Reads the contents of the Channel1TargetFlow register.

Returns:

Type Description
float

Value read from the Channel1TargetFlow register.

read_channel1_user_calibration() #

Reads the contents of the Channel1UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel1UserCalibration register.

read_channel2_actual_flow() #

Reads the contents of the Channel2ActualFlow register.

Returns:

Type Description
float

Value read from the Channel2ActualFlow register.

read_channel2_duty_cycle() #

Reads the contents of the Channel2DutyCycle register.

Returns:

Type Description
float

Value read from the Channel2DutyCycle register.

read_channel2_target_flow() #

Reads the contents of the Channel2TargetFlow register.

Returns:

Type Description
float

Value read from the Channel2TargetFlow register.

read_channel2_user_calibration() #

Reads the contents of the Channel2UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel2UserCalibration register.

read_channel3_actual_flow() #

Reads the contents of the Channel3ActualFlow register.

Returns:

Type Description
float

Value read from the Channel3ActualFlow register.

read_channel3_duty_cycle() #

Reads the contents of the Channel3DutyCycle register.

Returns:

Type Description
float

Value read from the Channel3DutyCycle register.

read_channel3_range() #

Reads the contents of the Channel3Range register.

Returns:

Type Description
Channel3RangeConfig

Value read from the Channel3Range register.

read_channel3_target_flow() #

Reads the contents of the Channel3TargetFlow register.

Returns:

Type Description
float

Value read from the Channel3TargetFlow register.

read_channel3_user_calibration() #

Reads the contents of the Channel3UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel3UserCalibration register.

read_channel3_user_calibration_aux() #

Reads the contents of the Channel3UserCalibrationAux register.

Returns:

Type Description
list[int]

Value read from the Channel3UserCalibrationAux register.

read_channel4_actual_flow() #

Reads the contents of the Channel4ActualFlow register.

Returns:

Type Description
float

Value read from the Channel4ActualFlow register.

read_channel4_duty_cycle() #

Reads the contents of the Channel4DutyCycle register.

Returns:

Type Description
float

Value read from the Channel4DutyCycle register.

read_channel4_target_flow() #

Reads the contents of the Channel4TargetFlow register.

Returns:

Type Description
float

Value read from the Channel4TargetFlow register.

read_channel4_user_calibration() #

Reads the contents of the Channel4UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel4UserCalibration register.

read_channels_target_flow() #

Reads the contents of the ChannelsTargetFlow register.

Returns:

Type Description
ChannelsTargetFlowPayload

Value read from the ChannelsTargetFlow register.

read_di0_state() #

Reads the contents of the DI0State register.

Returns:

Type Description
DigitalState

Value read from the DI0State register.

read_di0_trigger() #

Reads the contents of the DI0Trigger register.

Returns:

Type Description
DI0TriggerConfig

Value read from the DI0Trigger register.

read_digital_output_clear() #

Reads the contents of the DigitalOutputClear register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputClear register.

read_digital_output_set() #

Reads the contents of the DigitalOutputSet register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputSet register.

read_digital_output_state() #

Reads the contents of the DigitalOutputState register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputState register.

read_digital_output_toggle() #

Reads the contents of the DigitalOutputToggle register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputToggle register.

read_do0_sync() #

Reads the contents of the DO0Sync register.

Returns:

Type Description
DO0SyncConfig

Value read from the DO0Sync register.

read_do1_sync() #

Reads the contents of the DO1Sync register.

Returns:

Type Description
DO1SyncConfig

Value read from the DO1Sync register.

read_enable_events() #

Reads the contents of the EnableEvents register.

Returns:

Type Description
OlfactometerEvents

Value read from the EnableEvents register.

read_enable_flow() #

Reads the contents of the EnableFlow register.

Returns:

Type Description
bool

Value read from the EnableFlow register.

read_enable_temperature_calibration() #

Reads the contents of the EnableTemperatureCalibration register.

Returns:

Type Description
int

Value read from the EnableTemperatureCalibration register.

read_enable_valve_external_control() #

Reads the contents of the EnableValveExternalControl register.

Returns:

Type Description
bool

Value read from the EnableValveExternalControl register.

read_enable_valve_pulse() #

Reads the contents of the EnableValvePulse register.

Returns:

Type Description
Valves

Value read from the EnableValvePulse register.

read_end_valve0_pulse_duration() #

Reads the contents of the EndValve0PulseDuration register.

Returns:

Type Description
int

Value read from the EndValve0PulseDuration register.

read_end_valve1_pulse_duration() #

Reads the contents of the EndValve1PulseDuration register.

Returns:

Type Description
int

Value read from the EndValve1PulseDuration register.

read_end_valve_state() #

Reads the contents of the EndValveState register.

Returns:

Type Description
EndValves

Value read from the EndValveState register.

read_flowmeter() #

Reads the contents of the Flowmeter register.

Returns:

Type Description
FlowmeterPayload

Value read from the Flowmeter register.

read_mimic_end_valve0() #

Reads the contents of the MimicEndValve0 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicEndValve0 register.

read_mimic_end_valve1() #

Reads the contents of the MimicEndValve1 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicEndValve1 register.

read_mimic_valve0() #

Reads the contents of the MimicValve0 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve0 register.

read_mimic_valve1() #

Reads the contents of the MimicValve1 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve1 register.

read_mimic_valve2() #

Reads the contents of the MimicValve2 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve2 register.

read_mimic_valve3() #

Reads the contents of the MimicValve3 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve3 register.

read_odor_valve_state() #

Reads the contents of the OdorValveState register.

Returns:

Type Description
OdorValves

Value read from the OdorValveState register.

read_temperature_calibration_value() #

Reads the contents of the TemperatureCalibrationValue register.

Returns:

Type Description
int

Value read from the TemperatureCalibrationValue register.

read_temperature_value() #

Reads the contents of the TemperatureValue register.

Returns:

Type Description
int

Value read from the TemperatureValue register.

read_user_calibration_enable() #

Reads the contents of the UserCalibrationEnable register.

Returns:

Type Description
bool

Value read from the UserCalibrationEnable register.

read_valve0_pulse_duration() #

Reads the contents of the Valve0PulseDuration register.

Returns:

Type Description
int

Value read from the Valve0PulseDuration register.

read_valve1_pulse_duration() #

Reads the contents of the Valve1PulseDuration register.

Returns:

Type Description
int

Value read from the Valve1PulseDuration register.

read_valve2_pulse_duration() #

Reads the contents of the Valve2PulseDuration register.

Returns:

Type Description
int

Value read from the Valve2PulseDuration register.

read_valve3_pulse_duration() #

Reads the contents of the Valve3PulseDuration register.

Returns:

Type Description
int

Value read from the Valve3PulseDuration register.

read_valve_clear() #

Reads the contents of the ValveClear register.

Returns:

Type Description
Valves

Value read from the ValveClear register.

read_valve_set() #

Reads the contents of the ValveSet register.

Returns:

Type Description
Valves

Value read from the ValveSet register.

read_valve_toggle() #

Reads the contents of the ValveToggle register.

Returns:

Type Description
Valves

Value read from the ValveToggle register.

write_channel0_duty_cycle(value) #

Writes a value to the Channel0DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel0DutyCycle register.

required

write_channel0_target_flow(value) #

Writes a value to the Channel0TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel0TargetFlow register.

required

write_channel0_user_calibration(value) #

Writes a value to the Channel0UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel0UserCalibration register.

required

write_channel1_duty_cycle(value) #

Writes a value to the Channel1DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel1DutyCycle register.

required

write_channel1_target_flow(value) #

Writes a value to the Channel1TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel1TargetFlow register.

required

write_channel1_user_calibration(value) #

Writes a value to the Channel1UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel1UserCalibration register.

required

write_channel2_duty_cycle(value) #

Writes a value to the Channel2DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel2DutyCycle register.

required

write_channel2_target_flow(value) #

Writes a value to the Channel2TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel2TargetFlow register.

required

write_channel2_user_calibration(value) #

Writes a value to the Channel2UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel2UserCalibration register.

required

write_channel3_duty_cycle(value) #

Writes a value to the Channel3DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel3DutyCycle register.

required

write_channel3_range(value) #

Writes a value to the Channel3Range register.

Parameters:

Name Type Description Default
value Channel3RangeConfig

Value to write to the Channel3Range register.

required

write_channel3_target_flow(value) #

Writes a value to the Channel3TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel3TargetFlow register.

required

write_channel3_user_calibration(value) #

Writes a value to the Channel3UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel3UserCalibration register.

required

write_channel3_user_calibration_aux(value) #

Writes a value to the Channel3UserCalibrationAux register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel3UserCalibrationAux register.

required

write_channel4_duty_cycle(value) #

Writes a value to the Channel4DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel4DutyCycle register.

required

write_channel4_target_flow(value) #

Writes a value to the Channel4TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel4TargetFlow register.

required

write_channel4_user_calibration(value) #

Writes a value to the Channel4UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel4UserCalibration register.

required

write_channels_target_flow(value) #

Writes a value to the ChannelsTargetFlow register.

Parameters:

Name Type Description Default
value ChannelsTargetFlowPayload

Value to write to the ChannelsTargetFlow register.

required

write_di0_trigger(value) #

Writes a value to the DI0Trigger register.

Parameters:

Name Type Description Default
value DI0TriggerConfig

Value to write to the DI0Trigger register.

required

write_digital_output_clear(value) #

Writes a value to the DigitalOutputClear register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputClear register.

required

write_digital_output_set(value) #

Writes a value to the DigitalOutputSet register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputSet register.

required

write_digital_output_state(value) #

Writes a value to the DigitalOutputState register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputState register.

required

write_digital_output_toggle(value) #

Writes a value to the DigitalOutputToggle register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputToggle register.

required

write_do0_sync(value) #

Writes a value to the DO0Sync register.

Parameters:

Name Type Description Default
value DO0SyncConfig

Value to write to the DO0Sync register.

required

write_do1_sync(value) #

Writes a value to the DO1Sync register.

Parameters:

Name Type Description Default
value DO1SyncConfig

Value to write to the DO1Sync register.

required

write_enable_events(value) #

Writes a value to the EnableEvents register.

Parameters:

Name Type Description Default
value OlfactometerEvents

Value to write to the EnableEvents register.

required

write_enable_flow(value) #

Writes a value to the EnableFlow register.

Parameters:

Name Type Description Default
value bool

Value to write to the EnableFlow register.

required

write_enable_temperature_calibration(value) #

Writes a value to the EnableTemperatureCalibration register.

Parameters:

Name Type Description Default
value int

Value to write to the EnableTemperatureCalibration register.

required

write_enable_valve_external_control(value) #

Writes a value to the EnableValveExternalControl register.

Parameters:

Name Type Description Default
value bool

Value to write to the EnableValveExternalControl register.

required

write_enable_valve_pulse(value) #

Writes a value to the EnableValvePulse register.

Parameters:

Name Type Description Default
value Valves

Value to write to the EnableValvePulse register.

required

write_end_valve0_pulse_duration(value) #

Writes a value to the EndValve0PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the EndValve0PulseDuration register.

required

write_end_valve1_pulse_duration(value) #

Writes a value to the EndValve1PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the EndValve1PulseDuration register.

required

write_end_valve_state(value) #

Writes a value to the EndValveState register.

Parameters:

Name Type Description Default
value EndValves

Value to write to the EndValveState register.

required

write_mimic_end_valve0(value) #

Writes a value to the MimicEndValve0 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicEndValve0 register.

required

write_mimic_end_valve1(value) #

Writes a value to the MimicEndValve1 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicEndValve1 register.

required

write_mimic_valve0(value) #

Writes a value to the MimicValve0 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve0 register.

required

write_mimic_valve1(value) #

Writes a value to the MimicValve1 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve1 register.

required

write_mimic_valve2(value) #

Writes a value to the MimicValve2 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve2 register.

required

write_mimic_valve3(value) #

Writes a value to the MimicValve3 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve3 register.

required

write_odor_valve_state(value) #

Writes a value to the OdorValveState register.

Parameters:

Name Type Description Default
value OdorValves

Value to write to the OdorValveState register.

required

write_temperature_calibration_value(value) #

Writes a value to the TemperatureCalibrationValue register.

Parameters:

Name Type Description Default
value int

Value to write to the TemperatureCalibrationValue register.

required

write_user_calibration_enable(value) #

Writes a value to the UserCalibrationEnable register.

Parameters:

Name Type Description Default
value bool

Value to write to the UserCalibrationEnable register.

required

write_valve0_pulse_duration(value) #

Writes a value to the Valve0PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve0PulseDuration register.

required

write_valve1_pulse_duration(value) #

Writes a value to the Valve1PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve1PulseDuration register.

required

write_valve2_pulse_duration(value) #

Writes a value to the Valve2PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve2PulseDuration register.

required

write_valve3_pulse_duration(value) #

Writes a value to the Valve3PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve3PulseDuration register.

required

write_valve_clear(value) #

Writes a value to the ValveClear register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveClear register.

required

write_valve_set(value) #

Writes a value to the ValveSet register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveSet register.

required

write_valve_toggle(value) #

Writes a value to the ValveToggle register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveToggle register.

required

OlfactometerEvents #

Bases: IntFlag

The events that can be enabled/disabled.

Attributes:

Name Type Description
FLOWMETER int

No description currently available

DI0_TRIGGER int

No description currently available

CHANNEL_ACTUAL_FLOW int

No description currently available

OlfactometerRegisters #

Bases: IntEnum

Enum for all available registers in the Olfactometer device.

Attributes:

Name Type Description
ENABLE_FLOW int

Starts or stops the flow in all channels.

FLOWMETER int

Value of single ADC read from all flowmeter channels.

DI0_STATE int

State of the digital input pin 0.

CHANNEL0_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL1_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL2_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL3_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL4_USER_CALIBRATION int

Calibration values specific for channel 4 [x0,...xn], where x= ADC raw value for 0:100:1000 ml/min.

CHANNEL3_USER_CALIBRATION_AUX int

Calibration values specific for channel 3 if Channel3RangeConfig = FlowRate1000. [x0,...xn], where x= ADC raw value for 0:100:1000 ml/min.

USER_CALIBRATION_ENABLE int

Override the factory calibration values, replacing with CHX_USER_CALIBRATION.

CHANNEL0_TARGET_FLOW int

Sets the flow-rate rate for channel 0 [ml/min].

CHANNEL1_TARGET_FLOW int

Sets the flow-rate rate for channel 1 [ml/min].

CHANNEL2_TARGET_FLOW int

Sets the flow-rate rate for channel 2 [ml/min].

CHANNEL3_TARGET_FLOW int

Sets the flow-rate rate for channel 3 [ml/min].

CHANNEL4_TARGET_FLOW int

Sets the flow-rate rate for channel 4 [ml/min].

CHANNELS_TARGET_FLOW int

Sets the flow-rate rate for all channels [ml/min].

CHANNEL0_ACTUAL_FLOW int

Actual flow-rate read for channel 0 - flowmeter 0 [ml/min].

CHANNEL1_ACTUAL_FLOW int

Actual flow-rate read for channel 1 - flowmeter 1 [ml/min].

CHANNEL2_ACTUAL_FLOW int

Actual flow-rate read for channel 2 - flowmeter 2 [ml/min].

CHANNEL3_ACTUAL_FLOW int

Actual flow-rate read for channel 3 - flowmeter 3 [ml/min].

CHANNEL4_ACTUAL_FLOW int

Actual flow-rate read for channel 4 - flowmeter 4 [ml/min].

CHANNEL0_DUTY_CYCLE int

Duty cycle for proportional valve 0 [%].

CHANNEL1_DUTY_CYCLE int

Duty cycle for proportional valve 1 [%].

CHANNEL2_DUTY_CYCLE int

Duty cycle for proportional valve 2 [%].

CHANNEL3_DUTY_CYCLE int

Duty cycle for proportional valve 3 [%].

CHANNEL4_DUTY_CYCLE int

Duty cycle for proportional valve 4 [%].

DIGITAL_OUTPUT_SET int

Set the specified digital output lines.

DIGITAL_OUTPUT_CLEAR int

Clears the specified digital output lines.

DIGITAL_OUTPUT_TOGGLE int

Toggles the specified digital output lines.

DIGITAL_OUTPUT_STATE int

Write the state of all digital output lines.

ENABLE_VALVE_PULSE int

Enable pulse mode for valves.

VALVE_SET int

Set the specified valve output lines.

VALVE_CLEAR int

Clears the specified valve output lines.

VALVE_TOGGLE int

Toggles the specified valve output lines.

ODOR_VALVE_STATE int

Write the state of all odor valve output lines.

END_VALVE_STATE int

Write the state of all end valve output lines.

VALVE0_PULSE_DURATION int

Sets the pulse duration for Valve0.

VALVE1_PULSE_DURATION int

Sets the pulse duration for Valve1.

VALVE2_PULSE_DURATION int

Sets the pulse duration for Valve2.

VALVE3_PULSE_DURATION int

Sets the pulse duration for Valve3.

END_VALVE0_PULSE_DURATION int

Sets the pulse duration for EndValve0.

END_VALVE1_PULSE_DURATION int

Sets the pulse duration for EndValve1.

DO0_SYNC int

Configuration of the digital output 0 (DOUT0).

DO1_SYNC int

Configuration of the digital output 1 (DOUT1).

DI0_TRIGGER int

Configuration of the digital input pin 0 (DIN0).

MIMIC_VALVE0 int

Mimic Valve0.

MIMIC_VALVE1 int

Mimic Valve1.

MIMIC_VALVE2 int

Mimic Valve2.

MIMIC_VALVE3 int

Mimic Valve3.

MIMIC_END_VALVE0 int

Mimic EndValve0.

MIMIC_END_VALVE1 int

Mimic EndValve1.

ENABLE_VALVE_EXTERNAL_CONTROL int

Enable the valves control via low-level IO screw terminals.

CHANNEL3_RANGE int

Selects the flow range for the channel 3.

TEMPERATURE_VALUE int

Temperature sensor reading value.

ENABLE_TEMPERATURE_CALIBRATION int

Enable flow adjustment based on the temperature calibration.

TEMPERATURE_CALIBRATION_VALUE int

Temperature value measured during the device calibration.

ENABLE_EVENTS int

Specifies the active events in the device.

PayloadType #

Bases: IntEnum

An enumeration of the allowed payload types of a Harp message. More information on the PayloadType byte of a Harp message can be found here.

Attributes:

Name Type Description
U8 int

The value that corresponds to a message of type U8

S8 int

The value that corresponds to a message of type S8

U16 int

The value that corresponds to a message of type U16

S16 int

The value that corresponds to a message of type S16

U32 int

The value that corresponds to a message of type U32

S32 int

The value that corresponds to a message of type S32

U64 int

The value that corresponds to a message of type U64

S64 int

The value that corresponds to a message of type S64

Float int

The value that corresponds to a message of type Float

Timestamp int

The value that corresponds to a message of type Timestamp. This is not a valid PayloadType, but it is used to indicate that the message has a timestamp.

TimestampedU8 int

The value that corresponds to a message of type TimestampedU8

TimestampedS8 int

The value that corresponds to a message of type TimestampedS8

TimestampedU16 int

The value that corresponds to a message of type TimestampedU16

TimestampedS16 int

The value that corresponds to a message of type TimestampedS16

TimestampedU32 int

The value that corresponds to a message of type TimestampedU32

TimestampedS32 int

The value that corresponds to a message of type TimestampedS32

TimestampedU64 int

The value that corresponds to a message of type TimestampedU64

TimestampedS64 int

The value that corresponds to a message of type TimestampedS64

TimestampedFloat int

The value that corresponds to a message of type TimestampedFloat

ReplyHarpMessage #

Bases: HarpMessage

A response message from a Harp device.

Attributes:

Name Type Description
payload Union[int, list[int]]

The message payload formatted as the appropriate type

timestamp float

The Harp timestamp at which the message was sent

is_error property #

Indicates if this HarpMessage is an error message or not.

Returns:

Type Description
bool

Returns True if this HarpMessage is an error message, False otherwise.

timestamp property #

The Harp timestamp at which the message was sent.

Returns:

Type Description
float

The Harp timestamp at which the message was sent

__init__(frame) #

Parameters:

Name Type Description Default
frame bytearray

The Harp message in bytearray format

required

payload_as_string() #

Returns the payload as a str.

Returns:

Type Description
str

The payload parsed as a str

Valves #

Bases: IntFlag

Specifies the states of the valves.

Attributes:

Name Type Description
VALVE0 int

No description currently available

VALVE1 int

No description currently available

VALVE2 int

No description currently available

VALVE3 int

No description currently available

END_VALVE0 int

No description currently available

END_VALVE1 int

No description currently available

VALVE_DUMMY int

No description currently available

harpdevice #

Channel3RangeConfig #

Bases: IntEnum

Available flow ranges for channel 3 (ml/min).

Attributes:

Name Type Description
FLOW_RATE100 int

No description currently available

FLOW_RATE1000 int

No description currently available

ChannelsTargetFlowPayload dataclass #

ChannelsTargetFlowPayload(Channel0: float, Channel1: float, Channel2: float, Channel3: float, Channel4: float)

Parameters:

Name Type Description Default
Channel0 float
required
Channel1 float
required
Channel2 float
required
Channel3 float
required
Channel4 float
required

DI0TriggerConfig #

Bases: IntEnum

Specifies the configuration of the digital input 0 (DIN0).

Attributes:

Name Type Description
SYNC int

No description currently available

ENABLE_FLOW_WHILE_HIGH int

No description currently available

VALVE_TOGGLE int

No description currently available

DO0SyncConfig #

Bases: IntEnum

Available configurations when using DO0 pin to report firmware events.

Attributes:

Name Type Description
NONE int

No description currently available

MIMIC_ENABLE_FLOW int

No description currently available

DO1SyncConfig #

Bases: IntEnum

Available configurations when using DO1 pin to report firmware events.

Attributes:

Name Type Description
NONE int

No description currently available

MIMIC_ENABLE_FLOW int

No description currently available

DigitalOutputs #

Bases: IntFlag

Specifies the states of the digital outputs.

Attributes:

Name Type Description
DO0 int

No description currently available

DO1 int

No description currently available

DigitalState #

Bases: IntEnum

The state of a digital pin.

Attributes:

Name Type Description
LOW int

No description currently available

HIGH int

No description currently available

EndValves #

Bases: IntFlag

Specifies the states of the end valves.

Attributes:

Name Type Description
END_VALVE0 int

No description currently available

END_VALVE1 int

No description currently available

VALVE_DUMMY int

No description currently available

FlowmeterPayload dataclass #

FlowmeterPayload(Channel0: int, Channel1: int, Channel2: int, Channel3: int, Channel4: int)

Parameters:

Name Type Description Default
Channel0 int
required
Channel1 int
required
Channel2 int
required
Channel3 int
required
Channel4 int
required

MimicOutputs #

Bases: IntEnum

Specifies the target IO on which to mimic the specified register.

Attributes:

Name Type Description
NONE int

No description currently available

DO0 int

No description currently available

DO1 int

No description currently available

OdorValves #

Bases: IntFlag

Specifies the states of the odor valves.

Attributes:

Name Type Description
VALVE0 int

No description currently available

VALVE1 int

No description currently available

VALVE2 int

No description currently available

VALVE3 int

No description currently available

Olfactometer #

Bases: Device

Olfactometer class for controlling the device.

read_channel0_actual_flow() #

Reads the contents of the Channel0ActualFlow register.

Returns:

Type Description
float

Value read from the Channel0ActualFlow register.

read_channel0_duty_cycle() #

Reads the contents of the Channel0DutyCycle register.

Returns:

Type Description
float

Value read from the Channel0DutyCycle register.

read_channel0_target_flow() #

Reads the contents of the Channel0TargetFlow register.

Returns:

Type Description
float

Value read from the Channel0TargetFlow register.

read_channel0_user_calibration() #

Reads the contents of the Channel0UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel0UserCalibration register.

read_channel1_actual_flow() #

Reads the contents of the Channel1ActualFlow register.

Returns:

Type Description
float

Value read from the Channel1ActualFlow register.

read_channel1_duty_cycle() #

Reads the contents of the Channel1DutyCycle register.

Returns:

Type Description
float

Value read from the Channel1DutyCycle register.

read_channel1_target_flow() #

Reads the contents of the Channel1TargetFlow register.

Returns:

Type Description
float

Value read from the Channel1TargetFlow register.

read_channel1_user_calibration() #

Reads the contents of the Channel1UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel1UserCalibration register.

read_channel2_actual_flow() #

Reads the contents of the Channel2ActualFlow register.

Returns:

Type Description
float

Value read from the Channel2ActualFlow register.

read_channel2_duty_cycle() #

Reads the contents of the Channel2DutyCycle register.

Returns:

Type Description
float

Value read from the Channel2DutyCycle register.

read_channel2_target_flow() #

Reads the contents of the Channel2TargetFlow register.

Returns:

Type Description
float

Value read from the Channel2TargetFlow register.

read_channel2_user_calibration() #

Reads the contents of the Channel2UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel2UserCalibration register.

read_channel3_actual_flow() #

Reads the contents of the Channel3ActualFlow register.

Returns:

Type Description
float

Value read from the Channel3ActualFlow register.

read_channel3_duty_cycle() #

Reads the contents of the Channel3DutyCycle register.

Returns:

Type Description
float

Value read from the Channel3DutyCycle register.

read_channel3_range() #

Reads the contents of the Channel3Range register.

Returns:

Type Description
Channel3RangeConfig

Value read from the Channel3Range register.

read_channel3_target_flow() #

Reads the contents of the Channel3TargetFlow register.

Returns:

Type Description
float

Value read from the Channel3TargetFlow register.

read_channel3_user_calibration() #

Reads the contents of the Channel3UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel3UserCalibration register.

read_channel3_user_calibration_aux() #

Reads the contents of the Channel3UserCalibrationAux register.

Returns:

Type Description
list[int]

Value read from the Channel3UserCalibrationAux register.

read_channel4_actual_flow() #

Reads the contents of the Channel4ActualFlow register.

Returns:

Type Description
float

Value read from the Channel4ActualFlow register.

read_channel4_duty_cycle() #

Reads the contents of the Channel4DutyCycle register.

Returns:

Type Description
float

Value read from the Channel4DutyCycle register.

read_channel4_target_flow() #

Reads the contents of the Channel4TargetFlow register.

Returns:

Type Description
float

Value read from the Channel4TargetFlow register.

read_channel4_user_calibration() #

Reads the contents of the Channel4UserCalibration register.

Returns:

Type Description
list[int]

Value read from the Channel4UserCalibration register.

read_channels_target_flow() #

Reads the contents of the ChannelsTargetFlow register.

Returns:

Type Description
ChannelsTargetFlowPayload

Value read from the ChannelsTargetFlow register.

read_di0_state() #

Reads the contents of the DI0State register.

Returns:

Type Description
DigitalState

Value read from the DI0State register.

read_di0_trigger() #

Reads the contents of the DI0Trigger register.

Returns:

Type Description
DI0TriggerConfig

Value read from the DI0Trigger register.

read_digital_output_clear() #

Reads the contents of the DigitalOutputClear register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputClear register.

read_digital_output_set() #

Reads the contents of the DigitalOutputSet register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputSet register.

read_digital_output_state() #

Reads the contents of the DigitalOutputState register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputState register.

read_digital_output_toggle() #

Reads the contents of the DigitalOutputToggle register.

Returns:

Type Description
DigitalOutputs

Value read from the DigitalOutputToggle register.

read_do0_sync() #

Reads the contents of the DO0Sync register.

Returns:

Type Description
DO0SyncConfig

Value read from the DO0Sync register.

read_do1_sync() #

Reads the contents of the DO1Sync register.

Returns:

Type Description
DO1SyncConfig

Value read from the DO1Sync register.

read_enable_events() #

Reads the contents of the EnableEvents register.

Returns:

Type Description
OlfactometerEvents

Value read from the EnableEvents register.

read_enable_flow() #

Reads the contents of the EnableFlow register.

Returns:

Type Description
bool

Value read from the EnableFlow register.

read_enable_temperature_calibration() #

Reads the contents of the EnableTemperatureCalibration register.

Returns:

Type Description
int

Value read from the EnableTemperatureCalibration register.

read_enable_valve_external_control() #

Reads the contents of the EnableValveExternalControl register.

Returns:

Type Description
bool

Value read from the EnableValveExternalControl register.

read_enable_valve_pulse() #

Reads the contents of the EnableValvePulse register.

Returns:

Type Description
Valves

Value read from the EnableValvePulse register.

read_end_valve0_pulse_duration() #

Reads the contents of the EndValve0PulseDuration register.

Returns:

Type Description
int

Value read from the EndValve0PulseDuration register.

read_end_valve1_pulse_duration() #

Reads the contents of the EndValve1PulseDuration register.

Returns:

Type Description
int

Value read from the EndValve1PulseDuration register.

read_end_valve_state() #

Reads the contents of the EndValveState register.

Returns:

Type Description
EndValves

Value read from the EndValveState register.

read_flowmeter() #

Reads the contents of the Flowmeter register.

Returns:

Type Description
FlowmeterPayload

Value read from the Flowmeter register.

read_mimic_end_valve0() #

Reads the contents of the MimicEndValve0 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicEndValve0 register.

read_mimic_end_valve1() #

Reads the contents of the MimicEndValve1 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicEndValve1 register.

read_mimic_valve0() #

Reads the contents of the MimicValve0 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve0 register.

read_mimic_valve1() #

Reads the contents of the MimicValve1 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve1 register.

read_mimic_valve2() #

Reads the contents of the MimicValve2 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve2 register.

read_mimic_valve3() #

Reads the contents of the MimicValve3 register.

Returns:

Type Description
MimicOutputs

Value read from the MimicValve3 register.

read_odor_valve_state() #

Reads the contents of the OdorValveState register.

Returns:

Type Description
OdorValves

Value read from the OdorValveState register.

read_temperature_calibration_value() #

Reads the contents of the TemperatureCalibrationValue register.

Returns:

Type Description
int

Value read from the TemperatureCalibrationValue register.

read_temperature_value() #

Reads the contents of the TemperatureValue register.

Returns:

Type Description
int

Value read from the TemperatureValue register.

read_user_calibration_enable() #

Reads the contents of the UserCalibrationEnable register.

Returns:

Type Description
bool

Value read from the UserCalibrationEnable register.

read_valve0_pulse_duration() #

Reads the contents of the Valve0PulseDuration register.

Returns:

Type Description
int

Value read from the Valve0PulseDuration register.

read_valve1_pulse_duration() #

Reads the contents of the Valve1PulseDuration register.

Returns:

Type Description
int

Value read from the Valve1PulseDuration register.

read_valve2_pulse_duration() #

Reads the contents of the Valve2PulseDuration register.

Returns:

Type Description
int

Value read from the Valve2PulseDuration register.

read_valve3_pulse_duration() #

Reads the contents of the Valve3PulseDuration register.

Returns:

Type Description
int

Value read from the Valve3PulseDuration register.

read_valve_clear() #

Reads the contents of the ValveClear register.

Returns:

Type Description
Valves

Value read from the ValveClear register.

read_valve_set() #

Reads the contents of the ValveSet register.

Returns:

Type Description
Valves

Value read from the ValveSet register.

read_valve_toggle() #

Reads the contents of the ValveToggle register.

Returns:

Type Description
Valves

Value read from the ValveToggle register.

write_channel0_duty_cycle(value) #

Writes a value to the Channel0DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel0DutyCycle register.

required
write_channel0_target_flow(value) #

Writes a value to the Channel0TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel0TargetFlow register.

required
write_channel0_user_calibration(value) #

Writes a value to the Channel0UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel0UserCalibration register.

required
write_channel1_duty_cycle(value) #

Writes a value to the Channel1DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel1DutyCycle register.

required
write_channel1_target_flow(value) #

Writes a value to the Channel1TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel1TargetFlow register.

required
write_channel1_user_calibration(value) #

Writes a value to the Channel1UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel1UserCalibration register.

required
write_channel2_duty_cycle(value) #

Writes a value to the Channel2DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel2DutyCycle register.

required
write_channel2_target_flow(value) #

Writes a value to the Channel2TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel2TargetFlow register.

required
write_channel2_user_calibration(value) #

Writes a value to the Channel2UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel2UserCalibration register.

required
write_channel3_duty_cycle(value) #

Writes a value to the Channel3DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel3DutyCycle register.

required
write_channel3_range(value) #

Writes a value to the Channel3Range register.

Parameters:

Name Type Description Default
value Channel3RangeConfig

Value to write to the Channel3Range register.

required
write_channel3_target_flow(value) #

Writes a value to the Channel3TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel3TargetFlow register.

required
write_channel3_user_calibration(value) #

Writes a value to the Channel3UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel3UserCalibration register.

required
write_channel3_user_calibration_aux(value) #

Writes a value to the Channel3UserCalibrationAux register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel3UserCalibrationAux register.

required
write_channel4_duty_cycle(value) #

Writes a value to the Channel4DutyCycle register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel4DutyCycle register.

required
write_channel4_target_flow(value) #

Writes a value to the Channel4TargetFlow register.

Parameters:

Name Type Description Default
value float

Value to write to the Channel4TargetFlow register.

required
write_channel4_user_calibration(value) #

Writes a value to the Channel4UserCalibration register.

Parameters:

Name Type Description Default
value list[int]

Value to write to the Channel4UserCalibration register.

required
write_channels_target_flow(value) #

Writes a value to the ChannelsTargetFlow register.

Parameters:

Name Type Description Default
value ChannelsTargetFlowPayload

Value to write to the ChannelsTargetFlow register.

required
write_di0_trigger(value) #

Writes a value to the DI0Trigger register.

Parameters:

Name Type Description Default
value DI0TriggerConfig

Value to write to the DI0Trigger register.

required
write_digital_output_clear(value) #

Writes a value to the DigitalOutputClear register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputClear register.

required
write_digital_output_set(value) #

Writes a value to the DigitalOutputSet register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputSet register.

required
write_digital_output_state(value) #

Writes a value to the DigitalOutputState register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputState register.

required
write_digital_output_toggle(value) #

Writes a value to the DigitalOutputToggle register.

Parameters:

Name Type Description Default
value DigitalOutputs

Value to write to the DigitalOutputToggle register.

required
write_do0_sync(value) #

Writes a value to the DO0Sync register.

Parameters:

Name Type Description Default
value DO0SyncConfig

Value to write to the DO0Sync register.

required
write_do1_sync(value) #

Writes a value to the DO1Sync register.

Parameters:

Name Type Description Default
value DO1SyncConfig

Value to write to the DO1Sync register.

required
write_enable_events(value) #

Writes a value to the EnableEvents register.

Parameters:

Name Type Description Default
value OlfactometerEvents

Value to write to the EnableEvents register.

required
write_enable_flow(value) #

Writes a value to the EnableFlow register.

Parameters:

Name Type Description Default
value bool

Value to write to the EnableFlow register.

required
write_enable_temperature_calibration(value) #

Writes a value to the EnableTemperatureCalibration register.

Parameters:

Name Type Description Default
value int

Value to write to the EnableTemperatureCalibration register.

required
write_enable_valve_external_control(value) #

Writes a value to the EnableValveExternalControl register.

Parameters:

Name Type Description Default
value bool

Value to write to the EnableValveExternalControl register.

required
write_enable_valve_pulse(value) #

Writes a value to the EnableValvePulse register.

Parameters:

Name Type Description Default
value Valves

Value to write to the EnableValvePulse register.

required
write_end_valve0_pulse_duration(value) #

Writes a value to the EndValve0PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the EndValve0PulseDuration register.

required
write_end_valve1_pulse_duration(value) #

Writes a value to the EndValve1PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the EndValve1PulseDuration register.

required
write_end_valve_state(value) #

Writes a value to the EndValveState register.

Parameters:

Name Type Description Default
value EndValves

Value to write to the EndValveState register.

required
write_mimic_end_valve0(value) #

Writes a value to the MimicEndValve0 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicEndValve0 register.

required
write_mimic_end_valve1(value) #

Writes a value to the MimicEndValve1 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicEndValve1 register.

required
write_mimic_valve0(value) #

Writes a value to the MimicValve0 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve0 register.

required
write_mimic_valve1(value) #

Writes a value to the MimicValve1 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve1 register.

required
write_mimic_valve2(value) #

Writes a value to the MimicValve2 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve2 register.

required
write_mimic_valve3(value) #

Writes a value to the MimicValve3 register.

Parameters:

Name Type Description Default
value MimicOutputs

Value to write to the MimicValve3 register.

required
write_odor_valve_state(value) #

Writes a value to the OdorValveState register.

Parameters:

Name Type Description Default
value OdorValves

Value to write to the OdorValveState register.

required
write_temperature_calibration_value(value) #

Writes a value to the TemperatureCalibrationValue register.

Parameters:

Name Type Description Default
value int

Value to write to the TemperatureCalibrationValue register.

required
write_user_calibration_enable(value) #

Writes a value to the UserCalibrationEnable register.

Parameters:

Name Type Description Default
value bool

Value to write to the UserCalibrationEnable register.

required
write_valve0_pulse_duration(value) #

Writes a value to the Valve0PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve0PulseDuration register.

required
write_valve1_pulse_duration(value) #

Writes a value to the Valve1PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve1PulseDuration register.

required
write_valve2_pulse_duration(value) #

Writes a value to the Valve2PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve2PulseDuration register.

required
write_valve3_pulse_duration(value) #

Writes a value to the Valve3PulseDuration register.

Parameters:

Name Type Description Default
value int

Value to write to the Valve3PulseDuration register.

required
write_valve_clear(value) #

Writes a value to the ValveClear register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveClear register.

required
write_valve_set(value) #

Writes a value to the ValveSet register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveSet register.

required
write_valve_toggle(value) #

Writes a value to the ValveToggle register.

Parameters:

Name Type Description Default
value Valves

Value to write to the ValveToggle register.

required

OlfactometerEvents #

Bases: IntFlag

The events that can be enabled/disabled.

Attributes:

Name Type Description
FLOWMETER int

No description currently available

DI0_TRIGGER int

No description currently available

CHANNEL_ACTUAL_FLOW int

No description currently available

OlfactometerRegisters #

Bases: IntEnum

Enum for all available registers in the Olfactometer device.

Attributes:

Name Type Description
ENABLE_FLOW int

Starts or stops the flow in all channels.

FLOWMETER int

Value of single ADC read from all flowmeter channels.

DI0_STATE int

State of the digital input pin 0.

CHANNEL0_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL1_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL2_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL3_USER_CALIBRATION int

Calibration values for a single channel [x0,...xn], where x= ADC raw value for 0:10:100 ml/min.

CHANNEL4_USER_CALIBRATION int

Calibration values specific for channel 4 [x0,...xn], where x= ADC raw value for 0:100:1000 ml/min.

CHANNEL3_USER_CALIBRATION_AUX int

Calibration values specific for channel 3 if Channel3RangeConfig = FlowRate1000. [x0,...xn], where x= ADC raw value for 0:100:1000 ml/min.

USER_CALIBRATION_ENABLE int

Override the factory calibration values, replacing with CHX_USER_CALIBRATION.

CHANNEL0_TARGET_FLOW int

Sets the flow-rate rate for channel 0 [ml/min].

CHANNEL1_TARGET_FLOW int

Sets the flow-rate rate for channel 1 [ml/min].

CHANNEL2_TARGET_FLOW int

Sets the flow-rate rate for channel 2 [ml/min].

CHANNEL3_TARGET_FLOW int

Sets the flow-rate rate for channel 3 [ml/min].

CHANNEL4_TARGET_FLOW int

Sets the flow-rate rate for channel 4 [ml/min].

CHANNELS_TARGET_FLOW int

Sets the flow-rate rate for all channels [ml/min].

CHANNEL0_ACTUAL_FLOW int

Actual flow-rate read for channel 0 - flowmeter 0 [ml/min].

CHANNEL1_ACTUAL_FLOW int

Actual flow-rate read for channel 1 - flowmeter 1 [ml/min].

CHANNEL2_ACTUAL_FLOW int

Actual flow-rate read for channel 2 - flowmeter 2 [ml/min].

CHANNEL3_ACTUAL_FLOW int

Actual flow-rate read for channel 3 - flowmeter 3 [ml/min].

CHANNEL4_ACTUAL_FLOW int

Actual flow-rate read for channel 4 - flowmeter 4 [ml/min].

CHANNEL0_DUTY_CYCLE int

Duty cycle for proportional valve 0 [%].

CHANNEL1_DUTY_CYCLE int

Duty cycle for proportional valve 1 [%].

CHANNEL2_DUTY_CYCLE int

Duty cycle for proportional valve 2 [%].

CHANNEL3_DUTY_CYCLE int

Duty cycle for proportional valve 3 [%].

CHANNEL4_DUTY_CYCLE int

Duty cycle for proportional valve 4 [%].

DIGITAL_OUTPUT_SET int

Set the specified digital output lines.

DIGITAL_OUTPUT_CLEAR int

Clears the specified digital output lines.

DIGITAL_OUTPUT_TOGGLE int

Toggles the specified digital output lines.

DIGITAL_OUTPUT_STATE int

Write the state of all digital output lines.

ENABLE_VALVE_PULSE int

Enable pulse mode for valves.

VALVE_SET int

Set the specified valve output lines.

VALVE_CLEAR int

Clears the specified valve output lines.

VALVE_TOGGLE int

Toggles the specified valve output lines.

ODOR_VALVE_STATE int

Write the state of all odor valve output lines.

END_VALVE_STATE int

Write the state of all end valve output lines.

VALVE0_PULSE_DURATION int

Sets the pulse duration for Valve0.

VALVE1_PULSE_DURATION int

Sets the pulse duration for Valve1.

VALVE2_PULSE_DURATION int

Sets the pulse duration for Valve2.

VALVE3_PULSE_DURATION int

Sets the pulse duration for Valve3.

END_VALVE0_PULSE_DURATION int

Sets the pulse duration for EndValve0.

END_VALVE1_PULSE_DURATION int

Sets the pulse duration for EndValve1.

DO0_SYNC int

Configuration of the digital output 0 (DOUT0).

DO1_SYNC int

Configuration of the digital output 1 (DOUT1).

DI0_TRIGGER int

Configuration of the digital input pin 0 (DIN0).

MIMIC_VALVE0 int

Mimic Valve0.

MIMIC_VALVE1 int

Mimic Valve1.

MIMIC_VALVE2 int

Mimic Valve2.

MIMIC_VALVE3 int

Mimic Valve3.

MIMIC_END_VALVE0 int

Mimic EndValve0.

MIMIC_END_VALVE1 int

Mimic EndValve1.

ENABLE_VALVE_EXTERNAL_CONTROL int

Enable the valves control via low-level IO screw terminals.

CHANNEL3_RANGE int

Selects the flow range for the channel 3.

TEMPERATURE_VALUE int

Temperature sensor reading value.

ENABLE_TEMPERATURE_CALIBRATION int

Enable flow adjustment based on the temperature calibration.

TEMPERATURE_CALIBRATION_VALUE int

Temperature value measured during the device calibration.

ENABLE_EVENTS int

Specifies the active events in the device.

Valves #

Bases: IntFlag

Specifies the states of the valves.

Attributes:

Name Type Description
VALVE0 int

No description currently available

VALVE1 int

No description currently available

VALVE2 int

No description currently available

VALVE3 int

No description currently available

END_VALVE0 int

No description currently available

END_VALVE1 int

No description currently available

VALVE_DUMMY int

No description currently available