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

Added convertion from tthrad to RecD2_NM #1962

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

vallsv
Copy link
Collaborator

@vallsv vallsv commented Oct 2, 2023

Here is an update of the helper convertor to handle tth_rad to d^-2.

It's a rework of the info from pyFAI.units, but i would be happy to have a double check here.
Could you please check if the math is right?

BTW: I also have that code in Flint for now, to be sure it is working with previous pyFAI versions.

@vallsv vallsv self-assigned this Oct 2, 2023
@vallsv vallsv requested review from t20100 and kif and removed request for t20100 October 2, 2023 16:56
@kif
Copy link
Member

kif commented Oct 3, 2023

The math do look OK. Was this feature requested by MX beamlines ?

@kif
Copy link
Member

kif commented Oct 3, 2023

Just checking what's going wrong with RTD. Your PR is OK.

@vallsv
Copy link
Collaborator Author

vallsv commented Oct 3, 2023

Thanks for the check

The math do look OK. Was this feature requested by MX beamlines ?

ID15, to display the value in d^-2 in a tooltip

@vallsv
Copy link
Collaborator Author

vallsv commented Oct 3, 2023

In fact they prefer to display the stuff in d*2_A^-2, there is a registration unit for that, but there is no global named var.

Do you think it is fine if i add the following in the units module?

RecD2_A = RADIAL_UNITS["d*2_A^-2"]

@vallsv
Copy link
Collaborator Author

vallsv commented Oct 3, 2023

And the equation would be the same as?

        q_A = (4.e-10 * numpy.pi / wavelength) * numpy.sin(.5 * twoTheta)
        return (q_A / (2.0 * numpy.pi)) ** 2

@kif kif merged commit 4e3f6d7 into silx-kit:main Oct 3, 2023
8 checks passed
@kif
Copy link
Member

kif commented Oct 3, 2023

The scale factor differs by a factor 100 (i.e. 10²) that's all.

@kif
Copy link
Member

kif commented Oct 3, 2023

In this case I would rather do smth like this:

elif unit.space == "d*2":
    q_A = (4.e-9 * numpy.pi / wavelength) * numpy.sin(.5 * twoTheta)
    rec_d2_nm =  (q_A / (2.0 * numpy.pi)) ** 2
    return rec_d2_nm/unit.scale

@kif
Copy link
Member

kif commented Oct 3, 2023

The same could be done to simplify the handling of q, 2th and r, each time, just divide by the scale.

@vallsv vallsv mentioned this pull request Oct 4, 2023
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

Successfully merging this pull request may close these issues.

2 participants