f4enix.output.rssa.rssa.RSSA#

class f4enix.output.rssa.rssa.RSSA(parameters: FileParameters, tracks: DataFrame)#

Bases: object

Representation of a RSSA file.

Variables:
  • parameters (FileParameters) –

    Parameters extracted from the RSSA file header.

    np1 # Number of histories of the simulation, given as a negative number nrss # Number of tracks recorded nrcd # Number of values recorded for each particle, it should be 11 njsw # Number of surfaces in JASW niss # Number of different histories that reached the SSW surfaces niwr # Number of cells in RSSA file mipts # Source particle type kjaq # Flag for macrobodies surfaces surfaces

  • tracks (pl.DataFrame) –

    DataFrame containing the tracks recorded in the RSSA file.

    Each row of the table has 11 values 0 a, # History number of the particle, negative if uncollided 1 b, # Packed variable, the sign is the sign of the third direction cosine

    # starts with 8 = neutron, 16 = photon

    2 wgt, 3 erg, 4 tme, 5 x, 6 y, 7 z, 8 u, # Particle direction cosine with X-axis 9 v, # Particle direction cosine with Y-axis, to calculate w (Z-axis) use

    # the sign from b

    10 c # Surface id

Examples

>>> from f4enix.output.rssa import RSSA
... my_rssa = RSSA.read_from_file('small_cyl.w')
... print(my_rssa)
RSSA file small_cyl.w was recorded using the following surfaces:
  Surface ID: 1, type: 1
The total number of tracks recorded is 72083.
Neutrons: 72083 photons: 0.
The simulation that produced this RSSA run 100000 histories.
The amount of independent histories that reached the RSSA surfaces was 70797.

Methods

__init__(parameters, tracks)

get_summary()

Returns a summary of the RSSA file.

load_from_saved_files(directory)

Loads the RSSA from the JSON and parquet files generated by save_to_files()

plot_cyl()

Returns an instance of RSSAPlotCyl to plot data asuming a cylindrical geometry with an axis following the Z-coordinate axis.

plot_plane()

Returns an instance of RSSAPlot to plot data assuming an XY plane.

plot_spectra()

Returns an instance of RSSASpectraPlot to plot energy spectra.

read_from_file(path)

Loads the RSSA file from the given path as generated by MCNP.

save_to_files(output_dir)

Saves the RSSA as two files: a JSON file with the file parameters and a parquet file with the tracks DataFrame.

Attributes

energies

Returns the energies of the tracks.

histories

Returns the history numbers of the tracks.

neutron_tracks

Returns the neutron tracks from the RSSA file.

photon_tracks

Returns the photon tracks from the RSSA file.

wgt

Returns the weights of the tracks.

x

Returns the x coordinates of the tracks.

y

Returns the y coordinates of the tracks.

z

Returns the z coordinates of the tracks.

parameters

tracks

property energies: Series#

Returns the energies of the tracks.

get_summary() str#

Returns a summary of the RSSA file.

property histories: Series#

Returns the history numbers of the tracks.

static load_from_saved_files(directory: Path | str) RSSA#

Loads the RSSA from the JSON and parquet files generated by save_to_files()

Parameters:

directory (Path | str) – Directory where the parameters.json and tracks.parquet files are located

property neutron_tracks: DataFrame#

Returns the neutron tracks from the RSSA file.

property photon_tracks: DataFrame#

Returns the photon tracks from the RSSA file.

plot_cyl() RSSAPlot#

Returns an instance of RSSAPlotCyl to plot data asuming a cylindrical geometry with an axis following the Z-coordinate axis.

plot_plane() RSSAPlot#

Returns an instance of RSSAPlot to plot data assuming an XY plane.

plot_spectra() RSSASpectraPlot#

Returns an instance of RSSASpectraPlot to plot energy spectra. If set_perimeter_limits() is used and there is no perimeter_pos column, the perimeter position will be calculated assuming a cylindrical geometry with an axis following the Z-coordinate axis.

static read_from_file(path: Path | str) RSSA#

Loads the RSSA file from the given path as generated by MCNP.

save_to_files(output_dir: Path | str) None#

Saves the RSSA as two files: a JSON file with the file parameters and a parquet file with the tracks DataFrame.

property wgt: Series#

Returns the weights of the tracks.

property x: Series#

Returns the x coordinates of the tracks.

property y: Series#

Returns the y coordinates of the tracks.

property z: Series#

Returns the z coordinates of the tracks.