-
Notifications
You must be signed in to change notification settings - Fork 97
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 d space unit in A #1970
Added d space unit in A #1970
Conversation
It is an equation of how to convert q-values to d-spacing. |
Yes, i think it is |
Reworked as requested to have ascale 1 with q in meter. Notice that unit scale for Then i am kind of confuse
|
I will add a quick test that validates equation (implemented in |
The extra test in #1971 fails on this unit...
|
I can submit you a patch ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pyFAI/units.py
Outdated
@@ -193,6 +193,7 @@ def eq_q(x, y, z, wavelength): | |||
formula_2th = "arctan2(sqrt(x * x + y * y), z)" | |||
formula_chi = "arctan2(y, x)" | |||
formula_q = "4.0e-9*π/λ*sin(arctan2(sqrt(x * x + y * y), z)/2.0)" | |||
formula_d = "λ*sin(arctan2(sqrt(x * x + y * y), z)/2.0)/2.0e-9" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a big difference between d* and d, the former is in reciprocal space, the later in real space. As a consequence d* ~ 1/d. This, this formula is wrong while the equation of d_A
looks OK.
@@ -50,6 +50,10 @@ def testFrom2ThRad__Q_A(self): | |||
result = unitutils.from2ThRad(0.1, units.Q_A, wavelength=1.03321e-10) | |||
self.assertAlmostEqual(result, 0.6078, places=3) | |||
|
|||
def testFrom2ThRad__RecD_A(self): | |||
result = unitutils.from2ThRad(0.1, units.RecD_A, wavelength=1.03321e-10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/RecD_A/D_A/ see comment in units.py
pyFAI/units.py
Outdated
@@ -390,6 +415,7 @@ def to_unit(obj, type_=None): | |||
TTH_DEG = TTH = RADIAL_UNITS["2th_deg"] | |||
R = R_MM = RADIAL_UNITS["r_mm"] | |||
R_M = RADIAL_UNITS["r_m"] | |||
RecD_A = RADIAL_UNITS["d_A"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be D_A
since the unit is in real space, not in Recreciprocal space. Would be nice to declare D_NM
and D_M
as well.
Feedback from ID06.
They expect to use this unit.
I am not quite sure on the description of the formula, but for sure the way to compute it is fine.
For now i compute it in a dedicated notebook at ID06, but i will probably have to display it in Flint too, so i think it is better to share it at the same place, if possible.