Data structures

Spectrum class

class EVA.core.data_structures.spectrum.Spectrum(detector, run_number, x, y)

The ‘Spectrum’ dataclass holds the data from a single detector for a single run.

Parameters:
  • detector (str) – string, name of detector.

  • run_number (str) – string, run number for the spectrum.

  • x (ndarray) – numpy array, containing the x-data measured by the detector (histogram bins).

  • y (ndarray) – numpy array, containing y-data measured by the detector (counts per bin).

Run class

class EVA.core.data_structures.run.Run(raw, loaded_detectors, run_num, start_time, end_time, events_str, comment)
corrections_updated_s

The Run class specifies the experiment data and context for all detectors during a single measurement run.

Parameters:
  • raw – List of Spectrum objects, one Spectrum for each detector. The list may

  • detector. (contain empty Spectrum objects if no data was found for a)

  • loaded_detectors – Names of all detectors for which data was successfully loaded.

  • run_num – Run number.

  • start_time – Time run was started.

  • end_time – Time run was ended.

  • events_str – Number of events registered.

  • comment – All metadata available for the run.

get_nonzero_data()

Returns: Copy of data without empty Spectrum objects for missing detectors.

Return type:

list[Spectrum]

get_raw()

Returns: Copy of raw.

Return type:

dict[Spectrum]

is_empty()

Returns: Boolean indicating whether any data was loaded or not.

Return type:

bool

set_corrections(energy_corrections=None, normalisation=None, normalise_which=None, bin_rate=None)

Reapplies all normalisation, corrections and binning specified for the data. Order here is important, and so to be safe, any time any form of correction is wanted, everything should be re-calculated. This could become inefficient if many more complicated processing methods are implemented, so another approach could be considered here in the future.

The order of processing is:

  • energy calibrations / corrections

  • normalisation

  • binning

Detector class

class EVA.core.data_structures.detector.DetectorIndices(*values)

Enum class to map detector names to indices.