tardis-sn / tardis

TARDIS - Temperature And Radiative Diffusion In Supernovae
https://tardis-sn.github.io/tardis
198 stars 403 forks source link

SDEC plot from saved TARDIS simulation #2526

Open achillefiore opened 6 months ago

achillefiore commented 6 months ago

Describe the bug I cannot produce a static SDECplot in matplotlib using a saved TARDIS simulation (I can it in runtime though).

To Reproduce once a TARDIS simulation 'sim' is saved in a hdf file doing: sim.to_hdf( "filename.hdf", overwrite=True ) hdf_plotter = SDECPlotter.from_hdf( "filename.hdf" ) hdf_plotter.generate_plot_mpl()

File "/Users/achillefiore/Library/Mobile Documents/com~apple~CloudDocs/2021bnw/spectra/NIR/sdec_plotter.py", line 6, in SDEC hdf_plotter = SDECPlotter.fromhdf( simulation ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/achillefiore/miniconda3/envs/tardis/lib/python3.11/site-packages/tardis/visualization/tools/sdecplot.py", line 482, in from_hdf "virtual": SDECData.from_hdf(hdffpath, "virtual"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/achillefiore/miniconda3/envs/tardis/lib/python3.11/site-packages/tardis/visualization/tools/sdecplot.py", line 263, in from_hdf hdf["/simulation/transport/scalars"].time_of_simulation, "s"

File "/Users/achillefiore/miniconda3/envs/tardis/lib/python3.11/site-packages/pandas/io/pytables.py", line 602, in getitem return self.get(key) ^^^^^^^^^^^^^ File "/Users/achillefiore/miniconda3/envs/tardis/lib/python3.11/site-packages/pandas/io/pytables.py", line 812, in get raise KeyError(f"No object named {key} in the file") KeyError: 'No object named /simulation/transport/scalars in the file'

DeerWhale commented 1 month ago

Thanks for spotting the issue, the "transport" module is currently under refactor along with other related modules, which changed the path of the stored scalars.