wpg.wpg_uti_wf module

wpg.wpg_uti_wf.averaged_intensity(wf, bPlot=False)[source]

wrapper for integral_intensity() for backward compatibility

wpg.wpg_uti_wf.calc_pulse_energy(wf)[source]

calculate energy of in time domain

Parameters:wf – wpg.Wavefront structure
Returns:pulse energy value, J
wpg.wpg_uti_wf.calculate_fwhm(wfr)[source]

Calculate FWHM of the beam calculating number of point bigger then max / 2 throuhgt center of the image

Parameters:wfr – wavefront
Returns:{‘fwhm_x’:fwhm_x, ‘fwhm_y’: fwhm_y} in [m]
wpg.wpg_uti_wf.check_sampling(wavefront)[source]

Utility to check the wavefront sampling.

wpg.wpg_uti_wf.get_intensity_on_axis(wfr)[source]

Calculate intensity (e.g. spectrum in frequency domain) along (x=y=0)

Parameters:wfr – wavefront
Returns:[z,s0] in [a.u.]
wpg.wpg_uti_wf.integral_intensity(wf, threshold=0.01, bPlot=True)[source]

plot the slice-to-slice integral intensity averaged over a meaningful range

Parameters:
  • wf – wavefront structure
  • threshold – defined the threshold for slices, integrated_slice_intensity_max*threshold
  • bPlot – if True plot temporary structure or spectrum in the meaningful range
Returns:

intensity averaged over ‘meaningful’ slices, i.e. above 1% threshold, mainly needed for processing spiky FEL source

wpg.wpg_uti_wf.look_at_q_space(wf, output_file=None, save='', range_x=None, range_y=None)[source]

a wrapper for backward compatibility

wpg.wpg_uti_wf.plot_intensity_map(wf, save='', range_x=None, range_y=None, im_aspect='equal')[source]

Plot wavefront in R-space.

Parameters:
  • wf – wavefront structure
  • save – string for filename. Empty string ‘’ means don’t save.
  • range_x – x-axis range, _float_. If None, take entire x range.
  • range_y – y-ayis range, float. If None, take entire y range.
  • im_aspect – aspect for 2D image, string or float number, see matplotlib set_aspect().
wpg.wpg_uti_wf.plot_intensity_qmap(wf, output_file=None, save='', range_x=None, range_y=None, im_aspect='equal')[source]

change wavefront representation from R- to Q-space and plot it the resulting wavefront.

Parameters:
  • wf – Wavefront object in R-space representation
  • output_file – if parameter present - store wavefront in Q-space to the file
  • save – string for filename. Empty string ‘’ means don’t save.
  • range_x – x-axis range, _float_. If None, take entire x range.
  • range_y – y-ayis range, float. If None, take entire y range.
Returns:

propagated wavefront object:

wpg.wpg_uti_wf.plot_t_wf(wf, save='', range_x=None, range_y=None, im_aspect='equal')[source]

a wrapper, calls integral_intensity() and plot_intensity_map() for backward compatibility

wpg.wpg_uti_wf.plot_wf(wf, save='', range_x=None, range_y=None, im_aspect='equal')[source]

a wrapper, calls integral_intensity() and plot_intensity_map() for backward compatibility

wpg.wpg_uti_wf.print_mesh(wf)[source]

Print out wfr wavefront mesh.

Parameters:wf – wpg.Wavefront structure
wpg.wpg_uti_wf.propagate_wavefront(wavefront, beamline, output_file=None)[source]

Propagate wavefront and store it in output file.

Parameters:
  • wavefront – wpg.Wavefront object or path to HDF5 file
  • beamline – SRWLOptC container of beamline
  • output_file – if parameter present - store propagaed wavefront to file
Returns:

propagated wavefront object