ochubar / SRW

Synchrotron Radiation Workshop
Other
86 stars 70 forks source link

Bug in function srwl_opt_setup_surf_height_2d() #15

Open SergioLordano opened 6 years ago

SergioLordano commented 6 years ago

Hello,

I believe there are two issues in the function that creates a 2D height error transmission object. I only would like to make sure I am using the correct matrix format. Thank you very much!

  1. In the documentation, it states that in variable _height_prof_data, the first column should be longitudinal points and first row transverse points. However, as the code is written, it seems to me that first row is for the longitudinal coordinates and first column to transverse coordinates, if longitudinal refers to the length of the mirror, which is the direction to be inclined to the incidence angle. In line 3379 of srwlib.py v0.14, it is possible to see that variable sizeLong is given by _height_prof_data[0], which is the first row: sizeLong = _height_prof_data[0][npData - 1] - _height_prof_data[0][1] Could you check if the documentation needs to be changed?

  2. In lines 3379 and 3388, variables sizeLong and sizeTr are incorrectly calculated, because the last element of first row is simply _height_prof_data[0][npData] instead of _height_prof_data[0][npData - 1]. In these lines, the last element index is different from 3382 (and 3391) because in the latter, the array _ar_arg_long does not include the extra column. The error is only significant if the number of points in length or width is small, though.

Thanks again, Sergio Lordano.