mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-03 10:06:01 +01:00
adapt consistency check of array dimensions for dim type
This commit is contained in:
parent
0167a53d50
commit
72c8d01f34
@ -465,7 +465,7 @@ def get_detailed_num_dict (configuration: dict) -> dict:
|
|||||||
configuration (dict) : configuration from `trex.json`
|
configuration (dict) : configuration from `trex.json`
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
num_dict (dict) : dictionary of num-suffixed variables
|
num_dict (dict) : dictionary of all numerical attributes (of types int, float, dim)
|
||||||
"""
|
"""
|
||||||
num_dict = {}
|
num_dict = {}
|
||||||
for k1,v1 in configuration.items():
|
for k1,v1 in configuration.items():
|
||||||
@ -673,7 +673,7 @@ def check_dim_consistency(num: dict, dset: dict) -> None:
|
|||||||
Consistency check to make sure that each dimensioning variable exists as a num attribute of some group.
|
Consistency check to make sure that each dimensioning variable exists as a num attribute of some group.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
num (dict) : dictionary of num-suffixed variables
|
num (dict) : dictionary of numerical attributes
|
||||||
dset (dict) : dictionary of datasets
|
dset (dict) : dictionary of datasets
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -686,6 +686,8 @@ def check_dim_consistency(num: dict, dset: dict) -> None:
|
|||||||
if dim not in dim_tocheck:
|
if dim not in dim_tocheck:
|
||||||
dim_tocheck.append(dim)
|
dim_tocheck.append(dim)
|
||||||
|
|
||||||
|
num_onlyDim = [attr_name for attr_name, specs in num.items() if specs['trex_json_int_type']=='dim']
|
||||||
|
|
||||||
for dim in dim_tocheck:
|
for dim in dim_tocheck:
|
||||||
if not dim in num.keys():
|
if not dim in num_onlyDim:
|
||||||
raise ValueError(f"Dimensioning variable {dim} is not a num attribute of any group.\n")
|
raise ValueError(f"Dimensioning variable {dim} is not a num attribute of any group.\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user