Skip to content

Commit

Permalink
No inner sections (#525)
Browse files Browse the repository at this point in the history
* use pynxtools.nomad.schema.Root

* not using inner sections

* fix for doc links if name contains _

* fix format

* linting

* fixing tests

* fixing mime-type for WSL

* fix for handling raw files in subdirectories

* use references in steps, and results in NexusMeasurement

* make nexus attributes searchable by importing them to NOMAD as Quantities

* temporary fix for boolean array as signals or axes - show first element as the field value

* handling arrays of strings

* handling attribute if it is an array of numbers

* fix for handling bool (arrays) coming from hdf5

* add array size and ndim as attributes (#537)

* field statistics are now searchable quantities themselves

* NexusBaseSection for registering NeXUs Group instance names as searchable quantity <name>

* fix for registering stats

* searcable __name for variadic quantities

* bringing statistic definitions to a common place

* Update src/pynxtools/nomad/parser.py

Co-authored-by: Lukas Pielsticker <[email protected]>

* Update src/pynxtools/nomad/schema.py

Co-authored-by: Lukas Pielsticker <[email protected]>

* use mapping instead of if/elif-s

* manage std instead of var

* fix for ganareting __name/stat quantities

* fix for handling attributes

* ruffing

* ruffing

* linting

* fix for tests

* adjust to nomad's python requirement

---------

Co-authored-by: GinzburgLev <[email protected]>
Co-authored-by: Laurenz Rettig <[email protected]>
Co-authored-by: Lukas Pielsticker <[email protected]>
  • Loading branch information
4 people authored Feb 14, 2025
1 parent d3b15e2 commit e985c92
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install coverage coveralls
- name: Install nomad
if: "${{ matrix.python_version != '3.8'}}"
if: "${{ matrix.python_version != '3.8' && matrix.python_version != '3.9'}}"
run: |
uv pip install nomad-lab[infrastructure]@git+https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR.git
- name: Install pynx
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ regex==2024.11.6
# via mkdocs-material
requests==2.32.3
# via mkdocs-material
ruff==0.9.3
ruff==0.9.6
# via pynxtools (pyproject.toml)
scipy==1.14.1
# via ase
Expand Down
24 changes: 17 additions & 7 deletions src/pynxtools/nomad/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def load(self):
name="pynxtools parser",
description="A parser for nexus files.",
mainfile_name_re=r".*\.nxs",
mainfile_mime_re="application/x-hdf5",
mainfile_mime_re="application/x-hdf*",
)

from nomad.config.models.ui import (
Expand All @@ -76,7 +76,7 @@ def load(self):
SearchQuantities,
)

schema = "pynxtools.nomad.schema.NeXus"
schema = "pynxtools.nomad.schema.Root"

nexus_app = AppEntryPoint(
name="NexusApp",
Expand Down Expand Up @@ -105,17 +105,17 @@ def load(self):
Column(quantity=f"entry_type", selected=True),
Column(
title="definition",
quantity=f"data.*.ENTRY[*].definition__field#{schema}",
quantity=f"data.ENTRY[*].definition__field#{schema}",
selected=True,
),
Column(
title="start_time",
quantity=f"data.*.ENTRY[*].start_time__field#{schema}",
quantity=f"data.ENTRY[*].start_time__field#{schema}",
selected=True,
),
Column(
title="title",
quantity=f"data.*.ENTRY[*].title__field#{schema}",
quantity=f"data.ENTRY[*].title__field#{schema}",
selected=True,
),
],
Expand Down Expand Up @@ -161,8 +161,8 @@ def load(self):
"autorange": True,
"nbins": 30,
"scale": "linear",
"quantity": f"data.Root.datetime#{schema}",
"title": "Procesing Time",
"quantity": f"data.ENTRY.start_time__field#{schema}",
"title": "Start Time",
"layout": {
"lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 0, "x": 0}
},
Expand All @@ -177,6 +177,16 @@ def load(self):
"lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 12}
},
},
{
"type": "terms",
"show_input": False,
"scale": "linear",
"quantity": f"data.ENTRY.definition__field#{schema}",
"title": "Definition",
"layout": {
"lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 16}
},
},
{
"type": "periodic_table",
"scale": "linear",
Expand Down
Loading

0 comments on commit e985c92

Please sign in to comment.