Open sthiess opened 8 years ago
good comment
code in useful_code/wfrutils.py
nc always exists (is not empty), could be there any other exceptions? shape of nc?
def calculate_peak_pos(mwf):
# irradiance
irr = mwf.get_intensity(slice_number=0, polarization='horizontal')
irr_max = numpy.max(irr)
[nx, ny, xmin, xmax, ymin, ymax] = get_mesh(mwf)
x_axis = numpy.linspace(xmin, xmax, nx)
y_axis = numpy.linspace(ymin, ymax, ny)
nc = numpy.where(irr == irr_max)
irr_x = irr[ny / 2, :]
irr_y = irr[:, nx / 2]
x0 = numpy.max(x_axis[numpy.where(irr_x == numpy.max(irr_x))])
y0 = numpy.max(y_axis[numpy.where(irr_y == numpy.max(irr_y))])
return [x0, y0]
Is it really should be slice_number=0
in
irr = mwf.get_intensity(slice_number=0, polarization='horizontal')
or we should sum along z-axis?
we should sum I think
to @buzmakov what wrong with Tutorials ?
calculate_peak_pos(A) returns zero - thereby compromising the calling function calculate_fwhm_x() - in case array A contains only zero entries along line/column ny/2 or nx/2. (Current case: An offset aperture lets only 10% of the beam intensity pass in order to simulate beam splitting by a partially inserted mirror.) Suggestion: replace nc = numpy.where(irr == irr_max) irr_x = irr[ny / 2, :] irr_y = irr[:, nx / 2] by nc = numpy.where(irr == irr_max) irr_x = irr[max(nc[0]), :] irr_y = irr[:, max(nc[1])] or similar.