dkriegner / xrayutilities

xrayutilities - a package with useful scripts for X-ray diffraction physicists
http://xrayutilities.sourceforge.io
GNU General Public License v2.0
81 stars 29 forks source link

Clarification of `Experiment` parameters `ndir`, `idir` and `sampleor` #137

Closed codedump closed 1 year ago

codedump commented 2 years ago

Hello,

I have questions regarding the usage of the experiment description class.

I'm new to both xrayutilities and to X-ray data analysis, so I probably make a perfect combination of opinionated and clueless :-) I apologize in advance for that ¯\_(ツ)_/¯

I am trying to understand the parameters of xrayutilities.Experiment, respectively xrayutilities.HXRD. In particular I'm stuck at the exact meaning of idir (inplane direction), ndir (sample normal) and sampleor (sample "orientation").

I understand that idir is the direction of the X-ray beam relative to the sample, in a lab coordinate system (typically the Y axis in a SPEC-like setup).

But I don't understand the meaning of ndir and sampleor, in particular inhowfar they differ from one another. ndir is the "surface normal of [my] sample", and needs to be perpendicular to idir (at zero angles only, right?), but apparently it's sampleor that actually tells me where the surface of the sample is.

I'll try to describe our experimental setup, maybe this makes things clearer.

The experimental setup

Here is the experimental setup I'm trying to work with. I also apologize in advance for my ASCII art skills :-) Apparently it's a four-circle setup (angles Phi, Omega, Chi, 2-Theta), approximately like this:


Lab coordinate system and angles

          (Phi)
            x+   z- 
            |   /
            |  /
            | /                                      / /  detector
    y+______|/______y-  (Chi)                       (_)/
            /                                     . 
           /                                    .
          /                                   .
         z+                                 . reflected-beam
       (Omega)                            .
    (2-Theta)                           .
                                      .
                                    .
                           +------.-+
   incident-beam          /     .  /|
   -------------------------- .   / |
                        /        /  |
                       +--------+   +
                       |        |  /
                       |        | z'   sample
                       x'       |/
                       +-----y'-+

  A: Situation at all sample angles zero
     Detector angle 2-Theta non-zero

                                      / / detector
                                     (_)/
                                     .
                                    .
                                   . reflected-beam
                                  .
                                 .
                                .
                               .+ 
                             /. | \
  incident-beam            / .  |   \
  -----------------------/--    +     \ 
                       /      /  \      +
                      +     /      \    |
                      |   /          \  z'
                      | /              \+
                      +               /
                        \           y'
                          \       /
                            x'  /
                              +

 B: Situation at Omega > 0 (e.g. for a Theta-TwoTheta scan)

The sample and its coordinate system

Angle definitions of the sample; from outer circle to inner circle:

Detector rotation:

Thanks in advance for any hints.

Cheers

dkriegner commented 2 years ago

Hello,

I try to answer below. I think almost every first time user has similar questions. I hope my answers below will make things more clear. Note: I did not try to understand your particular geometry, but hope my general answers are sufficient for you to figure it out. If not please ask back.

On Thu, Jul 7, 2022 at 11:35 PM Florin Boariu @.***> wrote:

Hello,

I have questions regarding the usage of the experiment description class.

I'm new to both xrayutilities and to X-ray data analysis, so I probably make a perfect combination of opinionated and clueless :-) I apologize in advance for that ¯_(ツ)_/¯

I am trying to understand the parameters of xrayutilities.Experiment, respectively xrayutilities.HXRD. In particular I'm stuck at the exact meaning of idir (inplane direction), ndir (sample normal) and sampleor (sample "orientation").

I understand that idir is the direction of the X-ray beam relative to the sample, in a lab coordinate system (typically the Y axis in a SPEC-like setup https://www.certif.com/spec_manual/fourc_4_1.html).

I think here might be already one core misunderstanding. In order to orient a crystal in the laboratory coordinate system one needs to know 2 non-collinear (best orthogonal) crystal directions and their orientation in the laboratory coordinate system. So idir and ndir are actually crystal directions. I typically specify them as

hxrd = xu.HXRD(InP.Q(1, 1, -2), InP.Q(1, 1, 1))

https://xrayutilities.sourceforge.io/#hello-world (see line 40 in the code example)

But I don't understand the meaning of ndir and sampleor, in particular inhowfar they differ from one another. ndir is the "surface normal of [my] sample", and needs to be perpendicular to idir (at zero angles only, right?), but apparently it's sampleor that actually tells me where the surface of the sample is.

corresponding to idir and ndir (crystal coordinates) are the laboratory vectors specifying the primary beam direction r_i and sampleor r_i can be specified in QConversion https://xrayutilities.sourceforge.io/xrayutilities.html?highlight=qconversion#xrayutilities.experiment.QConversion r_i defaults to the y direction as is typically used in spec for the HXRD class.

and yes all these directions are laboratory directions (therefore need to be determined at zero goniometer angles).

-

Documentatino states: "sampleor='det' means the surface is in the plane spanned by the inner most detector rotation and perpendicular to the primary beam." Our detector rotates (only) around Z+, see below. If I understand this correctly, it's the X'Y'-face of my sample that would be designated as "the surface" in this case, right?

the "plane spanned by the inner most detector rotation" is actually the x-y plane for a detector rotation around z. So sampleor=det with r_i=y would therefore mean that ndir given above points along x (because it is assumed to be perpendicular to primary beam inside the detector rotation plane). Also note that the detector rotation plane is always only determined from the inner most rotation axis, so multiple or single detector rotation axis make no difference here.

-

So xrayutilities would calculate the actual "in action" orientation of my sample using the Phi rotation data?

the actual sample orientation is of course calculated using all sample angles.

-

Documentation states: "sampleor='sam' means [...] along the innermost stample circles rotation direction". Our sample rotates along Phi lastly; Phi rotates along the X' direction of the sample (which, when all angles are zero, coincides with X of the lab). Does this mean that I'd be selecting the Y'Z' plane as "the surface"?

If the innermost sample circle is phi which is along x then equivalent to above this would mean ndir points along x. For a standard Four circle geometry 'det', 'sam' are equivalent.

-

Why do I need to specify ndir at all, then? If all that's needed is a perpendicular direction, and it's ultimately not this parameter that determines the surface normal, surely one can be constructed? What difference does it make if I write, for instance, ndir=(1,0,0) or ndir=(0,0,1), or even ndir=(.5,0,.5), if the in-planedirection was along Y (i.e. (0,1,0)?

both idir and ndir are ultimately only needed if one needs to get from the HKL coordinates to angle or angle to Q/HKL in the crystal coordinate system. If you want to get HKL coordinates from the goniometer angles I hope you see that the different directions actually matter. Therefore ndir enters in HXRD.Q2Ang (with trans=True (default)) an Ang2HKL.

I already a long time plan to disentangle these settings a bit to make the user specify them only when needed but did not get to it yet. Essentially this issue #98

-

Is sampleor='x+' the same as sampleor='sam' here? Or would the former actually mean that the sample is always pointing "up" regardless of apparatus angles, and thus only be equivalent to 'sam' for zero angles?

yes thats the same here. The special value 'sam' and 'det' exist since its often useful to change the goniometer definition but the sample stays mounted in the same way on the goniometer.

— Reply to this email directly, view it on GitHub https://github.com/dkriegner/xrayutilities/issues/137, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKZJFJKQFKPO35C3CJJYCLVS5ETFANCNFSM5263PT4A . You are receiving this because you are subscribed to this thread.Message ID: @.***>