Write the gamma-ray spectrometry evaluation program of a radiation laboratory (activities, MDA and detection calls for ten nuclides from HPGe spectra, with the efficiency calibration built from source runs and certificates); it is run on further work orders of reference samples with known activities.
harbor run -t reactive-labs/gamma-spec-activityharbor download reactive-labs/gamma-spec-activityYou are Ragnhild Aasen, quality assurance lead at the Skarholm National Radiation Laboratory (SNRL). The Radiometry Section measures environmental samples on two HPGe systems, GE-3 and GE-5, under procedure RM-G-01. Today is Tuesday 8 September 2026. Henrik Solvang, head of the section, wrote this morning:
Finding NC-2026-07 from the internal audit (results under RM-G-01 calculated with an unvalidated script and by hand in SpectraDesk) has to be closed before the surveillance visit on 20 October. Since Jonas left in March nobody has owned the evaluation. Please write the evaluation as one program that takes a work order folder as the LIMS and SpectraDesk export it and writes the results file, to RM-G-01 rev 7 as it stands. Everything it needs to know about our two systems it has to bring along. Send me the results for the ten review work orders as well. Emil will run the program on the validation set before we release it.
In /app/inputs:
workorders/: the ten review work orders. Each folder holds workorder.csv (LIMS export) and one
SpectraDesk spectrum file (.spe, 8192 channels) per sample.calibration/: the efficiency runs with the section's mixed-radionuclide sources on both systems.backgrounds/: the empty-shield background spectra of both systems since November 2025.qc/: the weekly check-source spectra (QCS-2) of both systems since November 2025.library/: the nuclide library export used in SpectraDesk.docs/: RM-G-01 rev 7, validation report VR-G-014 rev 2, the logbook exports of both detectors, the
certificates folder for the calibration sources, and the mails from Henrik, Emil Thorsrud (Metrology) and
Liv Ottesen (laboratory engineer).legacy/: the script and efficiency file of the previous spectrometrist, and his handover note./app/output/gamma_analyze.py, run as
python3 /app/output/gamma_analyze.py <workorder_dir> <out.json>
It reads one work order folder in the format of the ten in hand and writes one JSON object:
{"workorder": "WO-26-0102",
"samples": {"26-01184": {"Cs-137": {"detected": true, "activity": 4.31, "mda": 0.52}, "...": {}}, "...": {}}}
| Key | Content |
|---|---|
workorder |
work order number from the export (not scored) |
samples |
object keyed by SampleID, one entry per sample of the work order |
samples[id][nuclide] |
one entry for each of the ten nuclides of RM-G-01 table 1, keyed as in its column "Reported as": Be-7, K-40, Mn-54, Co-60, I-131, Cs-134, Cs-137, Pb-210, Ra-228, Am-241 |
detected |
true or false, the reporting rule of RM-G-01 section 9.3 |
activity |
activity concentration at the reference time of the sample, in Bq per unit of the sample's report quantity (Bq/kg, Bq/L or Bq/m3); read only where detected is true |
mda |
minimum detectable activity of RM-G-01 section 9.2, in the same unit, for every nuclide |
The program runs with Python 3.12, numpy, scipy and pandas, on one CPU core with 3 GB of memory and no
network, and must finish a work order within 60 seconds. It is run as another user from a copy of
/app/output: it may load helper files that you put in /app/output (found relative to __file__), but
/app/inputs is not there when it runs.
/app/output/results/<work order>.json for each of the ten work orders in hand (for example
/app/output/results/WO-26-0102.json): the program's output for that work order.
Metrology runs your program on the validation set: 25 further work orders of reference samples with known activity concentrations, counted on the same two systems between November 2025 and the end of August 2026 and exported in the same way. They cover the matrices, containers, fill heights and counting conditions that RM-G-01 permits. In these samples a nuclide is either absent or present at more than twice the MDA of the count. The ten work orders in hand have reference values too, and your result files are compared in the same way.
For each sample two fractions are formed over the ten nuclides:
| Fraction | Definition |
|---|---|
| Activity | Weighted sum of the activity credits of the nuclides that are present, divided by the sum of their weights plus 1 for each nuclide you report as detected that is not present. A present nuclide that you report as not detected earns no credit. A sample with no nuclide present and none reported scores 1. |
| MDA | Mean MDA credit over the nuclides that are not present. |
An activity earns full credit within T of the reference value, where T is the larger of 4 % of the reference value and 4 standard uncertainties from counting statistics (RM-G-01 section 8, for that count); the credit falls linearly to zero at 1.5 T. Its weight is 4 % of the reference value divided by T, so precise results weigh 1 and results limited by counting statistics weigh less. A nuclide that is not present but reported as detected with an activity below 2.5 times the MDA that section 9.2 gives for that count is treated as reported not detected. An MDA earns full credit within 35 % of the value that section 9.2 gives for the continuum actually under the peak, falling linearly to zero at 70 %. Values that are missing, not numbers or not finite earn nothing.
Sample score = activity fraction x (0.70 + 0.30 x MDA fraction). A work order scores the mean of its samples; a sample missing from the output scores zero, and so does a work order on which the program fails, runs out of time or writes no readable JSON. The final score is 80 % the mean over the 25 validation work orders and 20 % the mean over the ten result files.