-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from IKZ-Berlin/transmission-backcompatibility
Add new and old transmission schemas
- Loading branch information
Showing
27 changed files
with
9,328 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow will install Python dependencies, run tests, and lint with multiple version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
UV_SYSTEM_PYTHON: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python_version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{matrix.python_version}} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python_version}} | ||
- name: Install uv | ||
run: | | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
- name: Install dependencies | ||
run: | | ||
uv pip install -e '.[dev]' | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins: | ||
exclude: | ||
- nomad_measurements.transmission:parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Copyright The NOMAD Authors. | ||
# | ||
# This file is part of NOMAD. See https://nomad-lab.eu for further info. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
from typing import TYPE_CHECKING | ||
|
||
from nomad.parsing import MatchingParser | ||
from nomad_measurements.transmission.schema import RawFileTransmissionData | ||
from nomad_measurements.utils import create_archive | ||
|
||
from nomad_ikz_plugin.characterization.schema import IKZELNUVVisNirTransmission | ||
|
||
if TYPE_CHECKING: | ||
from nomad.datamodel.datamodel import ( | ||
EntryArchive, | ||
) | ||
|
||
|
||
class TransmissionParser(MatchingParser): | ||
""" | ||
Parser for matching files from Transmission Spectrophotometry and | ||
creating instances of ELN. | ||
""" | ||
|
||
def parse( | ||
self, mainfile: str, archive: 'EntryArchive', logger=None, child_archives=None | ||
) -> None: | ||
data_file = mainfile.split('/')[-1] | ||
entry = IKZELNUVVisNirTransmission.m_from_dict( | ||
IKZELNUVVisNirTransmission.m_def.a_template | ||
) | ||
entry.data_file = data_file | ||
file_name = f'{".".join(data_file.split(".")[:-1])}.archive.json' | ||
archive.data = RawFileTransmissionData( | ||
measurement=create_archive(entry, archive, file_name) | ||
) | ||
archive.metadata.entry_name = f'{data_file} data file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.