pyxem / diffsims

An open-source Python library providing utilities for simulating diffraction
https://diffsims.readthedocs.io
GNU General Public License v3.0
46 stars 26 forks source link

Question about whether it is possible to load a `diffsims.simulations.simulation2d.Simulation2D` object? #223

Open OverEthanol opened 1 month ago

OverEthanol commented 1 month ago

Hi,

I am currently trying to learn how to do spot pattern indexing using the kinematic diffraction from diffsims.

However, depending how finely I want to discretize the reduced fundamental orientation sector, the computation time for running

diffsims.generators.simulation_generator.SimulationGenerator().calculate_diffraction2d()

can take up a lot of memories and time (especially when the laptop is poor). Hence, I would like to run this simulation process on a cluster instead and then load the simulated results into the Jupyter notebook for indexing. Is such a thing possible to do? If so, how should I save the output object which seems to be

diffsims.simulations.simulation2d.Simulation2D

and how should I load it again?

pc494 commented 4 weeks ago

So the crudest way of doing this (although it should still work) is by using pickle. This is fairly well documented see e.g. this. I wouldn't recommend sending pickles around though, if you need to do that you might want to write your own save/load methods. If that's the route you take, we would be happy to review/support and then merge in such methods.