pandas_loader module

Define a generic files loader.

Check the documentation of PandasLoader.load_emission_yield() and PandasLoader.load_emission_energy_distribution() for expected file formats.

class PandasLoader(sep=',', comment='#')

Bases: Loader

Define the pandas loader.

Init object.

load_emission_yield(filepath, sep=None, comment=None)

Load and format the given emission yield file.

CSV files can have comments at the start of the file, starting with a # character. Column separator must be ,. First non-commented line is incidence angle in degrees. First column is incident energy in \(\mathrm{eV}\). EY is the next columns (excluding the first line). Example:

# Cu measurements
# Some comments
# Energy | 0deg | 20deg | 40deg | 60deg
0,0,20,40,60
0,0.814,0.781,0.866,0.918
10,0.574,0.553,0.637,0.803
20,0.632,0.594,0.671,0.817

Files in the data/example_copper/ files are taken from [PBD20] and are correctly formatted.

Parameters:
  • filepath (str | Path) – Path to file holding data under study.

  • sep (str | None, default: None) – Column delimiter.

  • comment (str | None, default: None) – Comment character.

Returns:

Structure holding the data. Has a Energy [eV] column holding PEs energy. And one or several columns theta [deg], where theta is the value of the incidence angle and content is corresponding emission yield.

Return type:

pandas.DataFrame

load_emission_angle_distribution(*args)

Load the given electron emission angle distribution file.

Return type:

Any

load_emission_energy_distribution(filepath, sep=None, comment=None)

Load and format the given emission energy file.

CSV files can have comments at the start of the file, starting with a # character. It is expected that the energy of PEs used for the measurements is on the second commented line, in \(\mathrm{eV}\). Column separator must be ,. First non-commented line is incidence angle in degrees. First column is emission energy in \(\mathrm{eV}\). Distribution is in the next columns (excluding the first line). Example:

# PEs energy in eV
# 100
0,0
1.999999999999975131e-01,7.117578753770542783e-03
3.999999999999968026e-01,1.138131444290255145e-02
5.999999999999978684e-01,1.510969903349285159e-02

Files in the data/example_ag/emission_energy folder are correctly formatted.

Todo

Find a more robust way to handle energy of PEs. Some distributions do not need it.

Parameters:
  • filepath (str | Path) – Path to file holding data under study.

  • sep (str | None, default: None) – Column delimiter.

  • comment (str | None, default: None) – Comment character.

Return type:

tuple[DataFrame, float | None]

Returns:

  • pd.DataFrame – Structure holding the data. Has a Energy [eV] column holding emitted electrons energy. And one or several columns theta [deg], where theta is the value of the incidence angle and content is corresponding emission energy distribution.

  • float – Energy of Primary Electrons in \(\mathrm{eV}\). If not found in the file comments, it will be inferred from the position of the EBEs peak.