est.core.types.xasobject.XASObject#

class est.core.types.xasobject.XASObject(spectra=None, energy=None, configuration: dict | None = None, dim1: None | int = None, dim2: None | int = None, name: str = 'scan1', spectra_url: DataUrl | None = None, spectra_url_dims: Sequence[int] | None = None, energy_url: DataUrl | None = None, check_energy: bool = True)[source]#

Bases: object

Base class of XAS

Parameters:
  • spectra – absorbed beam as a list of Spectrum or a numpy.ndarray. If is a numpy array, the axes should have the STANDARD_DIMENSIONS order.

  • energy – beam energy

  • configuration (dict) – configuration of the different process

  • dim1 (int) – first dimension of the spectra

  • dim2 (int) – second dimension of the spectra

  • name (str) – name of the object. Will be used for the hdf5 entry

  • spectra_url – path to the spectra data if any. Used when serializing the XASObject. Won’t read it from it.

  • spectra_url_dims – dimensions of the stored spectra. WARNING: this is different of the spectra dimension which should be given in the STANDARD_DIMENSIONS order

  • energy_url – path to the energy / channel data if any. Used when serializing the XASObject. Won’t read it from it.

Type:

Union[numpy.ndarray, list]

Type:

numpy.ndarray of one dimension

Type:

Union[None,str]

Type:

Union[tuple,None]

Type:

Union[None,str]

absorbed_beam() ndarray[source]#
attach_3d_array(attr_name, attr_value)[source]#

Attach to each attribute the provided value

Parameters:
  • attr_name

  • attr_value

Returns:

property configuration: dict#
copy()[source]#
deepcopy()[source]#
dump(h5_file: str)[source]#

dump the XAS object to a file_path within the Nexus format

property energy: ndarray#

energy as a numpy array in eV. :note: cannot be with unit because use directly by xraylarch and pymca

property energy_url: DataUrl | None#

Url from where the energy is available. Used for object serialization

property entry: str#
static from_dict(ddict: dict)[source]#
static from_file(h5_file, entry='scan1', spectra_path='data/absorbed_beam', energy_path='data/energy', configuration_path='configuration', dimensions=None, timeout=1.0)[source]#
get_spectrum(dim1_idx: int, dim2_idx: int) <property object at 0x7fe6706d3900>[source]#

Util function to access the spectrum at dim1_idx, dim2_idx

load_from_dict(ddict: dict)[source]#

load XAS values from a dict

property n_spectrum: int#

return the number of spectra

property normalized_energy#
property spectra#
property spectra_url: None | DataUrl#

Url from where the spectra is available. Used for object serialization

property spectra_url_dims: tuple#

used to interpret the spectra_url if any

to_dict() dict[source]#

convert the XAS object to a dict

By default made to simply import raw data.

Parameters:

with_process_details – used to embed a list of spectrum with intermediary result instead of only raw mu. This is needed especially for the pushworkflow actors to keep a trace of the processes.

Type:

bool