LiveLoader#
- class artof.LiveLoader(path, transform_format, t0=None, work_func=4.14, artof_center_x=0.0, artof_center_y=0.0, sweep_type='Scienta')#
Class for loading and processing artof data in real-time. Inherits from the BaseLoader class.
- Parameters:
path (str)
transform_format (str)
t0 (float | None)
work_func (float)
artof_center_x (float)
artof_center_y (float)
sweep_type (str)
- export(path, file_format, proj_axes=None, ranges=None, norm_step_size=False, binding_energy_scale=False, incident_energy=None, eln_path=None, delimiter=',')#
Export loaded data to file in ‘csv’ or ‘nxs’ format. If ‘csv’ is chosen, the data is needs to be projected at least along one axis.
- Parameters:
path (str) – Path to which the data is saved. Including filename but excluding extension.
file_format (str) – Format of the file to which the data is saved (‘csv’ or ‘hdf5’).
proj_axes (list | None) – List containing all axes onto which the projection is performed, e.g., [0,1]. Default None, the data is not projected and saved as is (only for ‘hdf5’).
ranges – List containing ranges for axes (e.g., [[50, 101], [0,50], None]), if None entire range of axes is used (default entire range of each axis).
norm_step_size (bool) – Normalize data with step size before export (default False).
binding_energy_scale (bool) – Export binding energy instead of kinetic energy (default False).
incident_energy (float) – Custom incident energy in eV (default None, extract from metadata). If binding_energy_scale is False, this argument is ignored.
eln_path (str | None) – NeXus only: path to the ELN file where the metadata is stored. If None, standard metadata is used (default None, only relevant for ‘hdf5’ export).
delimiter (str) – Delimiter by which the data is separated (default ‘,’).
- export_counts_to_csv(path, iter_range=None, delimiter=',')#
Export event counts to csv file.
- Parameters:
path (str) – Path to which the data is saved. Including filename but excluding extension (csv).
iter_range (list) – Range of iterations to be exported (default None, all iterations).
delimiter (str) – Delimiter by which the data is separated (default ‘,’).
- get_binned_data(proj_axes=None, ranges=None, norm_step_size=False, binding_energy_scale=False, incident_energy=None)#
Project loaded data onto given axes. Projections are possible onto 1 or 2 axes.
- Parameters:
proj_axes (list | None) – List containing all axes onto which the projection is performed, e.g., [0,1].
ranges – List containing ranges for axes (e.g., [[50, 101], [0,50], None]), if None entire range of axes is used (default entire range of each axis).
norm_step_size (bool) – Normalize data with step size before plotting (default False).
binding_energy_scale (bool) – Export binding energy instead of kinetic energy (default False).
incident_energy (float) – Custom incident energy in eV (default None, extract from metadata). If binding_energy_scale is False, this argument is ignored.
- Returns:
Axes values and list containing the projection (1 or 2D).
- Return type:
tuple[list, list | dict]
- get_event_counts(iter_range=None)#
Get the iterations and the corresponding counts.
Args: iter_range: Range of iterations to be exported (default None, all iterations).
- Returns:
Tuple containing the iterations and the corresponding counts.
- Parameters:
iter_range (list)
- Return type:
tuple[list]
- live_plot(axes, cust_bin_confs=None, norm_modes=None, ranges=None, norm_step_size=False, t0_list=None, binding_energy_scale=False, incident_energy=None, last_n_it=None, wrap_low_energy=False, trigger_period=None, width=600, height=600, multithreading=True, timeout=30)#
Live plot artof data in real-time.
- Parameters:
axes (list) – List containing axes to be plotted, e.g., [0,1].
cust_bin_confs (list | None) – List of 3 custom binning configurations for the 3 parameters [min, max, edges], optional. F.e.: [[-1500, 1500, 101], [-1500, 1500, 101], [12000, 18000, 201]]
norm_modes (list | None) – Normalization mode for binned data (‘iterations’, ‘dwell_time’, ‘sweep’). Default is None. iterations: Normalize data by number of iterations. dwell_time: Normalize data by dwell time. sweep: Normalize data by changing window size of sweep data.
ranges (list | None) – List containing ranges for axes (e.g., [[50, 101], [0,50], None]), if None entire range of axes is used (default entire range of each axis).
norm_step_size (bool) – Normalize data with step size before plotting (default False).
t0_list (list | None) – List of additional t0 offsets for multiple bunches in synchrotron revolution (default None, previously set t0 will be used).
binding_energy_scale (bool) – Plot binding energy instead of kinetic energy (default False).
incident_energy (float | None) – Custom incident energy in eV (default None, extract from metadata). If binding_energy_scale is False, this argument is ignored.
last_n_it (int | None) – Show last n iterations (default None, show all).
wrap_low_energy (bool) – Wrap low energy values to high energy values (default False). If True, the trigger period is read from ‘timing.txt’ file unless provided as trigger_period.
trigger_period (int | None) – Period between two trigger. When provided time of flight longer than one one trigger period can be loaded (default None).
width (int) – Width of plot (default 600).
height (int) – Height of plot (default 600).
multithreading – Use multithreading for data loading (default False).
timeout (float) – Time in seconds to wait for file to be available (default)
- Return type:
None
- live_plot_counts(sum_iters=False, width=600, height=600, timeout=30)#
Live plot counts of all measured events.
- Parameters:
sum_iters (bool) – Sum counts of each iteration, instead of returning counts for each step. Only relevant for sweeps. (default False)
width (int) – Width of plot (default 600).
height (int) – Height of plot (default 600).
timeout (float) – Time in seconds to wait for file to be available (default 30).
- Return type:
None
- log_metadata(pars=None)#
Get metadata of loaded data.
- Parameters:
pars (list) – List of keys to be extracted from metadata (when ‘None’ all metadata will be returned), optional. Default is [‘analyzer.lensMode’, ‘analyzer.elementSet’, ‘analyzer.passEnergy’, ‘general.lensIterations’, ‘general.lensDwellTime’, ‘general.spectrumBeginEnergy’, ‘general.spectrumEndEnergy’, ‘general.centerEnergy’, ‘detector.t0’, ‘detector.t0Tolerance’]
- Returns:
Dataframe consisting of metadata of loaded data.
- Return type:
DataFrame