Skip to content

Commit

Permalink
Merge pull request #9 from FAIRmat-NFDI/runthrough
Browse files Browse the repository at this point in the history
Fixes detected while preparing the run-through
  • Loading branch information
mkuehbach authored Apr 26, 2024
2 parents 09562cb + 97e640b commit 16b3f51
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 16 deletions.
328 changes: 319 additions & 9 deletions dev-requirements.txt

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 2 additions & 0 deletions pynxtools_apm/concepts/mapping_functors.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ def add_specific_metadata(
if len(entry) == 2:
if not all(isinstance(elem, str) for elem in entry):
continue
if f"{prefix_src}{entry[1]}" not in orgmeta:
continue
if orgmeta[f"{prefix_src}{entry[1]}"] == "":
continue
trg = variadic_path_to_specific_path(
Expand Down
2 changes: 1 addition & 1 deletion pynxtools_apm/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def read(

if len(case.eln) == 1:
print("Parse (meta)data coming from an ELN...")
nx_apm_eln = NxApmNomadOasisElnSchemaParser(case.eln[0], entry_id, True)
nx_apm_eln = NxApmNomadOasisElnSchemaParser(case.eln[0], entry_id)
nx_apm_eln.parse(template)
else:
print("No input file defined for eln data !")
Expand Down
2 changes: 1 addition & 1 deletion pynxtools_apm/utils/load_ranging.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def extract_data_from_rng_file(file_path: str, template: dict, entry_id: int) ->
def extract_data_from_rrng_file(file_path: str, template: dict, entry_id) -> dict:
"""Add those required information which an RRNG file has."""
print(f"Extracting data from RRNG file: {file_path}")
rangefile = ReadRrngFileFormat(file_path)
rangefile = ReadRrngFileFormat(file_path, unique=False)
if len(rangefile.rrng["molecular_ions"]) > np.iinfo(np.uint8).max + 1:
print(WARNING_TOO_MANY_DEFINITIONS)

Expand Down
5 changes: 3 additions & 2 deletions pynxtools_apm/utils/oasis_config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import flatdict as fd
import yaml
import pathlib

from pynxtools_apm.concepts.mapping_functors import add_specific_metadata
from pynxtools_apm.config.oasis_cfg import (
Expand All @@ -36,8 +37,8 @@ def __init__(self, file_path: str, entry_id: int, verbose: bool = False):
f"Extracting data from deployment-specific configuration file: {file_path}"
)
if (
file_path.rsplit("/", 1)[-1].endswith(".oasis.specific.yaml")
or file_path.endswith(".oasis.specific.yml")
pathlib.Path(file_path).name.endswith(".oasis.specific.yaml")
or pathlib.Path(file_path).name.endswith(".oasis.specific.yml")
) and entry_id > 0:
self.entry_id = entry_id
self.file_path = file_path
Expand Down
5 changes: 3 additions & 2 deletions pynxtools_apm/utils/oasis_eln_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import flatdict as fd
import yaml
import pathlib

from ase.data import chemical_symbols
from pynxtools_apm.config.eln_cfg import (
Expand Down Expand Up @@ -59,8 +60,8 @@ class NxApmNomadOasisElnSchemaParser:
def __init__(self, file_path: str, entry_id: int, verbose: bool = False):
print(f"Extracting data from ELN file: {file_path}")
if (
file_path.rsplit("/", 1)[-1].startswith("eln_data")
or file_path.startswith("eln_data")
pathlib.Path(file_path).name.endswith("eln_data.yaml")
or pathlib.Path(file_path).name.endswith("eln_data.yml")
) and entry_id > 0:
self.entry_id = entry_id
self.file_path = file_path
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
dependencies = [
"pynxtools>=0.2.1",
"ifes_apt_tc_data_modeling>=0.2.1",
"ifes_apt_tc_data_modeling>=0.2.2",
]

[project.urls]
Expand Down

0 comments on commit 16b3f51

Please sign in to comment.