Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed checks #84

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions atomisticparsers/h5md/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
import h5py

from typing import List, Dict
from typing import List, Dict, Union, Any
from h5py import Group

from nomad.datamodel import EntryArchive
Expand Down Expand Up @@ -72,9 +72,9 @@ def apply_unit(self, quantity, unit: str, unit_factor: float):
if quantity is None:
return
if unit:
unit = ureg(unit)
unit *= unit_factor
quantity *= unit
unit_val = ureg(unit)
unit_val *= unit_factor
quantity *= unit_val

return quantity

Expand Down Expand Up @@ -400,7 +400,7 @@ def get_observable_paths(observable_group: Dict, current_path: str) -> List:

def parse_atomsgroup(
self,
nomad_sec: System or AtomsGroup,
nomad_sec: Union[System, AtomsGroup],
h5md_sec_particlesgroup: Group,
path_particlesgroup: str,
):
Expand Down Expand Up @@ -454,7 +454,7 @@ def parse_parameter_info(self):
self._parameter_info = {"force_calculations": {}, "workflow": {}}

def get_parameters(parameter_group: Group, path: str) -> Dict:
param_dict = {}
param_dict: Dict[Any, Any] = {}
for key, val in parameter_group.items():
path_key = f"{path}.{key}"
if isinstance(val, h5py.Group):
Expand Down Expand Up @@ -713,14 +713,14 @@ def populate_property_dict(
)
property_dict[f"{val_name}_magnitude"] = value_magnitude

workflow_properties_dict = {}
workflow_properties_dict: Dict[Any, Any] = {}
for observable_type, observable_dict in observables.items():
flag_known_property = False
if observable_type in properties_known:
property_type_key = observable_type
property_type_value_key = properties_known[observable_type]
flag_known_property = True
property_dict = {property_type_value_key: []}
property_dict: Dict[Any, Any] = {property_type_value_key: []}
property_dict["label"] = observable_type
for key, observable in observable_dict.items():
property_values_dict = {"label": key}
Expand Down
Loading