Skip to content

Control RadiaCode-10x radiation detectors via Python. Collect real-time measurements, analyze spectra, and manage device settings over USB or Bluetooth.

License

Notifications You must be signed in to change notification settings

cdump/radiacode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

faaa103 ยท Feb 10, 2025

History

69 Commits
Feb 9, 2025
Feb 10, 2025
Feb 9, 2025
Jun 5, 2021
Jun 5, 2021
Feb 9, 2025
Feb 9, 2025
Jun 5, 2021
Feb 9, 2025
Nov 13, 2023
Jun 12, 2021

Repository files navigation

RadiaCode Python Library

PyPI version Python 3.9+ License: MIT

Python library for interfacing with the RadiaCode-10x radiation detectors and spectrometers. Control your device, collect measurements, and analyze radiation data with ease.

๐Ÿš€ Features

  • ๐Ÿ“Š Real-time radiation measurements
  • ๐Ÿ“ˆ Spectrum acquisition and analysis
  • ๐Ÿ”Œ USB and Bluetooth connectivity
  • ๐ŸŒ Web interface example included
  • ๐Ÿ“ฑ Device configuration management

๐Ÿ“ธ Demo

Interactive web interface example (backend | frontend):

radiacode-webserver-example

๐ŸŽฎ Quick Start

Examples

pip install --upgrade 'radiacode[examples]'

Run the web interface shown in the screenshot above:

# Via Bluetooth (replace with your device's address)
$ python3 -m radiacode-examples.webserver --bluetooth-mac 52:43:01:02:03:04

# Via USB connection
$ sudo python3 -m radiacode-examples.webserver

Basic terminal output example (same options as web interface):

$ python3 -m radiacode-examples.basic

Library Usage Example

pip install --upgrade radiacode
from radiacode import RadiaCode, RealTimeData

# Connect to device (USB by default)
device = RadiaCode()

# Get current radiation measurements
data = device.data_buf()
for record in data:
    if isinstance(record, RealTimeData):
        print(f"Dose rate: {record.dose_rate}")

# Get spectrum data
spectrum = device.spectrum()
print(f"Live time: {spectrum.duration}s")
print(f"Total counts: {sum(spectrum.counts)}")

# Configure device
device.set_display_brightness(5)  # 0-9 brightness level
device.set_language('en')        # 'en' or 'ru'

More Features

# Bluetooth connection
device = RadiaCode(bluetooth_mac="52:43:01:02:03:04")

# Connect to specific USB device
device = RadiaCode(serial_number="YOUR_SERIAL_NUMBER")

# Energy calibration
coefficients = device.energy_calib()
print(f"Calibration coefficients: {coefficients}")

# Reset accumulated data
device.dose_reset()
device.spectrum_reset()

# Configure device behavior
device.set_sound_on(True)
device.set_vibro_on(True)
device.set_display_off_time(30)  # Auto-off after 30 seconds

๐Ÿ”ง Development Setup

  1. Install prerequisites:

    # Install Poetry
    curl -sSL https://install.python-poetry.org | python3 -
  2. Clone and setup:

    git clone https://github.com/cdump/radiacode.git
    cd radiacode
    poetry install
  3. Run examples:

    poetry run python radiacode-examples/basic.py

โš ๏ธ Platform-Specific Notes

MacOS

  • โœ… USB connectivity works out of the box
  • โŒ Bluetooth is not supported (bluepy limitation)
  • ๐Ÿ“ Required: brew install libusb

Linux

  • โœ… Both USB and Bluetooth fully supported
  • ๐Ÿ“ Required: libusb and Bluetooth libraries
  • ๐Ÿ”‘ May need udev rules for USB access

Windows

  • โœ… USB connectivity supported
  • โœ… Bluetooth supported
  • ๐Ÿ“ Required: USB drivers

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Control RadiaCode-10x radiation detectors via Python. Collect real-time measurements, analyze spectra, and manage device settings over USB or Bluetooth.

Topics

Resources

License

Stars

Watchers

Forks