Skip to main content

Library for RadiaCode-101

Project description

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 (Linux only, replace with your device's address)
$ 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 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 (Linux only)
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 without root

Windows

  • ✅ USB connectivity supported
  • ❌ Bluetooth is not supported (bluepy limitation)
  • 📝 Required: USB drivers

License

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

Project 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.3.5.tar.gz (22.9 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.3.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: radiacode-0.3.5.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for radiacode-0.3.5.tar.gz
Algorithm Hash digest
SHA256 4a2165b282656517a13ef82a207621d57d7729065758ddcb4c5dd368bb045fb6
MD5 595edd2dc0e38c84836a150edb0a3607
BLAKE2b-256 254ccf2d7059ee17b4c2f43b5e89601a2c1e46d13ff4022bf17d945b408bb475

See more details on using hashes here.

File details

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

File metadata

  • Download URL: radiacode-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for radiacode-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fc237a9dfd3ebe0c7df03e2fe62866fee2e5a0c9e59a6414a7d52f8bd3a93425
MD5 48b861dd75f4d4e485c47aa905f9a39e
BLAKE2b-256 2e665053b48f9f195a823bb809bf6c2e615d385879e8e4a038c13d5b4dc03b8f

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