STConverter¶
-
class
pyrost.simulation.STConverter(protocol, coord_ratio=1e-06)¶ Converter class to export simulated data from
STSimto a CXI file.STConverteralso exports experimental parameters and the used protocol to INI files.- Parameters
- Variables
templates_dir (str) – Path to ini templates (for exporting protocol and
STParams).write_attrs (dict) – Dictionary with all the attributes which are saved in CXI file.
protocol (Protocol) – CXI protocol, which contains all the attribute’s paths and data types.
coord_ratio (float, optional) – Coordinates ratio between the simulated and saved data.
Notes
List of the attributes saved in CXI file:
basis_vectors : Detector basis vectors.
data : Measured intensity frames.
defocus_fs : Defocus distance along the fast detector axis.
defocus_ss : Defocus distance along the slow detector axis.
distance : Sample-to-detector distance.
energy : Incoming beam photon energy [eV].
good_frames : An array of good frames’ indices.
mask : Bad pixels mask.
roi : Region of interest in the detector’s plane.
translations : Sample’s translations.
wavelength : Incoming beam’s wavelength.
whitefield : Measured frames’ whitefield.
x_pixel_size : Pixel’s size along the fast detector axis.
y_pixel_size : Pixel’s size along the slow detector axis.
-
export_data(data, st_params)¶ Export simulated data data (fetched from
STSim.frames()orSTSim.ptychograph()) and st_params to a data container.- Parameters
data (numpy.ndarray) – Simulated data.
st_params (STParams) – Experimental parameters.
- Returns
Data container with all the data from data and st_params.
- Return type
See also
-
export_dict(data, st_params)¶ Export simulated data data (fetched from
STSim.frames()orSTSim.ptychograph()) and st_params todictobject.- Parameters
data (numpy.ndarray) – Simulated data.
st_params (STParams) – Experimental parameters.
- Returns
data_dict – Dictionary with all the data from data and st_params.
- Return type
See also
-
save(data, st_params, dir_path)¶ Export simulated data data (fetched from
STSim.frames()orSTSim.ptychograph()) and st_params to dir_path folder.- Parameters
data (numpy.ndarray) – Simulated data.
st_params (STParams) – Experimental parameters.
dir_path (str) – Path to the folder, where all the files are saved.
See also
STConverter.save_simFull list of the files saved in dir_path.
-
save_sim(data, st_sim, dir_path)¶ Export simulated data data (fetched from
STSim.frames()orSTSim.ptychograph()) and aSTSimobject st_sim to dir_path folder.- Parameters
data (numpy.ndarray) – Simulated data.
st_sim (STSim) – Speckle Tracking simulation object.
dir_path (str) – Path to the folder, where all the files are saved.
Notes
List of the files saved in dir_path:
‘data.cxi’ : CXI file with all the data attributes.
‘protocol.ini’ : CXI protocol.
‘parameters.ini’ : experimental parameters.
{‘calc_error.ini’, ‘calculate_phase.ini’, ‘generate_pixel_map.ini’, ‘make_reference.ini’, ‘speckle_gui.ini’, ‘update_pixel_map.ini’, ‘update_translations.ini’, ‘zernike.ini’} : INI files to work with Andrew’s speckle_tracking GUI.