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 folders

  • Picker.geometry: list of geometries stored in a given output folder

  • Picker.nb_groups: number of energy groups available in a given output folder

  • Picker.zones: list of zones in a given output folder

  • Picker.isotopes: list of isotopes in a given zone of a given output folder

  • Picker.results: list of available results in a given zone of a given output folder, isotope can be precised if needed

  • Picker.nb_anisotropies: number of anisotropies available for a given result for the considered isotope in its zone and output

  • Picker.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)

close()[source]

Close HDF5 file.

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.

Parameters:

output (str) – output in which zones will be found

Return type:

dict

nb_groups(*, output)[source]

Return the number of groups for the output.

Parameters:

output (str) – output in which zones will be found

Return type:

int

outputs()[source]

Return list of available outputs.

Return type:

list(str)

zones(*, output)[source]

Return list of available zones in output.

Parameters:

output (str) – output in which zones will be found

Return type:

list(str)

isotopes(*, output, zone)[source]

Return list of available isotopes in zone from output.

Parameters:
  • output (str) – output folder considered

  • zone (str) – zone from output folder

Return type:

list(str)

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.

Parameters:
  • output (str) – output folder considered

  • zone (str) – zone from the output folder

  • isotope (str or None) – isotope considered for results (‘macro’ is counted as an isotope, if no isotope is given global results are given like flux or keff)

Return type:

list(str)

nb_anisotropies(*, output, zone, isotope, result)[source]

Return number of anisotropies for the given configuration.

Parameters:
  • output (str) – output folder considered

  • zone (str) – zone from the output folder

  • isotope (str or None) – isotope considered for results (‘macro’ is counted as an isotope, if no isotope is given global results are given like flux or keff)

  • result (str) – result considered

Return type:

list(str)

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.

Parameters:
  • output (str) – output folder considered

  • zone (str or None) – zone from the output folder

Return type:

list(str)

pick_value_from_index(*, output, result_index, zone, name)[source]

Pick a user value result from required parameters.

Parameters:
  • output (str) – output folder considered

  • result_index (int) – index of the required result

  • zone (str) – zone from the output folder

Return type:

Dataset

pick_user_value(*, output, result_name, zone)[source]

Pick a user value result from required parameters (under local value in the file).

Parameters:
  • output (str) – output folder considered

  • result_name (str) – name of the required result

  • zone (str) – zone from the output folder

Return type:

Dataset

exception valjean.eponine.apollo3.hdf5_picker.PickerException[source]

An error that may be raised by the Picker class.