Skip to main content

naneos particle solutions gmbh python backend

Project description

naneos-devices

GitHub Issues GitHub Pull Requests Ruff License

Projektlogo

This repository contains a collection of Python scripts and utilities for our naneos particle solutions measurement devices. These scripts will provide various functionalities related to data acquisition, analysis, and visualization for your measurement devices.

Installation

You can install the naneos-devices package using pip. Make sure you have Python 3.10 or higher installed. Open a terminal and run the following command:

pip install naneos-devices

Usage

To establish a serial connection with the Partector2 device and retrieve data, you can use the following code snippet as a starting point:

import time

from naneos.partector import Partector1, Partector2, Partector2Pro, scan_for_serial_partectors

PROD_NAMES = ["P1", "P2", "P2pro"]

# Lists all available Partector devices
partectors = scan_for_serial_partectors()
# print eg.: {'P1': {}, 'P2': {8112: '/dev/cu.usbmodemDOSEMet_1'}, 'P2pro': {}, 'P2proCS': {}}
print(partectors)

for prod in PROD_NAMES:
    if len(partectors[prod]) > 0:
        for k, v in partectors[prod].items():
            print(f"Found {prod} wit serial number {k} on port {v}")
            if prod == "P1":
                dev = Partector1(serial_number=k)
            elif prod == "P2":
                dev = Partector2(serial_number=k)
            elif prod == "P2pro":
                dev = Partector2Pro(serial_number=k)
            else:
                raise ValueError(f"Unknown product name: {prod}")

            df = dev.get_data_pandas()
            max_wait_time = time.time() + 15
            while df.empty and time.time() < max_wait_time:
                time.sleep(0.5)
                df = dev.get_data_pandas()

            print(df)
            dev.close()

Make sure to modify the code according to your specific requirements. Refer to the documentation and comments within the code for detailed explanations and usage instructions.

Documentation

The documentation for the naneos-devices package can be found in the package's documentation page.

Protobuf

Use this command to create a py and pyi file from the proto file

protoc -I=. --python_out=. --pyi_out=. ./protoV1.proto 

Testing

I recommend working with uv. Testing with the local python venv in vscode GUI or with:

pytest

Testing every supported python version:

nox -s tests

Building executables

Sometimes you want to build an executable for a customer with you custom script. The build must happen on the same OS as the target OS. For example if you want to build an executable for windows you need to build it on Windows.

pyinstaller demo/p1UploadTool.py  --console --noconfirm --clean --onefile

Ideas for future development

  • P2 BLE implementation that integrates into the implementation of the serial P2
  • P2 Bidirectional Implementation that allows to send commands to the P2
  • Automatically activate Bluetooth or ask when BLE is used

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please submit an issue on the issue tracker.

Please make sure to adhere to the coding style and conventions used in the repository and provide appropriate tests and documentation for your changes.

License

This repository is licensed under the MIT License.

Contact

For any questions, suggestions, or collaborations, please feel free to contact the project maintainer:

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

naneos_devices-1.0.61.tar.gz (104.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

naneos_devices-1.0.61-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file naneos_devices-1.0.61.tar.gz.

File metadata

  • Download URL: naneos_devices-1.0.61.tar.gz
  • Upload date:
  • Size: 104.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.16

File hashes

Hashes for naneos_devices-1.0.61.tar.gz
Algorithm Hash digest
SHA256 ec1c9d5cedd5ab0687bd3bf8d19ba2df94a27a838bf7af6ba4abe96849deef55
MD5 88dedb6eabceaef3fff695b1c20d66b3
BLAKE2b-256 5b71ae66811de6ffac767fa6f24bad88f3f7f9d87d45a0ff3b36ee6aa1dab317

See more details on using hashes here.

File details

Details for the file naneos_devices-1.0.61-py3-none-any.whl.

File metadata

File hashes

Hashes for naneos_devices-1.0.61-py3-none-any.whl
Algorithm Hash digest
SHA256 4526acf23eaa3dd4b642b5feb01eae3ff3151f7a95949c1da6cd99f78775cd2c
MD5 c3b04d3ea6bce5516905732b6bd0877e
BLAKE2b-256 2ac1e3e4da50978f272190dbf13804be9616fa5bad5c1414a93686288885f18a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page