TODOs¶
Todo
Add documentation of srwlib.h functions
Other modules¶
-
wpg.utils.
get_value
(dic, keys_chain)[source]¶ Get node from dictionary by chain of keys
Parameters: - dic – dict from which value will taken
- keys_chain – list of keys
Return res: return value
-
wpg.utils.
load_dict_slash_hdf5
(hdf5_file_name)[source]¶ Load dictionary with fields of wavefront :param hdf5_file_name: Input file name
-
wpg.utils.
set_value
(dic, keys_chain, value)[source]¶ Set value in dictionary by chain of keys
Parameters: - value – value
- dic – dic
- keys_chain – list of keys
-
wpg.utils.
set_value_attr
(obj, keys_chain, value)[source]¶ Return node from dictionary by chain of keys
Parameters: - obj –
- keys_chain – list of keys
- value –
-
wpg.utils.
store_dict_hdf5
(hdf5_file_name, input_dict)[source]¶ Store dictionary in hdf5 file. :param hdf5_file_name: :param input_dict:
-
wpg.utils.
update_dict_slash_string
(input_dict, keys_string, value)[source]¶ Update dictionary from slash separated keys_string by value :param input_dict: dictionary to be updated :param keys_string: slash separated keys_string :param value: value
-
wpg.useful_code.backpropagation.
back_propagate
(params)[source]¶ Propagate pulse from file params[0] at the distance params[1] and save result to HDF5 file. If output files exists - skip calculations.
-
wpg.useful_code.backpropagation.
fit_gaussian
(data)[source]¶ Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution found by a fit
-
wpg.useful_code.backpropagation.
fit_gaussian_pulse
(wf, polarization='horizontal')[source]¶ Calculate gaussian parameters for all slices in wavefront and add it to custom_fields[‘misc’][‘gaussain_parameters’]
-
wpg.useful_code.backpropagation.
forward_propagate
(root_dir, distance, propagation_parameters)[source]¶ Forward_propagate_wavefront the result will saved in root_dirdistancedistance.h5 file
Parameters: - root_dir – directory, where ‘0.h’ file located
- distance – distance to forward propagate initial wvefront
- propagation_parameters – SRW propagation parameters
-
wpg.useful_code.backpropagation.
gaussian
(height, center_x, center_y, width_x, width_y)[source]¶ Returns a gaussian function with the given parameters
-
wpg.useful_code.backpropagation.
mkdir_p
(path)[source]¶ Create directory tree, if not exists (mkdir -p)
-
wpg.useful_code.backpropagation.
moments
(data)[source]¶ Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moments
-
wpg.useful_code.backpropagation.
show_slices
(wfr, slice_numbers=None)[source]¶ Show slices: intensity, phase, gaussian approximation parameters and cuts. All gaussina parameters in pixels now. Should be fixed.
Params wfr: wpg.Wavefront Params slice_numbers: slices to be shown, may by list, int, or None (for all slices)
-
wpg.useful_code.srwutils.
AuxTransmAddSurfHeightProfileScaled
(optSlopeErr, heightProfData, dim, ang, scale)[source]¶
-
wpg.useful_code.wfrutils.
plot_2d
(amap, xmin, xmax, ymin, ymax, title_fig, title_x, title_y)[source]¶
-
wpg.useful_code.wfrutils.
plot_wfront
(mwf, title_fig, isHlog, isVlog, i_x_min, i_y_min, orient, onePlot, bPlotPha=None, saveDir=None)[source]¶ Plot 2D wavefront (a slice).
Parameters: - mwf – 2D wavefront structure
- title_fig – Figure title
- isHlog – if True, plot the horizontal cut in logarithmic scale
- isVlog – if True, plot the vertical cut in logarithmic scale
- i_x_min – Intensity threshold for horizontral cut, i.e. x-axis limits are [min(where(i_x<i_x_min):max(where(i_x<i_x_min)]
- i_y_min – Intensity threshold for vertical cut,
- orient – ‘x’ for returning horizontal cut, ‘y’ for vertical cut
- onePlot – if True, put intensity map and plot of cuts on one plot, as subplots
- bPlotPha – if True, plot the cuts of WF phase
Returns: 2-column array containing horizontal or vertical cut data in dependence of ‘orient’ parameter
-
wpg.useful_code.wfrutils.
propagate_run
(ifname, ofname, optBL, bSaved=False)[source]¶ Propagate wavefront through a beamline and save the result (optionally).
Parameters: - ifname – input hdf5 file name with wavefront to be propagated
- ofname – output hdf5 file name
- optBL – beamline
- bSaved – if True, save propagated wavefront in h5 file
Returns: propagated wavefront
-
wpg.useful_code.wfrutils.
show_slices_hsv
(wf, slice_numbers=None, pretitle='')[source]¶ Show slices: intensity, phase, gaussian approximation parameters and cuts. @TBD:All gaussian parameters in pixels now. Should be fixed. @TBD: Add normalization to averaged slice intensity
Params wf: wpg.Wavefront Params slice_numbers: slices to be shown, may by list, int, or None (for all slices) Params pretitle: string to be add in the beginning of the title line