You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is some how to save intermediate results? It is not posible to pickle the Structure class, which could be beneficial for long simulations. I have tried for example after the MJ_solar_cell_tutorial.py :
AttributeError Traceback (most recent call last)
in ()
1 with open('solcore_test.p', 'wb') as ffile:
2 #pickle()
----> 3 pickle.dump(my_solar_cell, ffile)
AttributeError: Can't pickle local object 'MaterialSystem.sopra_material..SpecificMaterial'
Another option is using dill, which typically is smarter, but I am afraid not in this case, fails with the same class. There is another way to solve this?
Thanks.
The text was updated successfully, but these errors were encountered:
Unfortunately, the material system cannot be pickled. This is a long lost battle that I’m afraid can only be solved by refactoring the material system altogether. As it is now, it is useful but pretty obscure, with classes inside classes and funciona made available outside, as well as information retrieve from disk on the fly, as needed. It works and it has been useful for many years, but certainly not that helpful when it comes to expand it, maintain it or simply, as you want, pickle the objects.
What is exactly the part that is preventing a material to be saved, I’m not sure. Here is a discussion where the creator of Dill gives some tips of what might be going wrong.
There is some how to save intermediate results? It is not posible to pickle the Structure class, which could be beneficial for long simulations. I have tried for example after the MJ_solar_cell_tutorial.py :
AttributeError Traceback (most recent call last)
in ()
1 with open('solcore_test.p', 'wb') as ffile:
2 #pickle()
----> 3 pickle.dump(my_solar_cell, ffile)
AttributeError: Can't pickle local object 'MaterialSystem.sopra_material..SpecificMaterial'
Another option is using dill, which typically is smarter, but I am afraid not in this case, fails with the same class. There is another way to solve this?
Thanks.
The text was updated successfully, but these errors were encountered: