-
Notifications
You must be signed in to change notification settings - Fork 10
Transmission reader #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ebc09f4
Skeleton for transmission parser
domna c2f379f
Adds reading functionality to transmission reader
domna 0df737b
Updates transmission reader to write valid file for example
domna c1dfd3c
Adds metadata parsing from asc file for transmission reader
domna 67b9f11
Adds more transmission metadata parsers and example data
domna f99b07d
Updates action to install exactly astroid 2.5.1
domna a6ac7a7
Fixes pylinting and tests
domna 5f62d64
Correctly imports Mapping
domna b822326
Adds docstrings to transmission reader
domna 06b1669
Corrections in how to write a reader readme
domna 127bbdc
Adds reading of detector values to transmission reader
domna f3f6750
Uses pre-set min/max wavelengths in transmission parser
domna 14073f7
Updates nexus_definitions submodule
domna 8e776e9
Use the same pandas version as nomad
domna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
There are no files selected for viewing
This file contains hidden or 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
Submodule definitions
updated
14 files
This file contains hidden or 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 hidden or 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
Empty file.
64 changes: 64 additions & 0 deletions
64
nexusparser/tools/dataconverter/readers/transmission/metadata_parsers.py
This file contains hidden or 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,64 @@ | ||
# | ||
# 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. | ||
# | ||
"""Functions for reading metadata values from Perkin Ellmer files""" | ||
from datetime import datetime | ||
|
||
# The min & max wavelength the instrument can measure | ||
MIN_WAVELENGTH = 190. | ||
MAX_WAVELENGTH = 3350. | ||
|
||
|
||
def read_start_date(metadata: list) -> str: | ||
"""Reads the start date from the metadata""" | ||
century = str(datetime.now().year // 100) | ||
formated_date = metadata[3].replace("/", "-") | ||
return f"{century}{formated_date}T{metadata[4]}000Z" | ||
|
||
|
||
def read_sample_attenuator(metadata: list) -> int: | ||
"""Reads the sample attenuator from the metadata""" | ||
return int(metadata[47].split()[0].split(":")[1]) | ||
|
||
|
||
def read_ref_attenuator(metadata: list) -> int: | ||
"""Reads the sample attenuator from the metadata""" | ||
return int(metadata[47].split()[1].split(":")[1]) | ||
|
||
|
||
def read_uv_monochromator_range(metadata: list) -> list: | ||
"""Reads the uv monochromator range from the metadata""" | ||
monochromator_change = float(metadata[41]) | ||
return [MIN_WAVELENGTH, monochromator_change] | ||
|
||
|
||
def read_visir_monochromator_range(metadata: list) -> list: | ||
"""Reads the visir monochromator range from the metadata""" | ||
monochromator_change = float(metadata[41]) | ||
return [monochromator_change, MAX_WAVELENGTH] | ||
|
||
|
||
def get_d2_range(metadata: list) -> list: | ||
"""Reads the D2 lamp range from the metadata""" | ||
lamp_change = float(metadata[42]) | ||
return [MIN_WAVELENGTH, lamp_change] | ||
|
||
|
||
def get_halogen_range(metadata: list) -> list: | ||
"""Reads the halogen lamp range from the metadata""" | ||
lamp_change = float(metadata[42]) | ||
return [lamp_change, MAX_WAVELENGTH] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.