xrf_explorer.server.spectra package

Submodules

xrf_explorer.server.spectra.spectra module

class ElementLines(element, excitation_energy_kev)[source]

Bases: object

Computes fluorescence emission line energies and intensities for element.

gaussian_convolve(peak_energies: ndarray, peak_intensities: ndarray, x_kevs: ndarray | None = None, std: float = 0.01) tuple[ndarray, ndarray][source]

Convolve line spectrum defined by peak_energies and peak_intensities with a Gaussian peak shape.

Parameters:
  • peak_energies – peak energies of the element

  • peak_intensities – peak intensities of the element

  • x_kevs – pre-determined x values

  • std – standard deviation of gaussian filter

get_average_global(data: ndarray) list[float][source]

Computes the average of the raw data for each bin on the whole painting.

Parameters:

data – datacube containing the raw data

Returns:

list where the index is the channel number and the value is the average global intensity of that channel

get_average_selection(data_source: str, mask: ndarray) list[float][source]

Computes the average of the raw data for each bin on the selected pixels.

Parameters:
  • data_source – name of the data source to get the selection average from

  • mask – The mask describing the selected pixels

Returns:

list where the index is the channel number and the value is the average intensity of that channel within the selection

get_element_spectrum(element: str, excitation_energy_kev: float, normalize: bool = True, x_kevs: ndarray | None = None, std: float = 0.01) tuple[ndarray, ndarray, ndarray, ndarray] | ndarray[source]

Compute simple excitation spectrum (no matrix effects) and peaks.

Parameters:
  • element – symbol of the element

  • excitation_energy_kev – excitation energy

  • normalize – boolean representing whether to normalize y values

  • x_kevs – pre-determined x values

  • std – standard deviation of gaussian filter

Returns:

x values of the spectrum, y values of the spectrum, peak energies, peak intensities

get_theoretical_data(element: str, excitation_energy_kev: float, low: int, high: int, bin_size: int) list[source]

Get the theoretical spectrum and peaks of an element. Precondition: 0 <= low < high < 4096, 0 < bin_size <= 4096, 0 <=excitation_energy_kev <= 40

Parameters:
  • element – symbol of the element

  • excitation_energy_kev – excitation energy

  • low – lower channel boundary

  • high – higher channel boundary

  • bin_size – size of each bin

Returns:

list with first element being a list of dictionaries representing the spectra points, second being a list of dictionaries representing the peaks

Module contents

This module handles everything related to the spectral chart.