kklmn / xrt

Package xrt (XRayTracer) is a python software library for ray tracing and wave propagation in x-ray regime. It is primarily meant for modeling synchrotron sources, beamlines and beamline elements.
MIT License
83 stars 30 forks source link

Question on optical element angle convention #101

Open h4s4ny4v4s opened 2 years ago

h4s4ny4v4s commented 2 years ago

I have a question regarding the coordinates and angles. When we set the pitch angle of an optical element (see below for the small section of the code), we set the "physical" angle. However, does this take the "beam direction" into account or it is with respect to a global axis, typically y-axis?

BL1.oe01 = roes.OE( bl=DXS, name=r"xtal1", center=[r"auto", xtal1_h, r"auto"],

pitch=r"auto",

    pitch=bragg1,
    alpha=alpha1,
    material=xtalSi1,
    targetOpenCL=r"auto")

The reason I am asking is that, we wanted to simulate a "true" channel-cut monochromator with asymmetrical surface cuts, and got confused if we are doing the right thing. This is actually a very basic optics, two Si(111) reflections in a channel-cut arrangement. The first one has an asymmetric cut such that the beam makes a grazing angle at the entry. The second crystal has a "matching" asymmetry such that the beam size recovers back to original, i.e. the beam makes a grazing angle at the exit. Now, the question is whether we need any detuning of the angles. When we manually calculate the pitch angle and enter it manually as shown above (pitch=bragg1), we get near identical numbers as automatic calculations (pitch=r"auto"). However, we weren't sure if the lattice planes are parallel like in a "standard" channel-cut monochromator, or whether both approaches takes the nominal beam direction and calculates accordingly.

kklmn commented 2 years ago

Optical elements do not know about the beams, if this was the question.

The coordinate systems are defined here.

alpha is positive for the lattice vector looking towards positive local y.

kklmn commented 2 years ago

If in doubt about the normals, look at your beamline in xrtGlow, visualize the crystal surface in 'Navigation' tab and check 'Show local axes' in 'Scene' tab.