Skip to content

BUG Cannot parse from cross section data *_xs0.m with pspec suffix #536

@ArthurMuhulet

Description

@ArthurMuhulet

Summary of issue

I am getting ValueError: Unidentifiable entry when trying to load my *_xs0.m file, because serpentTools doesn't know what to do with entries suffixed by pspec. The code runs fine when I manually remove all entries suffixed by pspec. It seems it is a similar issue to pre-0.9.4 release, that should have been solved. In the following error you will see an element, i20080. This element only appear one time in my file, and it is followed by _pspec suffix. Furthermore, when manually removing the pspec, the file load albeit incompletely: "Seems either the file was cut off, or data incomplete.The incomplete XS is minnerFuel"

Code for reproducing the issue

import serpentTools as st
st.settings.rc["serpentVersion"] = "2.2.0"
xsreader = st.read(f"{folderXS}/XSTEST_xs0.m")

Actual outcome including console output and error traceback if applicable


KeyError Traceback (most recent call last)
Cell In[14], line 3
1 folderXS = "../XSTEST"
----> 3 xsreader = st.read(f"{folderXS}/XSTEST_xs0.m")

File c:\Users\admin\Documents\name\python.venv\Lib\site-packages\serpentTools\parsers_init_.py:154, in read(filePath, reader)
152 loader = reader
153 returnedFromLoader = loader(filePath)
--> 154 returnedFromLoader.read()
155 return returnedFromLoader

File c:\Users\admin\Documents\name\python.venv\Lib\site-packages\serpentTools\parsers\base.py:49, in BaseReader.read(self)
47 info("Reading {}".format(self.filePath))
48 self._precheck()
---> 49 self._read()
50 info(" - done")
51 self._postcheck()

File c:\Users\admin\Documents\name\python.venv\Lib\site-packages\serpentTools\parsers\xsplot.py:153, in XSPlotReader._read(self)
150 self.xsections[xsname].setData(chunk)
152 else:
--> 153 self._processMisc(lead, data)

File c:\Users\admin\Documents\name\python.venv\Lib\site-packages\serpentTools\parsers\xsplot.py:163, in XSPlotReader.processMisc(self, lead, data)
161 xsname = re.sub("
$", "", variable[:start])
162 cleaned = list(map(str.split, data))
--> 163 self.xsections[xsname].misc[key] = array(cleaned, dtype=float)
164 return
166 warnings.warn(
167 "Unidentifiable entry in {}: {}".format(self.filePath, lead)
168 )

KeyError: 'i20080'

Expected outcome

It should just load the file correctly?

Versions

Please provide the following:

  • Version from serpentTools.__version__ 0.11.0
  • Python version - python --version 3.12.10
  • IPython or Jupyter version if applicable 9.10.0 for IPython, 8.8.0 for jupyter_client

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions