Open henrikjacobsenfys opened 7 months ago
I can advise on these numbers for refnx if required (issue seems to be about refl1d though). The point-wise resolution smearing of refnx uses a highly optimised gaussian quadrature. The abscissa are at Gauss Legendre points, not linearly spaced. The current default in refnx is to use an oversampling of 17, not 21. You need to choose that oversampling number depending on how thick your films are. For thicker films that number might need to be higher. W.r.t the +/- 3.5 that's to ensure the entirety of the gaussian is probed. It may be possible to bring that in slightly, but the main thing in calculation speed is the oversampling factor.
I've spent a lot of time looking into all aspects of resolution smearing, including a lot of benchmarking. e.g. https://gist.github.com/andyfaff/6abc5ca58796f4e74cad213028b76e96 https://gist.github.com/andyfaff/d71531e4e8c9549a3049621c32697d7a https://gist.github.com/andyfaff/03cc009e987c10178ec7174aedaca278 https://gist.github.com/andyfaff/056d516c1eb101e6951cf657152e3475
As part of the resolution calculations, EasyReflectometry/calculators/refl1d/wrapper.py, the following is calculated
The numbers 3.5 and 21 seem arbitrary. We should look into if these are the optimal values.
The
21 * len(q_array)
indicates that the resolution calculation will assume thatcalc_Qo
consists of many close-lying points (perhaps the calculation relies on Fast Fourier Transforms?). This is probably always the case in the typical use case whenq_array
is a set of data points, but might not be true in general, e.g. if a model value is calculated only at a few points.We should check if the calculation is consistent if
q_array
is, say, only a few points in a wide q-range vs. hundreds of points in the same q-range. If it is not consistent, we should implement a check to make sure the results of the calculation are reliable, and warn the user if they are not.Furthermore, if the calculations are time-consuming, the numbers 3.5 and 21 can possibly be tweaked to optimize performance.