Closed mjdiff closed 1 month ago
We can fix the whole compatibility between GrazingIncidence and MultiGeometry in a single PR.
MultiGeometry does not accept a tuple as unit
parameter, and its own integrate2d
method does not accept unit at all, so for the moment, we are fixing manually the unit, and also the radial and azimuthal range, like this:
qip = get_unit_fiber(name='qip_nm^-1', sample_orientation=3)
qoop = get_unit_fiber(name='qoop_nm^-1', sample_orientation=3)
mg = MultiGeometry(ais=[ai])
mg.unit = (qip, qoop)
mg.radial_range = None
mg.azimuth_range = None
res2d_mg = mg.integrate2d(lst_data=[data], npt_rad=1000, npt_azim=1000, method=('no', 'csr', 'cython'))
mg = MultiGeometry(ais=[ai])
But this approach is not correct, because the unit
of the result of this integration is:
res2d_mg.unit
((qip_nm^-1, qoop_nm^-1), chi_deg)
So for example, jupyter.plot2d
is going to crash when it's about the set the labels in the plot:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[29], line 1
----> 1 plot2d(res2d_mg)
2 pass
File /cvmfs/hpc.esrf.fr/software/packages/ubuntu20.04/x86_64/scattering/2024.08.30/lib/python3.11/site-packages/pyFAI/gui/jupyter/_plot.py:164, in plot2d(result, calibrant, label, ax)
162 ax.set_title(label)
163 if isinstance(result.unit, (list, tuple)) and len(result.unit) == 2:
--> 164 ax.set_xlabel(result.unit[0].label)
165 ax.set_ylabel(result.unit[1].label)
166 else:
AttributeError: 'tuple' object has no attribute 'label'
finished