Measurements and units
Buffered records
RadiaCode.data_buf() decodes the device's mixed record stream into dataclasses:
| Record | Purpose |
|---|---|
RealTimeData |
Current count rate and dose rate, with percentage errors |
RawData |
Unfiltered count-rate and dose-rate values |
DoseRateDB |
Historical dose-rate database sample |
RareData |
Accumulated dose, temperature, battery charge, and duration |
Event |
Device event and its event-specific parameter |
All dt fields are datetime.datetime values derived from the connection's
base time and the timestamp offset supplied by the device.
import time
from radiacode import RadiaCode, RealTimeData
with RadiaCode() as device:
while True:
for record in device.data_buf():
if isinstance(record, RealTimeData):
print(record.dt.isoformat(), record.count_rate, record.dose_rate)
time.sleep(2)
Units
count_rateis counts per second.count_rate_erranddose_rate_errare percentages.temperatureis degrees Celsius.charge_levelis a percentage.durationinRareDatais seconds.- Spectrum energy values calculated from the calibration coefficients are keV.
dose_rate and accumulated dose are returned in the device protocol's
scaled values; data_buf() does not normalize them to a display unit. Keep the
raw value when storing data and apply an explicit, device-configuration-aware
conversion at the application boundary.
Alarm limits are different: get_alarm_limits() reports their unit in
AlarmLimits.dose_unit ("Sv" or "R") and their count-rate unit in
AlarmLimits.count_unit ("cps" or "cpm"). Dose and dose-rate alarm values
are expressed in micro-units.
Warning
Do not infer dose units only from the Python numeric type. The device can be configured for Sievert or Roentgen display units, and the underlying protocol uses its own scaling.
Events
The Event.event field is an EventId. Compare enum members rather than their
numeric protocol values: