-
Dear Meep developers and users, Is there any way of saving a meep simulation object (sim = mp.Simulation(…)) and near field box data into a file? I have already unsuccessfully tried using pickle to save the object. I would like to store them and use them latter to calculate the far fields whenever required. best wishes, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There is already a built-in feature for loading and saving the simulation state to an HDF5 file: https://meep.readthedocs.io/en/latest/Python_User_Interface/#load-and-dump-simulation-state. For some examples, see the unit tests: https://github.com/NanoComp/meep/blob/master/python/tests/test_dump_load.py. |
Beta Was this translation helpful? Give feedback.
-
(Pickle won't work because most of the simulation state is stored in C++ objects that Python knows nothing about.) |
Beta Was this translation helpful? Give feedback.
-
Many thanks, saving a dumping the simulation state is what I need. |
Beta Was this translation helpful? Give feedback.
There is already a built-in feature for loading and saving the simulation state to an HDF5 file: https://meep.readthedocs.io/en/latest/Python_User_Interface/#load-and-dump-simulation-state.
For some examples, see the unit tests: https://github.com/NanoComp/meep/blob/master/python/tests/test_dump_load.py.