Skip to content
Snippets Groups Projects
Commit 2ac3e42e authored by Karim Ahmed's avatar Karim Ahmed
Browse files

remove cal_tools.tools changes

parent 070d574f
Branches fix/manual_edit_conditions
No related tags found
1 merge request!738New calcat interface
...@@ -880,41 +880,6 @@ def save_constant_metadata( ...@@ -880,41 +880,6 @@ def save_constant_metadata(
const_mdata["creation-time"] = None const_mdata["creation-time"] = None
def load_constants_dict(
retrieved_constants: dict,
empty_constants: Optional[dict] = None,
) -> Tuple[dict, dict]:
"""Load constant data from metadata in the
retrieved_constants dictionary.
:param retrieved_constants: A dict. with the constant filepaths and
dataset-name to read the constant data arrays.
{
'Constant Name': {
'file-path': '/gpfs/.../*.h5',
'dataset-name': '/module_name/...',
'creation-time': str(datetime),},
}
:param empty_constants: A dict of constant names keys and
the empty constant array to use in case of not non-retrieved constants.
:return constant_data: A dict of constant names keys and their data.
"""
const_data = dict()
when = dict()
for cname, mdata in retrieved_constants.items():
const_data[cname] = dict()
when[cname] = mdata["creation-time"]
if when[cname]:
with h5py.File(mdata["path"], "r") as cf:
const_data[cname] = np.copy(
cf[f"{mdata['dataset']}/data"])
else:
const_data[cname] = (
empty_constants[cname] if empty_constants else None)
return const_data, when
def load_specified_constants( def load_specified_constants(
retrieved_constants: dict, retrieved_constants: dict,
empty_constants: Optional[dict] = None, empty_constants: Optional[dict] = None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment