silx-kit / pyFAI

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

[calib2] Eiger image binning not working #2140

Closed kif closed 6 months ago

kif commented 6 months ago

This is an issue from the calib2 interface: when dealing with data from a Dectris Eiger2 9M which data have been binned 2x2 (I agree it makes no sense !)

While the Python interface deals with it properly:

import pyFAI
d=pyFAI.detector_factory("Eiger2_cdTe_9M")
d.shape ==> (3262, 3108)
d.guess_binning(img(1631, 1554))
d.shape ==> (1631, 1554)

The GUI considers the size of the image should remain (3262, 3108). Maybe it is the shape of the mask which is wrong:

intaillefer:/mnt/data/ID27/binning % pyFAI-calib2 eiger_0000.h5 
INFO:numexpr.utils:Note: NumExpr detected 12 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
INFO:numexpr.utils:NumExpr defaulting to 8 threads.
INFO:pyFAI.method_registry:Degrading method from Method(dim=1, split='pseudo', algo='histogram', impl='*', target=None) -> Method(dim=1, split='bbox', algo='histogram', impl='*', target=None)
WARNING:pyFAI.gui.model.ExperimentSettingsModel:<class 'ValueError'>: operands could not be broadcast together with shapes (3262,3108) (1631,1554) (3262,3108)  
Detector shape: (1631, 1554) and image shape: (1631, 1554)
WARNING:silx.gui.plot.MaskToolsWidget:Mask has not the same size as current image. Mask will be cropped or padded to fit image dimensions. (3262, 3108) != (1631, 1554)
^\^\Quit

Reported by ID27

kif commented 6 months ago

The mask is not properly binned:

In [1]: import pyFAI,fabio;img = fabio.open("eiger_0000.h5").data;d=pyFAI.detector_factory("Eiger2_CdTe_9M")

In [2]: d.guess_binning(img)
Out[2]: True

In [3]: d.shape
Out[3]: (1631, 1554)

In [4]: d.mask
Out[4]: 
array([[0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       ...,
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0],
       [0, 0, 0, ..., 0, 0, 0]], dtype=int8)

In [5]: d.mask.shape
Out[5]: (3262, 3108)