ARTOFLoader#

class artof.ARTOFLoader(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.

Parameters:
  • path (str)

  • transform_format (TransformFormat)

  • t0 (float | None)

  • work_func (float)

  • artof_center_x (float)

  • artof_center_y (float)

  • sweep_type (str)

bin_data(cust_bin_confs=None, norm_modes=None, win_config=None, igor_binning=False)#

Bin loaded data into 3D histogram.

Parameters:
  • cust_bin_confs – List of 3 custom binning configurations for the 3 parameters [min, max, edges]. 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.

  • win_config (tuple[int, int] | None) – Tuple of (window size, step size) for sweep data (default None, one window) If the last window is smaller than the step size, it will be ignored.

  • igor_binning (bool) – DEPRECATED. Igor-like binning is only meant for legacy support, only use for comparision. Bin edges shifted by half bin width, default False.

Raises:

Exception – If data is not loaded before binning.

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]

load_counts(sum_iters=False, start_step=None, stop_step=None)#

Load 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)

  • start_step (tuple) – Start step of the lens iteration (iter, step) (including) (default None, start from first step)

  • stop_step (tuple) – Stop step of the lens iteration (iter, step) (excluding) (default None, stop at last step)

load_transformed_data(path=None)#

Load transformed data from file. By default it is loaded from the path used for initialization of the loader.

Parameters:

path (str) – Path to file where transformed data is stored. If None, the path used for initialization is used.

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

plot(axes=None, ranges=None, norm_step_size=False, binding_energy_scale=False, incident_energy=None, width=600, height=600)#

Plot loaded data as projection onto given axes. Projections are possible onto 1 or 2 axes.

Parameters:
  • axes (list | None) – List containing all axes which should be plotted, 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) – Plot 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.

  • width (int) – Width of plot (default 600).

  • height (int) – Height of plot (default 600).

Raises:
  • ValueError – An incorrect number of projection axes provided or incident energy could not

  • be read from metadata.

plot_counts(iter_range=None, width=600, height=600)#

Plot counts of all measured events over iterations in given range.

Parameters:
  • range – Range of iterations to plot (def+ault None, plot all).

  • width (int) – Width of plot (default 600).

  • height (int) – Height of plot (default 600).

  • iter_range (list)

save_transformed_data(path=None)#

Save transformed data to one file per iteration. Since to reload the data, the metadata needs to be loaded again. If changing the path, make sure the metadata is also in the new directory.

Parameters:

path (str) – Path where transformed data is saved. Deault is None, in this case the

transform_data(iter_interval=None, t0_list=None, wrap_low_energy=False, trigger_period=None, multithreading=True)#

Load artof data for run in directory and transform into desired format.

Parameters:
  • iter_interval (tuple | None) – Tuple of start (including) and stop (excluding) lens iteration to load (default None, load all).

  • t0_list (list | None) – List of custom t0s (default None, use previously set t0).

  • 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).

  • multithreading (bool) – Use multithreading for data loading (default True).