Reading StatePoint file using python shows ntaxError: Invalid character 'e' in expression ERROR.

I am trying to access a statepoint file and using python and extracting the data to excel file. Below is the code. I am getting an error. the error is also shown below. SyntaxError: Invalid character ‘e’ in expression. Can anyone help me solve the issue? Thanks.

import openmc

sp1 = openmc.StatePoint(‘statepoint.100.h5’)

tally1 = sp1.tallies[1]
tally2 = sp1.tallies[2]
tally3 = sp1.tallies[3]
flux1 = tally1.mean.ravel()
flux2 = tally2.mean.ravel()
flux3 = tally3.mean.ravel()
import pandas as pd
df1 = pd.DataFrame (flux1)
df2 = pd.DataFrame (flux2)
df3 = pd.DataFrame (flux3)
filepath1 = ‘1.xlsx’
filepath2 = ‘2.xlsx’
filepath3 = ‘3.xlsx’
df1.to_excel(filepath1, index=False)
df2.to_excel(filepath2, index=False)
df3.to_excel(filepath3, index=False)

Traceback (most recent call last):

File “”, line 1, in

File “/opt/anaconda3/lib/python3.7/site-packages/openmc/statepoint.py”, line 141, in init

su = openmc.Summary(path_summary)

File “/opt/anaconda3/lib/python3.7/site-packages/openmc/summary.py”, line 60, in init

self._read_geometry()

File “/opt/anaconda3/lib/python3.7/site-packages/openmc/summary.py”, line 107, in _read_geometry

cell_fills = self._read_cells()

File “/opt/anaconda3/lib/python3.7/site-packages/openmc/summary.py”, line 168, in _read_cells

cell.region = Region.from_expression(region, self._fast_surfaces)

File “/opt/anaconda3/lib/python3.7/site-packages/openmc/region.py”, line 125, in from_expression

.format(expression[i]))

SyntaxError: Invalid character ‘e’ in expression

Hello, Anyone tried accessing the statepoint file using Python 3.7.6 and Openmc 0.11.0? This line sp=openmc.StatePoint(‘statepoint.60.h5’) is having the problem, SyntaxError: Invalid character ‘e’ in expression

Please let me know if anyone solved it. Thanks.

Hi Sharif,

It appears that the behavior you’re encountering is due to a bug in OpenMC. Until we get it fixed, the way you can get around this for now is to ensure that no surfaces in your geometry have IDs greater than 999,999.

Best,
Paul