Made edits to documentation

This commit is contained in:
2024-07-11 13:42:38 +02:00
parent f04f5eaaf9
commit 2ebe5f3220
2 changed files with 50 additions and 36 deletions

View File

@ -20,13 +20,13 @@ def read_xps_ibw_file_as_dict(filename):
and formats the data into a dictionary with the structure {datasets: list of datasets}. Each dataset in the and formats the data into a dictionary with the structure {datasets: list of datasets}. Each dataset in the
list has the following structure: list has the following structure:
{ {
'name': 'name', 'name': 'name',
'data': data_array, 'data': data_array,
'data_units': 'units', 'data_units': 'units',
'shape': data_shape, 'shape': data_shape,
'dtype': data_type 'dtype': data_type
} }
Parameters Parameters
---------- ----------
@ -42,6 +42,7 @@ def read_xps_ibw_file_as_dict(filename):
------ ------
ValueError ValueError
If the input IBW file is not a valid IBW file. If the input IBW file is not a valid IBW file.
""" """

View File

@ -220,27 +220,33 @@ def transfer_file_dict_to_hdf5(h5file, group_name, file_dict):
""" """
Transfers data from a file_dict to an HDF5 file. Transfers data from a file_dict to an HDF5 file.
Parameters: Parameters
h5file (h5py.File): HDF5 file object where the data will be written. ----------
group_name (str): Name of the HDF5 group where data will be stored. h5file : h5py.File
file_dict (dict): Dictionary containing file data to be transferred. HDF5 file object where the data will be written.
Required structure: group_name : str
Name of the HDF5 group where data will be stored.
file_dict : dict
Dictionary containing file data to be transferred. Required structure:
{
'name': str,
'attributes_dict': dict,
'datasets': [
{ {
'name': str, 'name': str,
'attributes_dict': dict, 'data': array-like,
'datasets': [ 'shape': tuple,
{ 'attributes': dict (optional)
'name': str, },
'data': array-like, ...
'shape': tuple, ]
'attributes': dict (optional) }
},
... Returns
] -------
} None
""" """
if not file_dict: if not file_dict:
return return
@ -273,7 +279,6 @@ def create_hdf5_file_from_filesystem_path(output_filename : str,
root_metadata_dict : dict = {}): root_metadata_dict : dict = {}):
""" """
Creates an .h5 file with name "output_filename" that preserves the directory tree (or folder structure) Creates an .h5 file with name "output_filename" that preserves the directory tree (or folder structure)
of a given filesystem path. of a given filesystem path.
@ -281,20 +286,28 @@ def create_hdf5_file_from_filesystem_path(output_filename : str,
admissible file formats. These, however, can be extended. Directories are groups in the resulting HDF5 file. admissible file formats. These, however, can be extended. Directories are groups in the resulting HDF5 file.
Files are formatted as composite objects consisting of a group, file, and attributes. Files are formatted as composite objects consisting of a group, file, and attributes.
Parameters: Parameters
output_filename (str): Name of the output HDF5 file. ----------
input_file_system_path (str): Path to root directory, specified with forward slashes, e.g., path/to/root. output_filename : str
select_dir_keywords (list): List of string elements to consider or select only directory paths that contain Name of the output HDF5 file.
input_file_system_path : str
Path to root directory, specified with forward slashes, e.g., path/to/root.
select_dir_keywords : list
List of string elements to consider or select only directory paths that contain
a word in 'select_dir_keywords'. When empty, all directory paths are considered a word in 'select_dir_keywords'. When empty, all directory paths are considered
to be included in the HDF5 file group hierarchy. to be included in the HDF5 file group hierarchy.
select_file_keywords (list): List of string elements to consider or select only files that contain a word in select_file_keywords : list
List of string elements to consider or select only files that contain a word in
'select_file_keywords'. When empty, all files are considered to be stored in the HDF5 file. 'select_file_keywords'. When empty, all files are considered to be stored in the HDF5 file.
top_sub_dir_mask (bool): Mask for top-level subdirectories. top_sub_dir_mask : bool
root_metadata_dict (dict): Metadata to include at the root level of the HDF5 file. Mask for top-level subdirectories.
root_metadata_dict : dict
Returns: Metadata to include at the root level of the HDF5 file.
str: Path to the created HDF5 file.
Returns
-------
output_filename : str
Path to the created HDF5 file.
""" """
allowed_file_extensions = list(ext_to_reader_dict.keys()) # list(config_file.select_file_readers(group_id).keys()) allowed_file_extensions = list(ext_to_reader_dict.keys()) # list(config_file.select_file_readers(group_id).keys())