Skip to content
Snippets Groups Projects
Commit be882037 authored by Vadim Gubaidulin's avatar Vadim Gubaidulin
Browse files

Changed the way the data is recorded to avoid memory errors (no reading of already stored data)

parent d6bfb15d
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,41 @@ class AbstractDevice():
instantiated directly. Please subclass it and implement the required \
methods.")
# def _update_dataset(self, file, data_dict, group_name):
# """
# Helper function to update a dataset in the HDF5 file.
#
# Parameters
# ----------
# file : h5py.File
# The HDF5 file object.
# dataset_name : str
# Name of the dataset to update.
# data_func : dict
# Function that returns the data to be saved.
# """
# with hp.File(file, 'a') as file:
# if group_name not in file:
# file.create_group(group_name)
#
# # Access the group
# group = file[group_name]
# for key, value in data_dict.items():
# if np.isscalar(value):
# new_data = np.array([[value]])
# else:
# new_data = np.expand_dims(np.array(value), axis=0)
#
# if key in group:
# # If the dataset already exists, append the new data
# existing_data = np.array(group[key])
# updated_data = np.concatenate((existing_data, new_data))
# del group[key]
# group[key] = updated_data
# else:
# # Create the dataset if it doesn't exist, with one one
# # dimension (to concatenate future data)
# group[key] = new_data
def _update_dataset(self, file, data_dict, group_name):
"""
Helper function to update a dataset in the HDF5 file.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment