oasys-kit / ShadowOui

10 stars 8 forks source link

VLS PGM Coefficients - Confusing conventions #244

Open JoernSeltmann opened 1 month ago

JoernSeltmann commented 1 month ago

I had a look at the VLS coefficients from the output tab of the "VLS PGM Coefficients Calculator". For me these values were given:

b2: -7.415041188816103e-05 b3: 3.150721785002805e-09 b4: -1.6953900314388769e-13

shadow_coeff_0: 1200.0 shadow_coeff_1: 0.17796099 shadow_coeff_2: 1.134e-05 shadow_coeff_3: 0.0

For the Shadow coefficients the convention is given in "Shadow - Trace": page 8: Y-axis on surface away from source page 48: R(y) = a0 + a1y + a2y^2 + a3+y^3 (+ a4*y^4), with a0 being the ruling density at the origin.

When I try to use the bx coefficients though, I'm having problems using those in the Shadow coordinate system. I found this formula in a paper by Reininger (https://doi.org/10.1016/j.nima.2010.12.162):

R(y) = k0 (1 + 2b2y + 3b3y^2 + 4b4*y^3 + ...)

However with b2 and b4 being negative, this results in a mirrored image to the Shadow formula which gives increasing line densities along y, while the Reininger formula gives a decreasing result. Which could either be a result of me using the wrong formula or a different orientation of y-axis, I guess?!

Could you please give me a reference to the bx convention used here?

srio commented 1 month ago

Without looking at your particular numbers, I can give you some pointers:

The conversion code is in the source of the widget: https://github.com/oasys-kit/ShadowOui/blob/master/orangecontrib/shadow/widgets/preprocessor/vls_pgm_coefficients_calculator.py

It has always been different conventions for the definition of the coefficients. An interesting discussion is in https://github.com/srio/shadow3-docs/blob/master/doc/VLS_sign_conventions.pdf

Hope this helps.

best regards, Manuel

JoernSeltmann commented 1 month ago

In the source, the bx coefficients are calculated first and I thought those were developed with Mr Reininger since I read this issue post where his help was requested: https://github.com/oasys-kit/ShadowOui/issues/6

afterwards the Shadow coefficients are derived from them. My problem is that one convention (Shadow) seems to point to an increasing line density along the y-axis, while the other (bx) seems to give a decreasing line density on the same coordinate system. This is kind of mentioned in the "VLS_sign_conventions" document below formula (4):

...reversing signs of the odd power coefficients... is equivalent to ... turning it [the grating] around.

However the bx convention isn't given there and isn't used by Shadow as far as I know. It only appears in this ShadowOui widget.

srio commented 1 month ago

The VLS widget was created with the aim of helping in the definition of the coefficients that SHADOW needs. It is not coupled with SHADOW, it only calculates the SHADOW parameters. It used the formulas of R. Reininger. It demonstrated its utility. If you are not happy with it, you can always calculate the coefficients you need by hand. Indeed, you can always play with the signs to adjust to your geometry.

JoernSeltmann commented 1 month ago

I just found this confusing and was asking for the used convention. Thank you for clarification.