https://github.com/cdump/radiacode
Control RadiaCode-10x radiation detectors via Python. Collect real-time measurements, analyze spectra, and manage device settings over USB or Bluetooth.
https://github.com/cdump/radiacode
dosimeter radiacode radiascan radiation
Last synced: 22 days ago
JSON representation
Control RadiaCode-10x radiation detectors via Python. Collect real-time measurements, analyze spectra, and manage device settings over USB or Bluetooth.
- Host: GitHub
- URL: https://github.com/cdump/radiacode
- Owner: cdump
- License: mit
- Created: 2021-06-05T15:55:51.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-05-02T04:50:21.000Z (about 1 month ago)
- Last Synced: 2025-05-02T05:28:10.559Z (about 1 month ago)
- Topics: dosimeter, radiacode, radiascan, radiation
- Language: Python
- Homepage:
- Size: 534 KB
- Stars: 168
- Watchers: 15
- Forks: 23
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RadiaCode Python Library
[](https://pypi.org/project/radiacode)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)Python library for interfacing with the [RadiaCode-10x](https://www.radiacode.com/) 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](radiacode-examples/webserver.py) | [frontend](radiacode-examples/webserver.html)):

## 🎮 Quick Start
### Examples
```bash
pip install --upgrade 'radiacode[examples]'
```Run the web interface shown in the screenshot above:
```bash
# 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):
```bash
$ python3 -m radiacode-examples.basic
```### Library Usage Example
```bash
pip install --upgrade radiacode
```
```python
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
```python
# 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:
```bash
# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -
```2. Clone and setup:
```bash
git clone https://github.com/cdump/radiacode.git
cd radiacode
poetry install
```3. Run examples:
```bash
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](radiacode.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](LICENSE) file for details.