hdf5_picker
– Pick results in HDF5 from Apollo3
This module is designed to pick the required results from an Apollo3 standard HDF5 output file. This means that the users should already know which result they want to extract. Some navigation methods exist, but they are not optimised for speed of access.
One possibility is to first explore the output file interactively with a
Reader
, and then to write the efficient code using
Picker
.
Picking results with Picker
from valjean.eponine.apollo3.hdf5_picker import Picker
ap3p = Picker('MON_FICHIER.hdf')
rate_ds = ap3p.pick_standard_value(output='OUTPUT_FOLDER',
zone='ZONE_FOLDER',
result_name='REQUIRED_RESULT')
For example to get the keff, in output_1
under totaloutput
:
keff = ap3p.pick_standard_value(output='output_1', zone='totaloutput',
result_name='KEFF')
The result will be a Dataset
. The error is
not available and it is set to numpy.nan
by default. It can be changed
using the error_value
to the Picker
constructor.
In the case of a rates file, bins are set to groups index in most cases. When
the quantity is also calculated on anisotropies (e.g. diffusion) the bins are
('anisotropies', 'groups')
. The surfacic flux ('SURFFLUX'
) bins are
('groups', 'surfaces')
and the current ('CURRENT'
) ones are
('groups', 'surfaces', 'direction')
.
Results per isotopes can be obtained with an additional keyword argument, for
example for 10B absorption in output_0
from zone 5
:
b10abs = ap3p.pick_standard_value(output='output_0', zone='5',
result_name='Absorption', isotope='B10')
Macroscopic rates are obtained with isotope='macro'
.
Local values can also be retrived using the
Picker.pick_user_value
method:
if
'LOCALNAME'
and'LOCALVALUE'
belong to zone names:locv = ap3p.pick_user_value(output='output', zone=None, result_name='LOCAL_VALUE_NAME')
if
'LOCALNAME'
and'LOCALVALUE'
belong to result names in a zone:locv = ap3p.pick_user_value(output='output', zone='totaloutput', result_name='LOCAL_VALUE_NAME')
if
'localvalue'
belongs to zone names:locv = ap3p.pick_user_value(output='output', zone='localvalue', result_name='LOCAL_VALUE_NAME')
In both cases, it might be useful to check the zones and the local names first.
Quick exploration with Picker
Some helpers exist if needed:
Picker.outputs
: list of output foldersPicker.geometry
: list of geometries stored in a given output folderPicker.nb_groups
: number of energy groups available in a given output folderPicker.zones
: list of zones in a given output folderPicker.isotopes
: list of isotopes in a given zone of a given output folderPicker.results
: list of available results in a given zone of a given output folder, isotope can be precised if neededPicker.nb_anisotropies
: number of anisotropies available for a given result for the considered isotope in its zone and outputPicker.local_names
: list of names of the local values stored in a given zone from a given output folder
- class valjean.eponine.apollo3.hdf5_picker.Picker(fname, error_value=nan)[source]
Pick selected values from an Apollo3 HDF5 file.
- __init__(fname, error_value=nan)[source]
Initialize the
Picker
object and read the HDF5 file.- Parameters:
fname (str) – path to the Apollo3 HDF5 ouput file
error_value – value to give to the error (default:
numpy.nan
)
- geometry_from_geomid(*, geometry)[source]
Return geometry as a dictionary of zone names and volumes.
- Parameters:
geometry (str) – geometry name
- geometry(*, output)[source]
Return geometry characteristics (zones and their volumes) from the output name.
- results(*, output, zone, isotope=None)[source]
Return available results for the given configuration.
The ‘info’ group is not considered as a result (group containing the number of anisotropies), so it is omitted from of the results list.
- nb_anisotropies(*, output, zone, isotope, result)[source]
Return number of anisotropies for the given configuration.
- Parameters:
- Return type:
- pick_standard_value(*, output, zone, result_name, isotope=None)[source]
Pick a result according to required parameters from a standard file (like keff, flux or rate).
- local_names(*, output, zone)[source]
Return the list of available local value names.
Note
The most common zones seem to be in this case: ‘totaloutput’ (especially in rates files), None or ‘localvalue’ in core files.