The following error raises when trying to dump a McStas instrument with some parameters defined as pint.Quantity:
_pickle.PicklingError: Can't pickle <class 'pint.quantity.build_quantity_class.<locals>.Quantity'>: it's not found as pint.quantity.build_quantity_class.<locals>.Quantity
How to reproduce the issue:
git clone -b thales git@github.com:PaNOSC-ViNYL/instrument_database.git
git checkout 3f11a9f48e0247b514d16bc3ee7eb937a638d741
cd instrument_database/
pip install -e instrumentDataBaseAPI/
from instrumentdatabaseapi import instrumentdatabaseapi as API
repo = API.Repository(local_repo=".")
myinstrument = repo.load("ILL", "ThALES", "HEAD", "mcstas", dep=False)
import pint
ureg = pint.get_application_registry()
a2 = myinstrument.parameters["ThALES"]["a2"]
energy = 4.48
dE = 0.05
a2.energy = energy * ureg.meV
myinstrument.run()
myThALES = myinstrument.calculators["ThALES"]
myThALES.dump("/tmp/myThALES.py")
The following error raises when trying to dump a McStas instrument with some parameters defined as pint.Quantity:
How to reproduce the issue: