sandialabs / SpecUtils

A library for opening, manipulating, and exporting gamma spectral files
GNU Lesser General Public License v2.1
27 stars 9 forks source link

Add radiacode #15

Closed ckuethe closed 1 year ago

ckuethe commented 1 year ago

Add support for RadiaCode-10x PSRDs

This diff, heavily inspired by the ARAM and MicroRaider drivers, adds support for RadiaCode-102 PSRDs - actually the XML data file as produced by their Android app v1.42.00, as these devices do not natively emit log files. This probably works with the previous generation RadiaCode-101 devices and XML output from their iOS and Windows apps too, but isn't tested.

There are some attributes I'm not sure about, eg. scintillator volume and dead time; I've contacted the manufacturer for more information and have yet to hear back. Since I can't say for sure what the live time is compared to the real time, the live time is unset and only the real time is reported.

A sample XML file containing both foreground and background spectra is at https://gist.github.com/ckuethe/0673bc9028a200c6e6ae31f570ae4142

This diff has been tested with convert_to_n42 and a patched version of cambio

ckuethe@thorium:build$ ./SpecUtils/examples/convert_to_n42 /tmp/MysterySpectrum.xml out.n42
Trying to autodetect /tmp/MysterySpectrum.xml
'/tmp/MysterySpectrum.xml' is a valid spectrum file with 2 spectrum records (composed of2 time records of 1 detectors).
The sum real time of the measurements is 38932 seconds, with live time 0 seconds.
The first record has 1024 gamma channels.
Wrote 'out.n42'

InterSpec-linux-x64_v1.0.11 is able to load the resulting N42 file.

wcjohns commented 1 year ago

Wow - this is really great Chris - thank you for adding support for this file format!

I'm impressed you found all the disparate places in the code required to fully add the format. The example file is also really helpful to add to the regression and fuzz testing.

Before accepting this pull request, there are a few things I need to do (regression testing, fuzz testing, and something else I will email you about), and I am a little busy for the next few weeks, but I'lll try to carve out some time, but it may be a little while - I'm sorry in advance for this.

Again thank you for this, it looks great. -will

ckuethe commented 1 year ago

You're welcome. Happy to receive feedback and make whatever changes might be necessary to be able to merge this diff. :)

wcjohns commented 1 year ago

Thank you again for this Chris! I'll make a few very minor followup changes, and add supporting "spectrogram" data to my TODO list.

ckuethe commented 1 year ago

Thanks!