oasys-kit / shadow3

Official repository for shadow3 (x-ray-tracer engine)
MIT License
31 stars 19 forks source link

Flat vs. uniform geometrical source #42

Closed SergeyRa closed 2 years ago

SergeyRa commented 4 years ago

It seems that "uniform" angular distribution for geometrical source is actually identical to "flat" one, and is not spherical as intended (see figure below). This is visible, however, only at very high angles, maybe not relevant for most calculations.

image

srio commented 4 years ago

The shadow documentation for the sources is here: http://ftp.esrf.eu/scisoft/shadow/documentation/shadow-source.pdf

Other original documents for shadow are here: https://github.com/srio/shadow3-docs

The shadow-source users guide says:

Flat Angle Distribution The source angle distribution dictates how the rays in momentum space will be generated... In Flat angle distribution, the rays have an equal probability of being assigned any angle within the user specified interval of horizontal and vertical half-divergences (in radians). This source will not illuminate uniformly a sphere centered on it, but rather a plane.

Uniform Distribution With a uniform distribution, the intensity of the source incident on a plane varies as the cosine of the angle of the ray with respect to the optical axis, following Lambert’s law. This means a uniform brightness source, where the flux flowing into a solid angle dW from an area dA is independent of the observation angle. In general, dN dq = cos q. For the case of an isotropic source, see the “Conical Source” case.

Conical Angle Distribution This distribution has the angles of the rays uniformly generated between a minimum and maximum absolute value. The minimum can be zero. The distribution of rays in the angle theta is uniform, i.e. a spherical surface will be uniformly illuminated by this source placed at its center. This is in contrast to the case of a uniform source.

Additional comment (srio) referring angles and directions: Note that columns 4,5,6 refer to the "direction" of the ray, or a unity vector pointing in the direction of the ray. They are usually noted x', y', z'. Usually in shadow we consider x' and z' as "angle in radiants" and many menus and plots also in Oasys use this convention. But this is only valid in the small angle approximation, where the beam is propagating close to the the Y axis direction. If we call Vx,Vy,Vz the columns 4,5,6 (unitary vector) and if we call x' the angle between the ray and the YZ plane, and similarly z' the angle between the ray and the YX plane, using the director cosines (https://en.wikipedia.org/wiki/Direction_cosine) we have: cos(a) = sin(x') = Vx cos(c) = sin(z') = Vz and under small angle approximation sin(x)~x x'=Vx z'=Vy

SergeyRa commented 4 years ago

Thanks! I just have not succeeded to find any differences between ray distribution produced by flat and uniform source (given the same seed and angular range are used) at any angular range, so the above question arose.