pyPENELOPE

photonspectra – Results of the photon spectra collected by the detectors

Inheritance diagram of penelopetools.api.result.penepma.photonspectra

class penelopetools.api.result.penepma.photonspectra.PhotonBremsstrahlungSpectra(full_spectra, characteristic_spectra)

Bases: penelopetools.api.result.penepma.photonspectra._PhotonSpectra

class penelopetools.api.result.penepma.photonspectra.PhotonBremsstrahlungSpectrum(full_spectrum, characteristic_spectrum, name, description=None)

Bases: penelopetools.api.result.penepma.photonspectra.PhotonSpectrum

class penelopetools.api.result.penepma.photonspectra.PhotonCharacteristicSpectra(path)

Bases: penelopetools.api.result.penepma.photonspectra._PhotonSpectra

Loads and stores all the characteristic photon spectra in the results path. Characteristic spectra are spectra with only the X-ray peaks. This background is removed. The files of these spectra starts with pe-charact-.

Loads and stores all the spectra matching a specific pattern. The pattern is specified by three class attributes:

  • MATCH_PREFIX: prefix
  • MATCH_SUFFIX: suffix
  • MATCH_PATTERN: pattern

All the spectra matching the pattern in the specified path are loaded as PhotonSpectrum. This class is a dictionary where the keys are the index of the detector which value is the spectrum. The first detector as a key of 1.

When this class is instantiated, the spectra are not loaded. As any other _Result, the method load() must be called. This method loads all the spectra.

Parameters:path – folder containing the simulation results
MATCH_PREFIX = 'pe-charact-'
SUFFIX = 'charact'
class penelopetools.api.result.penepma.photonspectra.PhotonCharacteristicSpectrum(filename, path, name, description=None)

Bases: penelopetools.api.result.penepma.photonspectra.PhotonSpectrum

Extends PhotonSpectrum by adding methods to deal with the fluorescence results.

The fluorescence contribution on the characteristic X-ray intensity is stored and can be retrieved for a given energy using the method fluorescence_intensity. The characteristic intensity without the fluorescence contribution can also be obtained with the method no_fluorescence_intensity.

Special kind of result file consisting of two, three or five columns of data. The order of the columns goes as follows:

  • Independent variable, typically energy
  • First probability
  • Error on the probability
  • Second probability
  • Error on the second probability

The values of the columns are saved in list; one list for each column. After the data is read (using the method load) the lists can be access with the attributes:

  • first_column
  • probability_density
  • probability_density_error
  • probability_density2
  • probability_density_error2

The complete data can also be access with the attribute data. It is a dictionary where the keys are the label of the columns and the value is the list of values.

Parameters:
  • filename – name of the file containing the probability result
  • path – folder containing the simulation results
  • name – name of the result
  • description – description of the result
PROBABILITY_DENSITY_2 = 'Fluorescence probability density (1/(eV*sr*electron))'
PROBABILITY_DENSITY_ERROR_2 = 'Fluorescence probability density uncertainty'
PROBABILITY_DENSITY_NO_FLUORESCENCE = 'Probability density no fluorescence'
PROBABILITY_DENSITY_NO_FLUORESCENCE_ERROR = 'Probability density no fluorescence uncertainty'
datakeys
fluorescence_intensity(energy)

Returns the fluorescence contribution to the intensity and its error at a given energy.

Parameters:energy – energy of interest (in eV).
Return type:Magnitude
fluorescence_probability_density

Values in the fourth column. The fourth column contains the second probability. It may be an empty list if the data doesn’t have a fourth column.

fluorescence_probability_density_error

Values in the fifth column. The fifth column contains the error on the second probability. It may be an empty list if the data doesn’t have a fifth column.

no_fluorescence_intensity(energy)

Returns the intensity and its error at a given energy with the fluorescence.

Parameters:energy – energy of interest (in eV).
Return type:Magnitude
probability_density_no_fluorescence

Probability density without the fluorescence contribution.

probability_density_no_fluorescence_error

Error on the probability density without the fluorescence contribution.

class penelopetools.api.result.penepma.photonspectra.PhotonConvolutedSpectra(path)

Bases: penelopetools.api.result.penepma.photonspectra._PhotonSpectra

Loads and stores all the convoluted photon spectra in the results path. Convoluted spectra are full photon spectra where the X-ray peaks are convoluted to simulate real spectra collected by an EDS detector. The files of these spectra starts with pe-spect- and ends with convol.

Loads and stores all the spectra matching a specific pattern. The pattern is specified by three class attributes:

  • MATCH_PREFIX: prefix
  • MATCH_SUFFIX: suffix
  • MATCH_PATTERN: pattern

All the spectra matching the pattern in the specified path are loaded as PhotonSpectrum. This class is a dictionary where the keys are the index of the detector which value is the spectrum. The first detector as a key of 1.

When this class is instantiated, the spectra are not loaded. As any other _Result, the method load() must be called. This method loads all the spectra.

Parameters:path – folder containing the simulation results
MATCH_PATTERN = '(\\w+-\\w+-\\d+_\\w+\\.\\w+)'
MATCH_PREFIX = 'pe-spect-'
MATCH_SUFFIX = '_convol'
SUFFIX = 'convol'
class penelopetools.api.result.penepma.photonspectra.PhotonConvolutedSpectrum(filename, path, name, description=None)

Bases: penelopetools.api.result.penepma.photonspectra.PhotonSpectrum

Special kind of result file consisting of two, three or five columns of data. The order of the columns goes as follows:

  • Independent variable, typically energy
  • First probability
  • Error on the probability
  • Second probability
  • Error on the second probability

The values of the columns are saved in list; one list for each column. After the data is read (using the method load) the lists can be access with the attributes:

  • first_column
  • probability_density
  • probability_density_error
  • probability_density2
  • probability_density_error2

The complete data can also be access with the attribute data. It is a dictionary where the keys are the label of the columns and the value is the list of values.

Parameters:
  • filename – name of the file containing the probability result
  • path – folder containing the simulation results
  • name – name of the result
  • description – description of the result
datakeys
class penelopetools.api.result.penepma.photonspectra.PhotonFullSpectra(path)

Bases: penelopetools.api.result.penepma.photonspectra._PhotonSpectra

Loads and stores all the full photon spectra in the results path. Full spectra are spectra with the X-ray peaks and background. The files of these spectra starts with pe-spectra-.

Loads and stores all the spectra matching a specific pattern. The pattern is specified by three class attributes:

  • MATCH_PREFIX: prefix
  • MATCH_SUFFIX: suffix
  • MATCH_PATTERN: pattern

All the spectra matching the pattern in the specified path are loaded as PhotonSpectrum. This class is a dictionary where the keys are the index of the detector which value is the spectrum. The first detector as a key of 1.

When this class is instantiated, the spectra are not loaded. As any other _Result, the method load() must be called. This method loads all the spectra.

Parameters:path – folder containing the simulation results
MATCH_PREFIX = 'pe-spect-'
SUFFIX = 'full'
class penelopetools.api.result.penepma.photonspectra.PhotonSpectrum(filename, path, name, description=None)

Bases: penelopetools.api.result._ProbabilityResult

This class stores the data of a photon spectrum collected by a detector. This class is designed to accommodate the different spectrums collected by PENEPMA (characteristic, full and convoluted).

When this class is instantiated, the spectrum is not loaded. As any other _Result, the method load() must be called.

For all types of spectrum, the intensity at a given energy can be retrieved using the method intensity. The method takes care of finding the energy bin closes to the desired energy and returns the intensity (probability density) and its error if given. The real intensity in a number of counts can be obtained with the method real_intensity if the user knows the beam current, solid angle, detector efficiency and live time.

Special kind of result file consisting of two, three or five columns of data. The order of the columns goes as follows:

  • Independent variable, typically energy
  • First probability
  • Error on the probability
  • Second probability
  • Error on the second probability

The values of the columns are saved in list; one list for each column. After the data is read (using the method load) the lists can be access with the attributes:

  • first_column
  • probability_density
  • probability_density_error
  • probability_density2
  • probability_density_error2

The complete data can also be access with the attribute data. It is a dictionary where the keys are the label of the columns and the value is the list of values.

Parameters:
  • filename – name of the file containing the probability result
  • path – folder containing the simulation results
  • name – name of the result
  • description – description of the result
FIRST_COLUMN = 'Energy (eV)'
PROBABILITY_DENSITY = 'Probability density (1/(eV*sr*electron))'
datakeys
energies

Values in the first column. The first column contains the independent variable.

energy_channel_width

Energy channel width (the energy between two channels).

Return type:Magnitude
intensity(energy)

Returns the intensity and its error at a given energy.

Parameters:energy – energy of interest (in eV).
Return type:Magnitude
intensity_over_energy_range(energy_low, energy_high)

Returns the sum of the intensities over an energy range [lowerEnergy_eV, upperEnergy_eV]. The energy range spans from energy_low - channel_width/2.0 to energy_high + channel_width/2.0.

Parameters:
  • energy_low – lower energy limit (in eV)
  • energy_high – upper energy limit (in eV)
Return type:

Magnitude

real_intensity(energy, solid_angle=1.0, beam_current=1.0, live_time=1.0, detector_efficiency=1.0)

Returns the real intensity and its error at a given energy.

Parameters:
  • energy – energy of interest (in eV).
  • solid_angle – solid angle of the x-ray detector (in steradians)
  • beam_current – beam current of the microscope (in nA)
  • live_time – live time of the x-ray acquisition (in seconds)
  • detector_efficiency – efficiency of the detector
Return type:

Magnitude