Skip to main content

RadiaCode Python Library

PyPI version Python 3.9+ Documentation 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 (use the device's MAC address, or its CoreBluetooth UUID on macOS)
$ python3 -m radiacode.examples.webserver --bluetooth-mac 52:43:01:02:03:04

# Via USB connection (Linux/macOS/Windows)
$ 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 the device over USB and release it when finished
with RadiaCode() as device:
    # 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.total_seconds()}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 (use the device's CoreBluetooth UUID on macOS)
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

📚 Documentation

The documentation site contains setup guides, measurement and unit notes, spectrum examples, device configuration, and an API reference generated from the source docstrings and type annotations.

Build it locally with:

uv sync --group docs
uv run --no-sync mkdocs serve

🔧 Development Setup

  1. Install prerequisites:

    # Install uv
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Clone

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

    uv run python -m radiacode.examples.basic
    

⚠️ Platform-Specific Notes

macOS

  • ✅ USB connectivity supported via libusb
  • ✅ Bluetooth connectivity supported via Bleak (use the device's CoreBluetooth UUID)
  • 📝 Required: brew install libusb

Linux

  • ✅ Both USB and Bluetooth fully supported
  • 📝 Required: libusb and BlueZ
  • 🔑 May need udev rules for USB access without root

Windows

  • ✅ USB connectivity supported
  • ✅ Bluetooth connectivity supported via Bleak
  • 📝 Required: USB drivers

License

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

Download files

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

Source Distribution

radiacode-0.4.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

radiacode-0.4.0-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file radiacode-0.4.0.tar.gz.

File metadata

  • Download URL: radiacode-0.4.0.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for radiacode-0.4.0.tar.gz
Algorithm Hash digest
SHA256 40b7e1b15fbbb63cd2847c70a4c2d164fd17e319fffcd90972e41306465e78b8
MD5 5843155357e5a73687a1bd9046c14b49
BLAKE2b-256 4bb7e58a38c57887d73b2ae80acf99fe1f59a6927ba11f8f1d9ea8b118e81743

See more details on using hashes here.

File details

Details for the file radiacode-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: radiacode-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for radiacode-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56840a02b2537c509e38629cba55f96e3e1bffc174b2c91a02e63aac9a5e7ead
MD5 6912ac43ee5497e85b85eab0e26fc140
BLAKE2b-256 a3dd4f47d95d2e41cb2d2957035e3684a5a053f7be083a6c00598047e56ef589

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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