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

How to obtain incidence angle from source to OE #102

Closed NolannR closed 7 months ago

NolannR commented 2 years ago

Hi,

The microscope I try simulate has two mirrors, and I would like to obtain the angle of arrival from the source to the first mirror, and the angle of arrival from the first mirror to the second mirror. How can I do so ?

Ideally, if I can get all the (theta_1, theta_2) couples for each pixel on the detector, it'd be perfect.

Thank you in advance for your answer,

kklmn commented 2 years ago

Hi,

Each beam has arrays 'a', 'b' and 'c' that contain directional cosines per ray.

If you want to use the xrt's histogramming functions, you can visualize x' and z' as any of the plot axes (x, y or c) or you can visualize theta or even any function of beam arrays, see here. See the last picture of this example, where the color axis is x'.

If you want to analyze the ray directions yourself, make a scalar product of these abc vectors of a local beam with a local normal (otherwise of a global beam with a global normal). For an optical element the local normal is [0, 0, 1] and for a screen it is [0, -1, 0]. You can do this in your run_process() function.