est.core package¶
Subpackages¶
est.core.io module¶
simple helper function to link io module and XASObject
-
class
est.core.io.
XASReader
¶ Bases:
object
Simple reader of a xas file
-
read_frm_url
(spectra_url, channel_url, config_url=None)¶
-
read_from_file
(file_path)¶ - Parameters
file_path (str) –
- Returns
.XASObject
-
-
class
est.core.io.
XASWriter
¶ Bases:
object
class to write the output file. In this case we need a class in order to setup the output file before
-
dump_xas
(xas_obj, write_process=True)¶ write the XASObject into a hdf5 file.
- Parameters
xas_obj – object to be stored
write_process (bool) – if True then store the process flow in the same file.
- Type
Union[
XASObject
,dict]
-
property
output_file
¶
-
setProperties
(properties)¶
-
-
est.core.io.
read
(spectra_url, channel_url, config_url=None)¶ - Parameters
spectra_url (DataUrl) – data url to the spectra
channel_url (DataUrl) – data url to the channel / energy
config_url (DataUrl) – data url to the process configuration
- Returns
- Return type
est.core.reprocessing module¶
some utils function for executing reprocessing
-
est.core.reprocessing.
get_process_instance_frm_h5_desc
(desc)¶ - Parameters
desc (dict) – description of the process to instanciate
- Returns
instance of the process to execute, configured from the description
est.core.types module¶
-
class
est.core.types.
Sample
(name='undefined sample', description=None)¶ Bases:
object
Description of the sample. Needed for writing valid nx file
-
class
est.core.types.
Spectra
¶ Bases:
object
-
class
est.core.types.
Spectrum
(energy=None, mu=None)¶ Bases:
larch.symboltable.Group
Core object to be used to store larch and pymca results.
Larch is using ‘Group’ to store the result and add menbers to this group according to the different treatment. Pymca is using a dictionary to store the result.
This class as to adpat to the both behavior and the different naming convention as well.
- Parameters
(1D) energy (numpy.ndarray) – beam energy
(1D) mu (numpy.ndarray) – beam absorption
-
property
chi
¶
-
copy
()¶
-
property
e0
¶
-
property
energy
¶
-
extra_keys
()¶
-
static
from_dict
(ddict)¶
-
property
ft
¶
-
get_missing_keys
(keys)¶ Return missing keys on the spectrum
-
property
k
¶
-
keys
()¶
-
load_frm_dict
(ddict)¶
-
property
mu
¶
-
property
norm
¶
-
property
normalized_energy
¶
-
property
normalized_mu
¶
-
property
post_edge
¶
-
property
pre_edge
¶
-
property
shape
¶
-
to_dict
()¶
-
class
est.core.types.
XASObject
(spectra=None, energy=None, configuration=None, dim1=None, dim2=None, name='scan1', keep_process_flow=True)¶ Bases:
object
Base class of XAS
- Parameters
spectra – absorbed beam as a list of
Spectrum
or a numpy.ndarrayenergy – 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
keep_process_flow (bool) – if True then will keep the trace of the set of process applied to the XASObject into a hdf5 file.
- Type
Union[numpy.ndarray, list]
- Type
numpy.ndarray of one dimension
-
absorbed_beam
()¶
-
addSpectrum
(spectrum)¶
-
clean_process_flow
()¶ Remove existing process flow
-
property
configuration
¶
-
copy
(create_h5_file=False)¶ - Parameters
create_h5_file (bool) – True if we want to duplicate the h5 file This is the case for orange widget for example where some reprocessing can append and each process need to keep a clear history of processes, whith no knowledge of next processing.
-
copy_process_flow_to
(h5_file_target)¶ copy all the recognized process from self.__h5_file to h5_file_target
- Parameters
h5_file_target (str) – path to the targeted file. Should be an existing hdf5 file.
-
property
dim1
¶
-
property
dim2
¶
-
dump
(h5_file)¶ dump the XAS object to a file_path within the Nexus format
-
property
energy
¶
-
property
entry
¶
-
forceDim1
(value)¶
-
forceDim2
(value)¶
-
static
from_dict
(ddict)¶
-
static
from_file
(h5_file, entry='scan1', spectra_path='data/absorbed_beam', energy_path='data/energy', configuration_path='configuration')¶
-
getSpectrum
(dim1_idx, dim2_idx)¶ Util function to access the spectrum at dim1_idx, dim2_idx
-
get_next_processing_index
()¶
-
get_process_flow
()¶ - Returns
the dict of process information
- Return type
dict
-
has_linked_file
()¶
-
link_to_h5
(h5_file)¶ Associate a .h5 file to the XASObject. This can be used for storing process flow.
- Parameters
h5_file –
- Returns
-
property
linked_h5_file
¶
-
load_frm_dict
(ddict)¶ load XAS values from a dict
-
property
n_spectrum
¶ return the number of spectra
-
register_processing
(process, data)¶ Register one process for the current xas object. This require to having link a h5file to this object
- Parameters
process – process to be registred
data – result of the processing. If there is more than one result then a dictionary with the key under which result should be saved and a numpy.ndarray
- Type
- Type
Union[numpy.ndarray,dict]
-
property
spectra
¶
-
static
spectra_equal
(spectra1, spectra2)¶
-
spectra_keys
()¶ keys contained by the spectrum object (energy, mu, normalizedmu…)
-
to_dict
(with_process_details=True)¶ 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