Python library for interfacing with the RadiaCode-10x radiation detectors and spectrometers. Control your device, collect measurements, and analyze radiation data with ease.
- 📊 Real-time radiation measurements
- 📈 Spectrum acquisition and analysis
- 🔌 USB and Bluetooth connectivity
- 🌐 Web interface example included
- 📱 Device configuration management
Interactive web interface example (backend | frontend):
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.webserverBasic terminal output example (same options as web interface):
$ python3 -m radiacode.examples.basicpip install --upgrade radiacodefromradiacodeimportRadiaCode, RealTimeData# Connect to the device over USB and release it when finishedwithRadiaCode() asdevice:
# Get current radiation measurementsdata=device.data_buf()
forrecordindata:
ifisinstance(record, RealTimeData):
print(f"Dose rate: {record.dose_rate}")
# Get spectrum dataspectrum=device.spectrum()
print(f"Live time: {spectrum.duration.total_seconds()}s")
print(f"Total counts: {sum(spectrum.counts)}")
# Configure devicedevice.set_display_brightness(5) # 0-9 brightness leveldevice.set_language('en') # 'en' or 'ru'# Bluetooth connection (use the device's CoreBluetooth UUID on macOS)device=RadiaCode(bluetooth_mac="52:43:01:02:03:04")
# Connect to specific USB devicedevice=RadiaCode(serial_number="YOUR_SERIAL_NUMBER")
# Energy calibrationcoefficients=device.energy_calib()
print(f"Calibration coefficients: {coefficients}")
# Reset accumulated datadevice.dose_reset()
device.spectrum_reset()
# Configure device behaviordevice.set_sound_on(True)
device.set_vibro_on(True)
device.set_display_off_time(30) # Auto-off after 30 secondsThe 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 serveInstall prerequisites:
# Install uv curl -LsSf https://astral.sh/uv/install.sh | sh
Clone
git clone https://github.com/cdump/radiacode.git cd radiacodeRun examples:
uv run python -m radiacode.examples.basic
- ✅ USB connectivity supported via libusb
- ✅ Bluetooth connectivity supported via Bleak (use the device's CoreBluetooth UUID)
- 📝 Required:
brew install libusb
- ✅ Both USB and Bluetooth fully supported
- 📝 Required:
libusband BlueZ - 🔑 May need udev rules for USB access without root
- ✅ USB connectivity supported
- ✅ Bluetooth connectivity supported via Bleak
- 📝 Required: USB drivers
This project is licensed under the MIT License - see the LICENSE file for details
