py4sci

Previous topic

calibrate

Next topic

Hosts

This Page

hdf - Functions for Accessing HDF5 Files

Convenience functions that read or write to the HDF5 file

puq.hdf.data_description(hf, var)[source]

Returns the description of an output variable. If the description is empty, returns the variable name.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
puq.hdf.get_output_names(hf)[source]

Returns a list of the output variables names in the HDF5 file.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
Returns:A sorted list of the output variable names in the HDF5 file.
puq.hdf.get_param_names(hf)[source]

Returns a list of the input parameter names in the HDF5 file.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
puq.hdf.get_params(hf)[source]

Returns a list of arrays of input parameter objects.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
puq.hdf.get_params_with_attrs(hf, *args, **kargs)[source]

“get_params2(hf)

Returns a list of tuples containing the parameter name and the attributes dictionary.

Parameters:hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
puq.hdf.get_response(hf, var)[source]

Returns the response function for an output variable.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
puq.hdf.get_result(hf, var=None)[source]

Returns an array containing the values of the output variable.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name. Only required if there is more than one output variable.
Returns:

An array

Raises:

ValueError – if var is not found or var is None and there are multiple output variables.

puq.hdf.get_result_pdf(hf, *args, **kargs)[source]

Same as get_result() except a puq.PDF object is returned.

puq.hdf.get_sensitivity(hf, *args, **kargs)[source]

get_sensitivity(hf, var).

Returns the sensitivity indices for var in a list of tuples. The first element of a tuple is the parameter name, the second element is a dictionary with keys equal to parameter names and values consisting of dictionaries with keys equal to sensitivity indices. E.g., for a Smolyak run

[(<param name>,{‘ustar’:float, ‘std’:float}), ... }

The keys in the sub dictionaries will vary depending on the type of sensitivity analysis (Smolyak or Morris) but will contain at least ‘ustar’ and ‘std’. Morris also contains ‘u’ and ‘ustar_conf95’.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
puq.hdf.param_description(hf, var)[source]

Returns the description of an input variable. If the description is empty, returns the variable name.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Input parameter name.
puq.hdf.set_result(hf, var, data, desc='')[source]

Sets values of the output variable in the HDF5 file. Writes array to ‘/output/data/var‘.

Parameters:
  • hf – An open HDF5 filehandle or a string containing the HDF5 filename to use.
  • var – Output variable name.
  • data – Array of data to write.
  • desc – Description.