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
Worker.set_json_config fails with the following exception when config contains a NexusDector:
In [1]: from pyFAI.worker import Worker
In [2]: w = Worker()
In [3]: w.set_json_config("pyfai.json")
In [4]: w.get_json_config()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 w.get_json_config()
File lib/python3.11/site-packages/pyFAI/worker.py:628, in Worker.get_json_config(self)
626 def get_json_config(self):
627 """return configuration as a JSON string"""
--> 628 return json.dumps(self.get_config(), indent=2)
...
File lib/python3.11/json/encoder.py:180, in JSONEncoder.default(self, o)
161 def default(self, o):
162 """Implement this method in a subclass such that it returns
163 a serializable object for ``o``, or calls the base implementation
164 (to raise a ``TypeError``).
(...)
178
179 """
--> 180 raise TypeError(f'Object of type {o.__class__.__name__} '
181 f'is not JSON serializable')
TypeError: Object of type int32 is not JSON serializable
This looks to be due to the detector's shape which is a tuple of numpy.int32 in this case.
BTW, the shape is saved by the worker but not by the GUI:
The configuration of this class is mainly done via a dictionary transmitted as a JSON string:
Here are the valid keys:
- "dist"
- "poni1"
- "poni2"
- "rot1"
- "rot3"
- "rot2"
- "pixel1"
- "pixel2"
- "splineFile"
- "wavelength"
- "poni" #path of the file
- "chi_discontinuity_at_0"
- "do_mask"
- "do_dark"
- "do_azimuthal_range"
- "do_flat"
- "do_2D"
- "azimuth_range_min"
- "azimuth_range_max"
- "polarization_factor"
- "nbpt_rad"
- "do_solid_angle"
- "do_radial_range"
- "error_model"
- "delta_dummy"
- "nbpt_azim"
- "flat_field"
- "radial_range_min"
- "dark_current"
- "do_polarization"
- "mask_file"
- "detector"
- "unit"
- "radial_range_max"
- "val_dummy"
- "do_dummy"
- "method"
So, should it be in the config?
Wouldn't that makes sense to have the definition of the config at a single place? e.g., a validator method and/or a TypedDict
The text was updated successfully, but these errors were encountered:
Worker.set_json_config
fails with the following exception when config contains aNexusDector
:This looks to be due to the detector's
shape
which is a tuple ofnumpy.int32
in this case.BTW, the
shape
is saved by the worker but not by the GUI:pyFAI/src/pyFAI/worker.py
Lines 590 to 624 in 3825037
pyFAI/src/pyFAI/gui/widgets/WorkerConfigurator.py
Lines 239 to 329 in 3825037
And it's not in the documented valid keys:
pyFAI/src/pyFAI/worker.py
Lines 39 to 78 in 3825037
So, should it be in the config?
Wouldn't that makes sense to have the definition of the config at a single place? e.g., a validator method and/or a TypedDict
The text was updated successfully, but these errors were encountered: