data_matrix module

Store the filepaths entered by user.

Todo

Methods to reset filepaths/data

class DataMatrix

Bases: object

Store all the input files and corresp data in a single object.

__init__() None

Instantiate the object.

_natures_to_indexes(population_type: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Yield', 'Emission Energy', 'Emission Angle']) tuple[int, int]

Give the desired indexes.

_indexes_to_natures(row: int, col: int) tuple[Literal['SE', 'EBE', 'IBE', 'all'], Literal['Emission Yield', 'Emission Energy', 'Emission Angle']]

Give the desired natures.

set_files(files: str | Path | Collection[str] | Collection[Path], row: int, col: int, population: None, emission_data_type: None) None
set_files(files: str | Path | Collection[str] | Collection[Path], row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Yield', 'Emission Energy', 'Emission Angle']) None

Set the file(s) by index or name.

set_data(emission_data: EmissionData | Collection[EmissionData], row: int, col: int, population: None, emission_data_type: None) None
set_data(emission_data: EmissionYield | Collection[EmissionYield], row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Yield']) None
set_data(emission_data: EmissionEnergyDistribution | Collection[EmissionEnergyDistribution], row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Energy']) None
set_data(emission_data: EmissionAngleDistribution | Collection[EmissionAngleDistribution], row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Angle']) None

Set the data by index or name.

get_files(row: int, col: int, population: None, emission_data_type: None) None | str | Path | Collection[str] | Collection[Path]
get_files(row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Yield', 'Emission Energy', 'Emission Angle']) None | str | Path | Collection[str] | Collection[Path]

Get the file(s) by index or name.

get_data(row: int, col: int, population: None, emission_data_type: None) None | EmissionData | Collection[EmissionData]
get_data(row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Yield']) None | EmissionYield | Collection[EmissionYield]
get_data(row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Energy']) None | EmissionEnergyDistribution | Collection[EmissionEnergyDistribution]
get_data(row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: Literal['Emission Angle']) None | EmissionAngleDistribution | Collection[EmissionAngleDistribution]
get_data(row: None, col: None, population: None, emission_data_type: None) Collection[EmissionData]
get_data(row: None, col: None, population: Literal['SE', 'EBE', 'IBE', 'all'], emission_data_type: None) Collection[EmissionData]
get_data(row: None, col: None, population: None, emission_data_type: Literal['Emission Yield', 'Emission Energy', 'Emission Angle']) Collection[EmissionData]

Get the file(s) by index or name.

You can provide row and col directly.

Alternatively, provide population and emission_data_type. If population is not given, return valid data corresponding to all populations. If emission_data_type is not given, return valid data corresponding to all emission data.

Parameters:
  • row – Row index in data matrix.

  • col – Column index in data matrix.

  • population – Population type.

  • emission_data_type – Emission data type.

Returns:

  • Desired data; if the specified data does not exists, a None is

  • returned without any error message.

load_data(loader: Loader) None

Load all filepaths in files_matrix.

Todo

Could be more concise.

has_all_mandatory_files(model_config: ModelConfig) bool

Tell if files defined by Model.model_config are set.

plot(plotter: Plotter, population: Literal['SE', 'EBE', 'IBE', 'all'] | Collection[Literal['SE', 'EBE', 'IBE', 'all']], emission_data_type: Literal['Emission Yield', 'Emission Energy', 'Emission Angle'], axes: T | None = None, **kwargs) T | None

Plot desired measured data using plotter.

This method uses DataMatrix.get_data() to get the EmissionData instance matching population and emission_data_type. Then it calls the EmissionData.plot() method.

Parameters:
  • plotter – Object realizing the plot. We transfer it to the EmissionData.plot() method.

  • population – One or several populations to plot. If several are given, we simply recursively call this method.

  • emission_data_type – Type of data to plot.

  • axes – Axes to re-use if given.

  • kwargs – Other keyword arguments passed to the EmissionData.plot() method.

Return type:

Created axes object, or None if no plot was created.

property teey: EmissionYield

Return the TEEY directly.

property se_energy_distribution: EmissionEnergyDistribution

Return the energy distribution of SEs.

property all_energy_distribution: EmissionEnergyDistribution

Return the energy distribution of all emitted electrons.