PSF Module

penred phase space file module

pyPenred.psf.getDistribution(filename: str, emin: SupportsFloat | SupportsIndex = 0.0, emax: SupportsFloat | SupportsIndex = 1000000000.0, ebins: SupportsInt | SupportsIndex = 1, xmin: SupportsFloat | SupportsIndex = -1e+30, xmax: SupportsFloat | SupportsIndex = 1e+30, xbins: SupportsInt | SupportsIndex = 1, ymin: SupportsFloat | SupportsIndex = -1e+30, ymax: SupportsFloat | SupportsIndex = 1e+30, ybins: SupportsInt | SupportsIndex = 1, zmin: SupportsFloat | SupportsIndex = -1e+30, zmax: SupportsFloat | SupportsIndex = 1e+30, zbins: SupportsInt | SupportsIndex = 1, cos_bins: SupportsInt | SupportsIndex = 1, save_files: bool = False, extract_info: bool = True, only_effective: bool = True) → tuple

Extracts the energy spectrum distribution of the particles from a Phase Space File.

Parameters:
  • filename (str) – Path to the Phase Space File.

  • emin (float) – Lower energy bound in eV (must be >= 0).

  • emax (float) – Upper energy bound in eV (must be > emin).

  • ebins (unsigned) – Number of linear-spaced energy bins between emin and emax.

  • xmin (float) – Lower spatial bound along the X-axis.

  • xmax (float) – Upper spatial bound along the X-axis.

  • xbins (unsigned) – Number of linear-spaced spatial bins along the X-axis.

  • ymin (float) – Lower spatial bound along the Y-axis.

  • ymax (float) – Upper spatial bound along the Y-axis.

  • ybins (unsigned) – Number of linear-spaced spatial bins along the Y-axis.

  • zmin (float) – Lower spatial bound along the Z-axis.

  • zmax (float) – Upper spatial bound along the Z-axis.

  • zbins (unsigned) – Number of linear-spaced spatial bins along the Z-axis.

  • cos_bins (unsigned) – Number of linear-spaced cosinus bins between -1 and 1.

  • save_files (bool) – If enabled, the distribution is saved in a file named ‘psf-distribution.dat’.

  • extract-info (bool) – If enabled, the limits and dimensions information will be returned along with results values.

  • only_effective (bool) – If enabled, dimensions with a single bin are ignored, reducing the result’s dimension.

Returns:

A tuple containing four tuples in the following order: energy bin edges, electron, gamma and positron spectrum.

Return type:

tuple

Example

# Read the Phase space File and store the results
        results = pyPenred.psf.psfSpectre('psf.dat', 0, 7e5, 200)
pyPenred.psf.psf2ascii(filenameIn: str, filenameOut: str) → tuple

Converts the binary Phase Space File into an ASCII file format.

Parameters:
  • filenameIn (str) – Path to the Phase Space File.

  • filenameOut (str) – Path to the converted Phase Space File into an ASCII format.

Returns:

A tuple containing the number of histories in the Phase Space File and the number of particle chuncks.

Return type:

tuple

Example

# Read the Phase space File and store the results
        results = pyPenred.psf.psf2ascii('psf.dat', 'psfASCII.dat')
pyPenred.psf.psfSpectre(filename: str, emin: SupportsFloat | SupportsIndex, emax: SupportsFloat | SupportsIndex, nbins: SupportsInt | SupportsIndex) → tuple

Extracts the energy spectrum distribution of the particles from a Phase Space File.

Parameters:
  • filename (str) – Path to the Phase Space File.

  • emin (float) – Lower bound of energy range in eV (must be >= 0).

  • emax (float) – Upper bound of energy range in eV (must be > emin).

  • nbins (unsigned) – Number of linear-spaced energy bins between emin and emax.

Returns:

A tuple containing four tuples in the following order: energy bin edges, electron, gamma and positron spectrum.

Return type:

tuple

Example

# Read the Phase space File and store the results
        results = pyPenred.psf.psfSpectre('psf.dat', 0, 7e5, 200)