Skip to content

Commit a18bca6

Browse files
authored
Merge pull request #592 from FAIRmat-NFDI/fixes_uint_posint_plus_dbg_hint
Fixes uint posint plus dbg hint
2 parents 8cc3e91 + a8efb79 commit a18bca6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/pynxtools/nomad/parser.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
import lxml.etree as ET
2222
import numpy as np
2323

24+
DEBUG_PYNXTOOLS_WITH_NOMAD = False
25+
26+
2427
try:
2528
from ase.data import chemical_symbols
2629
from nomad.atomutils import Formula
@@ -41,9 +44,8 @@
4144
import pynxtools.nomad.schema as nexus_schema
4245
from pynxtools.nexus.nexus import HandleNexus
4346
from pynxtools.nomad.utils import __FIELD_STATISTICS as FIELD_STATISTICS
44-
from pynxtools.nomad.utils import __REPLACEMENT_FOR_NX
47+
from pynxtools.nomad.utils import __REPLACEMENT_FOR_NX, get_quantity_base_name
4548
from pynxtools.nomad.utils import __rename_nx_for_nomad as rename_nx_for_nomad
46-
from pynxtools.nomad.utils import get_quantity_base_name
4749

4850

4951
def _to_group_name(nx_node: ET.Element):
@@ -126,7 +128,7 @@ def _to_section(
126128

127129
def _get_value(hdf_node):
128130
"""
129-
Get value from hdl5 node
131+
Get value from hdf5 node
130132
"""
131133

132134
hdf_value = hdf_node[...]
@@ -520,6 +522,13 @@ def parse(
520522
logger=None,
521523
child_archives: Dict[str, EntryArchive] = None,
522524
) -> None:
525+
if DEBUG_PYNXTOOLS_WITH_NOMAD:
526+
import debugpy # will connect to debugger if in debug mode
527+
528+
debugpy.debug_this_thread()
529+
# now one can anywhere place a manual breakpoint like e.g. so
530+
# debugpy.breakpoint()
531+
523532
self.archive = archive
524533
self.nx_root = nexus_schema.Root() # type: ignore # pylint: disable=no-member
525534

src/pynxtools/nomad/schema.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,15 @@ def get_nx_type(nx_type: str) -> Optional[Datatype]:
329329
"NX_CHAR": m_str,
330330
"NX_BOOLEAN": m_bool,
331331
"NX_INT": m_int64,
332-
"NX_UINT": m_int,
332+
"NX_UINT": m_int64,
333333
"NX_NUMBER": m_float64,
334-
"NX_POSINT": m_int,
334+
"NX_POSINT": m_int64,
335335
"NX_BINARY": Bytes,
336336
"NX_DATE_TIME": Datetime,
337337
"NX_CHAR_OR_NUMBER": m_float64, # TODO: fix this mapping
338338
}
339339

340340
if nx_type in __NX_TYPES:
341-
if nx_type in ("NX_UINT", "NX_POSINT"):
342-
return __NX_TYPES[nx_type](dtype=np.uint64).no_type_check().no_shape_check()
343341
return __NX_TYPES[nx_type]().no_type_check().no_shape_check()
344342
return None
345343

0 commit comments

Comments
 (0)