mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Updating file extension for Excel files when exporting MGXS data (#2852)
This commit is contained in:
parent
187160d082
commit
0785500bc4
4 changed files with 12 additions and 8 deletions
|
|
@ -743,9 +743,9 @@ class MDGXS(MGXS):
|
|||
df.to_csv(filename + '.csv', index=False)
|
||||
elif format == 'excel':
|
||||
if self.domain_type == 'mesh':
|
||||
df.to_excel(filename + '.xls')
|
||||
df.to_excel(filename + '.xlsx')
|
||||
else:
|
||||
df.to_excel(filename + '.xls', index=False)
|
||||
df.to_excel(filename + '.xlsx', index=False)
|
||||
elif format == 'pickle':
|
||||
df.to_pickle(filename + '.pkl')
|
||||
elif format == 'latex':
|
||||
|
|
|
|||
|
|
@ -2001,9 +2001,9 @@ class MGXS:
|
|||
df.to_csv(filename + '.csv', index=False)
|
||||
elif format == 'excel':
|
||||
if self.domain_type == 'mesh':
|
||||
df.to_excel(filename + '.xls')
|
||||
df.to_excel(filename + '.xlsx')
|
||||
else:
|
||||
df.to_excel(filename + '.xls', index=False)
|
||||
df.to_excel(filename + '.xlsx', index=False)
|
||||
elif format == 'pickle':
|
||||
df.to_pickle(filename + '.pkl')
|
||||
elif format == 'latex':
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -71,7 +71,7 @@ kwargs = {
|
|||
'depletion-mpi': ['mpi4py'],
|
||||
'docs': ['sphinx', 'sphinxcontrib-katex', 'sphinx-numfig', 'jupyter',
|
||||
'sphinxcontrib-svg2pdfconverter', 'sphinx-rtd-theme'],
|
||||
'test': ['pytest', 'pytest-cov', 'colorama'],
|
||||
'test': ['pytest', 'pytest-cov', 'colorama', 'openpyxl'],
|
||||
'vtk': ['vtk'],
|
||||
},
|
||||
# Cython is used to add resonance reconstruction and fast float_endf
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
# Export the MGXS Library to an HDF5 file
|
||||
self.mgxs_lib.build_hdf5_store(directory='.')
|
||||
|
||||
# Test export of the MGXS Library to an Excel spreadsheet
|
||||
for mgxs in self.mgxs_lib.all_mgxs.values():
|
||||
for xs in mgxs.values():
|
||||
xs.export_xs_data('mgxs', xs_type='macro', format='excel')
|
||||
|
||||
# Open the MGXS HDF5 file
|
||||
with h5py.File('mgxs.h5', 'r') as f:
|
||||
|
||||
|
|
@ -76,9 +81,8 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = 'mgxs.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
files = ['mgxs.h5', 'mgxs.xlsx']
|
||||
(os.remove(f) for f in files if os.path.exists(f))
|
||||
|
||||
|
||||
def test_mgxs_library_hdf5():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue