Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems in function integrate_radial #1978

Open
alvescassio opened this issue Oct 10, 2023 · 1 comment
Open

Problems in function integrate_radial #1978

alvescassio opened this issue Oct 10, 2023 · 1 comment

Comments

@alvescassio
Copy link

I'm motivated about pyfai, but I am a problem in the function integrate_radial, as shown below

q_I = self.poni.integrate_radial(self.img.data, radial_range= radial_range, npt=npt_azim, npt_rad=npt_rad, azimuth_range= azimuth_range, correctSolidAngle=True,mask=self.mask, dummy=None, delta_dummy=None, polarization_factor= None, dark=None, flat=None, unit='chi_deg', radial_unit=self.unit, normalization_factor=1.0,method="cython")

The problem is file azimuthalIntegrator.py in line: intensity = sum_signal / sum_normalization

output of error: azimuthalIntegrator.py:1672: RuntimeWarning: invalid value encountered in true_divide intensity = sum_signal / sum_normalization

This problem happens when I use radial_range with -9 to 9 degrees, using self.poni.setChiDiscAtPi();

When I use angles between 170 to 190 or 350 and 10, the problem appears.

Please, could you help me?

@kif
Copy link
Member

kif commented Oct 11, 2023

Hi Alves,

I guess self.poni is an instance of AzimuthalIntegrator, but I don't quite understand what you are willing to achieve.
The error message you obtain is linked to this division (by zero) which comes down to "no pixel contributed to at least one bin". The problem is why is this bin empty.

The radial range you wish is (-9°, +9°) but by default the radial unit is "q_nm^-1". To me, it makes little sense to have q<0 (same for 2θ).
Did you mean azimuth_range since you are referring to the position of the discontinuity ?

If you are willing to integrate several sectors in an image, I would recommand you to use integrate2d once and slice out the different region of interest. This will be much faster because integrate_radial will call anyway integrate2d each time.
Furthermore, changing the origin of the azimuthal angle will reset all arrays which take ~1s to be reinitialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants