Open jpbrodsky opened 2 years ago
Thanks for reporting this Jason.
This is an item that has been on my TODO list for quite a while - however, I hadn't been aware of impact to any one (e.g., all the other spectroscopy programs seem to read the files without issues), so it has been low priority; I'll bump it up in priority, but can't promise a date when it will be done by.
A few things worth noting are:
<DHS:InterSpec>
tag is InterSpec specific information, so can likely be safely removed using something like sed
or a regex (but sorry, I know this is a pain!), for example, the following seems to work:
import re
from lxml import etree
n42file = open( "temp.n42", "r");
n42_data = n42file.read()
n42file.close()
clean_n42_data = re.sub('<DHS[\d\D]+DHS:InterSpec>', '', n42_data )
root = etree.XML( clean_n42_data.encode('utf-8') )
thanks again, -will
Thanks, Will!
At this point, we're not planning on modifying our software to specifically support the output of InterSpec, but being able to read it alongside other N42s would be a nice bonus. SpecUtils may be a good solution for that, but for the reasons you mention it's a relatively large job to solve a somewhat small problem.
Best, Jason
Or just do something like that, before fix incoming.
//Add DHS namespace for Interspec compatibility
XmlDocument xmldoc = new XmlDocument();
XmlReaderSettings settings = new XmlReaderSettings { NameTable = new NameTable() };
XmlNamespaceManager xmlns = new XmlNamespaceManager(settings.NameTable);
xmlns.AddNamespace("DHS", "http://www.w3.org/2001/XMLSchema-instance");
XmlParserContext context = new XmlParserContext(null, xmlns, "", XmlSpace.Default);
//Add DHS namespace for Interspec compatibility
RadInstrumentData radInstrumentData = new RadInstrumentData();
using (XmlReader reader = XmlReader.Create(filename, settings, context))
Interspec v 1.0.10 rc2
I used the Interspec "Export" function to produce a N42 (2012) file. This file looks like this (with some sections removed):
`<?xml version="1.0" encoding="utf-8"?>