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

Update units.py #2365

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/pyFAI/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2012-2018 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2012-2024 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Picca Frédéric-Emmanuel <[email protected]>
#
Expand Down Expand Up @@ -37,7 +37,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "15/02/2024"
__date__ = "24/12/2024"
__status__ = "production"
__docformat__ = 'restructuredtext'

Expand Down Expand Up @@ -653,15 +653,15 @@ def eq_q_total(x, y, z, wavelength, incident_angle=0.0, tilt_angle=0.0, sample_o
)

formula_r = "sqrt(x * x + y * y)"
formula_2th = "arctan2(sqrt(x * x + y * y), z)"
formula_2th = f"arctan2({formula_r}, z)"
formula_chi = "arctan2(y, x)"
formula_q = "4.0e-9*π/λ*sin(0.5*arctan2(sqrt(x * x + y * y), z))"
formula_d = "0.5*λ/sin(0.5*arctan2(sqrt(x * x + y * y), z))"
formula_d2 = "(2.0e-9/λ*sin(0.5*arctan2(sqrt(x * x + y * y), z)))**2"
formula_qx = "4.0e-9*π/λ*sin(arctan2(x, z)/2.0)"
formula_qy = "4.0e-9*π/λ*sin(arctan2(y, z)/2.0)"
formula_q = f"4.0e-9*π/λ*sin(0.5*{formula_2th})"
formula_d = f"0.5*λ/sin(0.5*{formula_2th})"
formula_d2 = f"(2.0e-9/λ*sin(0.5*{formula_2th}))**2"
formula_qx = f"4.0e-9*π/λ*sin(arctan2(x, z)/2.0)" # TODO: wrong, fix me
formula_qy = f"4.0e-9*π/λ*sin(arctan2(y, z)/2.0)" # TODO: wrong, fix me

formula_exit_angle = "arctan2(y,sqrt(z**2+x**2))"
formula_exit_angle = "arctan2(y, sqrt(z*z + x*x))"
formula_exit_angle_horz = "arctan2(x,z)"
formula_qbeam_lab = f"2.0e-9/λ*π*(cos({formula_exit_angle})*cos({formula_exit_angle_horz}) - 1)"
formula_qhorz_lab = f"2.0e-9/λ*π*cos({formula_exit_angle})*sin({formula_exit_angle_horz})"
Expand Down
Loading