silx-kit / pyFAI

Fast Azimuthal Integration in Python
Other
105 stars 95 forks source link

Detector info is not restored when loading `pyFAI-diffmap` configuration #1991

Closed kif closed 11 months ago

kif commented 11 months ago

pyFAI-diffmap stores a configuration in the output HDF5 file but this configuration cannot be used to restore the geometry (the detector definition is missing:

{'unit': 'q_nm^-1',
 'dist': 0.1999693237019301,
 'poni1': 0.12279243634743776,
 'poni2': 0.11803581502718556,
 'rot1': 0.013977781483742164,
 'rot3': -7.470130596383977e-05,
 'rot2': -0.013837145398466972,
 'pixel1': 7.5e-05,
 'pixel2': 7.5e-05,
 'splineFile': None,
 'wavelength': 3.7380000000000004e-11,
 'nbpt_azim': 1,
 'nbpt_rad': 5000,
 'polarization_factor': 0.99,
 'dummy': None,
 'delta_dummy': None,
 'correct_solid_angle': True,
 'dark_current_image': None,
 'flat_field_image': None,
 'mask_image': 'DAC-04-mask.npy',
 'error_model': 'poisson',
 'shape': [3262, 3108],
 'method': [1, 'full', 'csr', 'opencl', 'gpu'],
 'do_azimuth_range': False,
 'do_radial_range': False}
kif commented 11 months ago

Two axis of work for correcting this bug:

loichuder commented 11 months ago
* [ ]  rebuild (approximately) the detector when not present but `shape`, `pixel1` and `pixel2` are present. To be done in `pyFAI.io.ponifile.PoniFile`

Isn't that already done in https://github.com/silx-kit/pyFAI/blob/1099ef5d75c7f2d8002a2d742e8ee4ff9d5da5ed/src/pyFAI/io/ponifile.py#L105 for version 1 of PONIs ?

I think the problem is rather that calling pop_ponifile of the ConfigurationReader (as it is done here when doing pyFAI.load) forces the PONI version to 2 (https://github.com/silx-kit/pyFAI/blob/1099ef5d75c7f2d8002a2d742e8ee4ff9d5da5ed/src/pyFAI/io/integration_config.py#L193) so that the rebuild of the detector I linked above is not done.

kif commented 11 months ago

One should not mix the version which is built by the worker and the poni_version...

kif commented 11 months ago

well, you can deserialize to a worker and extract the ai from it. This works with the PR ongoing.