-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add radiacode #15
Add radiacode #15
Conversation
This diff, heavily inspired by ARAM and MicroRaider, 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 Tested with `convert_to_n42` and `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' ```
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. 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. |
@@ -4494,6 +4504,14 @@ bool SpecFile::load_file( const std::string &filename, | |||
}//if( orig_file_ending=="xml" ) | |||
|
|||
|
|||
if( orig_file_ending=="xml" || orig_file_ending=="rco") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RadiaCode exports as .xml
by default, '.rco' is my local convention to indicate that this XML file is radiacode data and not ... some other thing.
|
||
if( orig_file_ending.empty() ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add this to make autodetection work correctly. Without it, neither cambio nor convert_to_n42 were able to guess the file format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also take a look at this - in practice, filenames often get mangled, or given different extensions, by the time the user gets them, so I'll make sure the code will parse even without a filename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the least disruptive way I could think of to get autodetection to work. I just wanted you to be aware of this change so you didn't think it was an unintentional or malicious change.
Given the way autodetection appears intended to work, and the way the format libraries seem to be structured, that entire file ending business should be entirely unnecessary if the code is literally going to try every format until one returns success.
You're welcome. Happy to receive feedback and make whatever changes might be necessary to be able to merge this diff. :) |
Thank you again for this Chris! |
Thanks! |
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 ofcambio
InterSpec-linux-x64_v1.0.11
is able to load the resulting N42 file.