Skip to main content

General Information

pigeon‑transmission is an independently developed Python library that provides simple and reliable serial communication with measurement devices from IMT Analytics. It is designed for users who want to automate data acquisition, integrate measurement workflows, or control devices programmatically.

This is an unofficial project and is not developed, reviewed, or supported by IMT Analytics. The development of this library was carried out entirely independently of IMT Analytics.

🔌 Supported Devices:

Device Python classes Comment
FlowMeterF1 DeviceF1 & EnumF1 ✅ Fully supported
FlowMeterF2 DeviceF2 & EnumF2 ✅ Fully supported
CITREXH4 DeviceH4 & EnumH4 ✅ Fully supported
CITREXH5 DeviceH5 & EnumH5 ✅ Fully supported
FlowAnalyser PF-300 DevicePF300 & EnumPF300 ✅ Fully supported
FlowAnalyser Pro DevicePro & EnumPro ⚠️ Fully supported, but not yet tested

🐛 Feedback & Bug Reports

If you encounter any errors, notice any inaccuracies, or identify a missing feature or use case, please contact me using the email address provided alongside this section. Please include a detailed and clear description of the issue or suggestion so that I can better understand and address it

⚙️ Installation

Python 3.10 or higher is required

pip install pigeon-transmission

🔠 Enums

Instead of using plain strings, you can use the provided Enums for better IDE autocompletion and type safety:

from pigeon_transmission import DeviceH5, EnumH5

device = DeviceH4(port="com2", baudrate=19200)
# Instead of:
device.write_setting(operation_name="gas type", value="air")

# You can use:
device.write_setting(operation_name=EnumH5.WriteSetting.GAS_TYPE, value=EnumH5.WriteSetting_GasType.AIR)

Both styles are fully supported and produce identical results. All available Enums can be explored directly in your IDE by typing EnumH5. and using autocompletion.

📏 Limits & Units

You can retrieve the valid limits and units for any measurement using get_operation_limit_and_unit:

from pigeon_transmission import DeviceH5, EnumH5

device = DeviceH5(port="com2", baudrate=19200)
# For DevicePf300(), make sure that a COM port has already been opened
# and that the correct trigger source is selected before calling this method.
# The selected trigger source affects the limits returned by certain RM commands.
# Selecting the wrong trigger source may result in incorrect limits and even
# incorrect unit conversions.
limits_and_units = device.get_operation_limit_and_unit(
    operation_names=[
        EnumH5.ReadMeasurement.HIGH_FLOW,
        EnumH5.ReadMeasurement.DIFFERENTIAL_PRESSURE,
        EnumH5.ReadMeasurement.TEMPERATURE
    ]
)

# Access limits and unit for a specific measurement
print(limits_and_units[EnumH5.ReadMeasurement.HIGH_FLOW]["limits"]["min"])  # minimum value
print(limits_and_units[EnumH5.ReadMeasurement.HIGH_FLOW]["limits"]["max"])  # maximum value
print(limits_and_units[EnumH5.ReadMeasurement.HIGH_FLOW]["unit"])  # unit e.g. "l/min"

Note: min and max are None if the measurement returns a string value instead of a numeric value (e.g. expiration). If a translated value is None, the value is considered invalid.

🪵 Logging

Logging can be enabled by passing log_level to the constructor. All communication details, lifecycle events, and errors are then written to the console and optionally to a log file. Logging can also be changed or disabled at any time during an active session:

import logging
from pigeon_transmission import DeviceH4

device = DeviceH4(port="COM2", log_level=logging.DEBUG)
device.set_logging(enabled=False, level=logging.DEBUG)  # disable logging
device.set_logging(enabled=True, level=logging.WARNING)  # re-enable with higher level
device.set_logging(enabled=True, level=logging.DEBUG, log_file="device.log")  # add log file

Available log levels:

Level Constant Description
10 logging.DEBUG Every sent/received byte, internal state changes
20 logging.INFO Lifecycle events (port open/close, stream start/stop)
30 logging.WARNING Retries, unexpected but recoverable situations
40 logging.ERROR Failures directly before an exception is raised

🚀 Example Usage

First Example - with statement

from pigeon_transmission import DeviceH4, EnumH4
import logging

with DeviceH4(port="com2", log_level=logging.WARNING) as device:
    device.write_setting(operation_name="gas type", value="air")  # WS with string
    device.write_setting(operation_name=EnumH4.WriteSetting.GAS_TYPE, value=EnumH4.WriteSetting_GasType.AIR)

Second Example - Explicit Resource Management

from pigeon_transmission import DeviceH4, EnumH4

device = DeviceH4()
device.open_serial_interface(port="com2")  # open
device.write_setting(operation_name=EnumH4.WriteSetting.GAS_TYPE, value=EnumH4.WriteSetting_GasType.AIR)
device.close_serial_interface()  # close

Third Example - Manual Resource Management (The instance does not need to stay alive)

from pigeon_transmission import DeviceH4

device = DeviceH4()
serial_object = device.open_serial_interface(port="com2")  # open
device.execute_command(operation_name="switch echo", value="off", serial_object=serial_object)  # CM
device.close_serial_interface(serial_object=serial_object)  # close

Read multiple measurements - uses "read_measurement" method to acquire repeated measurements

from pigeon_transmission import DeviceH5, EnumH5

with DeviceH5(port="COM2", baudrate=19200) as device:
    values = device.read_multiple_measurements(
        operation_name=EnumH5.ReadMeasurement.HIGH_FLOW,
        sample_count=10,   # number of measurements
        sample_rate=2      # measurements per second (min: 0.01 | max: 20)
    )
    print(values)  # ['15.0', '15.1', '14.9', ...]

Note: The sample_rate is an approximate target value. Due to the nature of serial communication, the actual timing between measurements cannot be guaranteed with exact precision. For time-critical applications, use the data stream instead.

Data stream (read 3 values)

import queue  # only for data stream
import threading  # only for data stream
from pigeon_transmission import DeviceH4, EnumH4

device = DeviceH4()
device.open_serial_interface(port="com2")  # open serial connection

data_queue, stop_queue, error_queue = queue.Queue(), queue.Queue(), queue.Queue()

# Start background thread for data stream
# Tip: You can also use Enums and Strings here
thread_stream = threading.Thread(
    target=device.start_stream,
    args=(EnumH4.StartStream.HIGH_FLOW,
          EnumH4.StartStream.DIFFERENTIAL_PRESSURE,
          EnumH4.StartStream.TEMPERATURE,
          data_queue, stop_queue, error_queue, 5),
    daemon=True
)
thread_stream.start()

# Main loop: receive streamed measurement data
while stop_queue.empty():
    try:
        data = data_queue.get(timeout=1)
        print(data)
        # --- Handle incoming data here ---
        # Process, log, visualize, or store the measurement values.
        # If it matters, make sure that all data is read from the 'data_queue' here.
        # To stop streaming, call:
        #     stop_queue.put(True)
        # This will end the loop and signal the thread to stop.
        # ---------------------------------
    except queue.Empty:
        pass

# Wait for the streaming thread to finish
thread_stream.join()
device.close_serial_interface()  # close serial connection

# After the thread has finished, check whether the device timed out
if not error_queue.empty():
    raise error_queue.get(timeout=1)

Fast data stream (read 12 values) - Not for all devices

import queue  # only for data stream
import threading  # only for data stream
from pigeon_transmission import DeviceH5

device = DeviceH5()
device.open_serial_interface(port="com2", baudrate=115200)  # open serial connection

data_queue, stop_queue, error_queue = queue.Queue(), queue.Queue(), queue.Queue()

# Start background thread for data stream
# Tip: You can also use Enums here
thread_stream = threading.Thread(
    target=device.start_fast_stream,
    args=("high flow", "differential pressure", "temperature",  # 12 values
          "mean pressure", "peep", "peak flow inspiration",
          "ambient pressure", "plateau pressure", "ipap",
          "current breath phase", "oxygen", "I:E Ratio",
          data_queue, stop_queue, error_queue, 5),
    daemon=True
)
thread_stream.start()

# Main loop: receive streamed measurement data
while stop_queue.empty():
    try:
        data = data_queue.get(timeout=1)
        print(data)
        # --- Handle incoming data here ---
        # Process, log, visualize, or store the measurement values.
        # If it matters, make sure that all data is read from the 'data_queue' here.
        # To stop streaming, call:
        #     stop_queue.put(True)
        # This will end the loop and signal the thread to stop.
        # ---------------------------------
    except queue.Empty:
        pass

# Wait for the streaming thread to finish
thread_stream.join()
device.close_serial_interface()  # close serial connection

# After the thread has finished, check whether the device timed out
if not error_queue.empty():
    raise error_queue.get(timeout=1)

Express data stream (read 12 values - 32 bit floating point) - Not for all devices

from pigeon_transmission import DeviceF2
import queue
import threading

device = DeviceF2()
device.open_serial_interface(port="com2", baudrate=230400)  # open serial connection

data_queue, stop_queue, error_queue = queue.Queue(), queue.Queue(), queue.Queue()

# Start background thread for data stream
# Tip: You can also use Enums here
thread_stream = threading.Thread(
    target=device.start_express_stream,
    args=("high flow", "pressure high flow absolute", "differential pressure",
          "temperature", "volume high flow", "volume high flow",
          "temperature", "volume high flow", "volume high flow",
          "humidity", "humidity", "humidity",
          data_queue, stop_queue, error_queue, 5),
    daemon=True
)
thread_stream.start()

# Main loop: receive streamed measurement data
while stop_queue.empty():
    try:
        data = data_queue.get(timeout=1)
        print(data)
        # --- Handle incoming data here ---
        # Process, log, visualize, or store the measurement values.
        # If it matters, make sure that all data is read from the 'data_queue' here
        # To stop streaming, call:
        #     stop_queue.put(True)
        # This will end the loop and signal the thread to stop.
        # ---------------------------------
    except queue.Empty:
        pass

# Wait for the streaming thread to finish
thread_stream.join()
device.close_serial_interface()  # close serial connection

# After the thread has finished, check whether the device timed out
if not error_queue.empty():
    raise error_queue.get(timeout=1)

Notes

  • Measurement of I:E ratio – Use Ti/Te if Ti > Te, otherwise Te/Ti

Metadata

Release files for pigeon-transmission 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pigeon-transmission 0.1.5
File Size Uploaded Provenance Actions
pigeon_transmission-0.1.5.tar.gz 160.4 kB Without provenance Details for pigeon_transmission-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pigeon-transmission 0.1.5
File Interpreter ABI Platform Actions
pigeon_transmission-0.1.5-py3-none-any.whl Python 3 none any Details for pigeon_transmission-0.1.5-py3-none-any.whl

Total release size: 286.3 kB

Release files / pigeon_transmission-0.1.5.tar.gz

Download URL pigeon_transmission-0.1.5.tar.gz
Size 160.4 kB
Tags Source
SHA-256 checksum
How to use checksums
799f533129b2dc6e14bf7ce3a8617eab262011e6710f1ee4a415b406dead10cb
BLAKE2b-256 checksum
How to use checksums
7e7b74255ec8c9d157a0471cacff9efc848b0e68b12fd1a26f6387087e22db78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pigeon_transmission-0.1.5-py3-none-any.whl

Download URL pigeon_transmission-0.1.5-py3-none-any.whl
Size 125.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f1671640a3bc3f4eb6ec186aaa93b7e68e3af7b13c9e9b27c95d088dc1ad523
BLAKE2b-256 checksum
How to use checksums
410ff11dd2baf31e7d20fe8041f7838b9ba3f3e4c7e01c110c7800ea4d361aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for pigeon-transmission 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page