Commit 46558b8d authored by Berk Onat's avatar Berk Onat

Modifications for None and numpy passes at Dictionaries and MetaInfoStorage

parent 6f5cedbd
......@@ -1013,46 +1013,46 @@ def get_updateDictionary(self, defname):
value=self.minConverged
),
'number_of_conserved_quantity_evaluations_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_conserved_quantity_frames' : None}
)['frame_sequence_conserved_quantity_frames']
])
)['frame_sequence_conserved_quantity_frames']['val']
)
),
'number_of_frames_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_potential_energy_frames' : None}
)['frame_sequence_potential_energy_frames']
])
)['frame_sequence_potential_energy_frames']['val']
)
),
'number_of_kinetic_energies_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_kinetic_energy_frames' : None}
)['frame_sequence_kinetic_energy_frames']
])
)['frame_sequence_kinetic_energy_frames']['val']
)
),
'number_of_potential_energies_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_potential_energy_frames' : None}
)['frame_sequence_potential_energy_frames']
])
)['frame_sequence_potential_energy_frames']['val']
)
),
'number_of_pressure_evaluations_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
{'frame_sequence_pressure_frames' : None}
)['frame_sequence_pressure_frames']
])
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_pressure_frames' : None}
)['frame_sequence_pressure_frames']['val']
)
),
'number_of_temperatures_in_sequence' : MetaInfoMap(startpage,
value=len([
item for item in self.metaStorage.fetchAttr(
value=(lambda x: np.array(x).flatten().shape[0] if x is not None else None)(
self.metaStorage.fetchAttr(
{'frame_sequence_temperature_frames' : None}
)['frame_sequence_temperature_frames']
])
)['frame_sequence_temperature_frames']['val']
)
),
#'previous_sequence_ref' : MetaInfoMap(startpage)
}
......
......@@ -16,6 +16,8 @@ PUBLIC_META_INFO_PATH = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../../../nomad-meta-info/meta_info/nomad_meta_info/public.nomadmetainfo.json"))
NOTEXCEPT = re.compile(r'[^a-cf-zA-CF-Z!\.?,]')
class Container(object):
"""The container class for nested data storage
"""
......@@ -316,6 +318,7 @@ class Container(object):
newunit = newunit.replace('-','*').replace(' ', '*').replace('^', "**")
for key,value in unitdict.items():
newunit = newunit.replace(str(key), str(value))
NOTEXCEPT.sub('', newunit)
return float(eval(newunit))
def checkTestsDicts(self, item, localdict):
......@@ -393,6 +396,8 @@ class Container(object):
backend.addArrayValues(itemk, value)
elif isinstance(value, (list, tuple)):
backend.addArrayValues(itemk, np.asarray(value))
elif value is None:
pass
else:
backend.addValue(itemk, value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment