Skip to main content

Naneos gmbh python backend

Project description

naneos-devices (python-toolkit)

GitHub Actions GitHub Issues GitHub Pull Requests Poetry Nox Code style: Black Ruff Type checked with mypy License

Naneos Logo

This repository contains a collection of Python scripts and utilities for our naneos 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.9 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, scan_for_serial_partectors

# Lists all available Partector2 devices
x = scan_for_serial_partectors()

print(x)  # eg. {'P1': {}, 'P2': {8112: '/dev/cu.usbmodemDOSEMet_1'}, 'P2pro': {}, 'P2proCS': {}}

# Split dictionary into P1 and P2 devices
p1 = x["P1"]
p2 = x["P2"]
p2_pro = x["P2pro"]

if len(p1) > 0:
    print("Found Partector1 devices:")
    for k, v in p1.items():
        print(f"Serial number: {k}, Port: {v}")

    # Connect to the first device with sn
    p1_dev = Partector1(serial_number=next(iter(p1.keys())))
    # or with port
    # p1_dev = Partector1(port=next(iter(p1.values())))

    time.sleep(2)

    # Get the data as a pandas DataFrame
    data = p1_dev.get_data_pandas()
    print(data)

    p1_dev.close()

if len(p2) > 0:
    print("Found Partector2 devices:")
    for k, v in p2.items():
        print(f"Serial number: {k}, Port: {v}")

    # Connect to the first device with sn
    p2_dev = Partector2(serial_number=next(iter(p2.keys())))
    # or with port
    # p2_dev = Partector2(port=next(iter(p2.values())))

    time.sleep(2)

    # Get the data as a pandas DataFrame
    data = p2_dev.get_data_pandas()
    print(data)

    p2_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 

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.47.tar.gz (63.5 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.47-py3-none-any.whl (44.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for naneos_devices-1.0.47.tar.gz
Algorithm Hash digest
SHA256 9c8ebf32a72217692da1b3df91524dc6d99df8c0e7df82e203c00a978660410b
MD5 dd14c3c9352f86d38e4c8e7bed586239
BLAKE2b-256 175a8b2af9bd1e8f0eb3854edf97b4e00c2404ea319d9eb92f155d7cc115a581

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for naneos_devices-1.0.47-py3-none-any.whl
Algorithm Hash digest
SHA256 7774ae5a78c9a4a4b6348e592231b0350d7710ec0a7ff6dafc5ed4861b747b72
MD5 e38d7f043cfb27d29592b4f8775d14cc
BLAKE2b-256 32318a3094214da6872567f998dc45f25e2093c7e3cf202b4558acaffe22e083

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