Skip to content
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

122 move the transmission code from areaa repo #123

Merged
merged 24 commits into from
Jan 8, 2025

Conversation

ka-sarthak
Copy link
Collaborator

@ka-sarthak ka-sarthak commented Sep 11, 2024

A plugin for Transmission Spectrophotometry has been developed in collaboration with IKZ (Hiroki Tanaka) in the last few months. It is currently available in the Area A modeling repo here: https://github.com/FAIRmat-NFDI/AreaA-data_modeling_and_schemas/tree/main/transmission/transmission_plugin

This PR aims to add this plugin as a module of nomad-measurements. To this end, the following steps are required:

Some integration steps concerning this plugin moved to a separate issue #151

Summary by Sourcery

Move the transmission code from the Area A repository to the nomad-measurements repository.

New Features:

  • Add a transmission plugin as a module of nomad-measurements.

Tests:

  • Add tests for transmission.

@ka-sarthak ka-sarthak linked an issue Sep 11, 2024 that may be closed by this pull request
@ka-sarthak ka-sarthak marked this pull request as draft September 11, 2024 15:52
@ka-sarthak ka-sarthak force-pushed the 122-move-the-transmission-code-from-areaa-repo branch from 0484c6b to acc30ac Compare September 11, 2024 16:33
@ka-sarthak ka-sarthak self-assigned this Sep 11, 2024
@ka-sarthak ka-sarthak force-pushed the 122-move-the-transmission-code-from-areaa-repo branch from 8a45a55 to e4d4337 Compare September 16, 2024 09:44
@ka-sarthak
Copy link
Collaborator Author

Moved some IKZ specific stuff into the nomad-ikz-plugin. IKZ-Berlin/nomad-ikz-plugin#18

@ka-sarthak ka-sarthak force-pushed the 122-move-the-transmission-code-from-areaa-repo branch 2 times, most recently from 598ca03 to 8f9143f Compare December 20, 2024 21:18
@ka-sarthak
Copy link
Collaborator Author

I have added the current version of the transmission plugin that was presented to the Area A TF on December 2, 2024. Some feedback from the discussions related to the refactoring of the quantities in TransmissionSampleReference has been integrated. Also, I have made a section called CrystallineTransmissionSampleReference which now contains the orientation of the sample surface where the light is incident.

@ka-sarthak
Copy link
Collaborator Author

ka-sarthak commented Dec 20, 2024

TODO

  • The UVVisNirTransmissionSettings.nir_gain sub-section needs further clarification. Currently, the sub-section for populated entries contains data not only for the NIR range but also for other wavelength ranges. Furthermore, gain is more of a general concept. Is it the amplification factor of the signal detected by the detector? Should it be renamed to gain?
    Renamed the sub-section to detector_gain. The gain is a setting for the detector in the Lambda series spectrophotometer: one setting per detector. For generality sake, it's better to have detector_gain setting as a separate subsection than putting it under a given detector. This allows to store multiple gain values for the same detector over different wavelength ranges.
    image
    https://resources.perkinelmer.com/lab-solutions/resources/docs/app_highabsorbancescanninglambda1050950850.pdf

  • Use/move the utils from/to nomad_measurements.utils. Currently, they are in nomad_measurements.transmission.utils

@ka-sarthak ka-sarthak force-pushed the 122-move-the-transmission-code-from-areaa-repo branch from 8460239 to cbfbf56 Compare January 7, 2025 09:45
@ka-sarthak ka-sarthak force-pushed the 122-move-the-transmission-code-from-areaa-repo branch from cbfbf56 to 2b317b3 Compare January 7, 2025 12:32
@ka-sarthak ka-sarthak marked this pull request as ready for review January 7, 2025 13:09
@ka-sarthak
Copy link
Collaborator Author

@hampusnasstrom @aalbino2 Finally ready for your reviews! :)

Copy link

sourcery-ai bot commented Jan 7, 2025

Reviewer's Guide by Sourcery

This pull request moves the transmission code from the Area A repository to the nomad-measurements repository. It copies the schema and parser, moves readers to a new repository, allows for specialization of the plugin, adds tests, and uses CompositeSystem for sample reference.

Class diagram for the Transmission Spectrophotometry data model

classDiagram
    class Measurement {
        <<abstract>>
    }
    class UVVisNirTransmission {
        +str user
        +str method
        +TransmissionSampleReference[] samples
        +UVVisNirTransmissionResult[] results
        +UVVisNirTransmissionSettings transmission_settings
    }
    class UVVisNirTransmissionResult {
        +float[] transmittance
        +float[] absorbance
        +float[] wavelength
        +generate_plots()
    }
    class TransmissionSampleReference {
        +CompositeSystem reference
        +float geometric_path_length
        +float optical_path_length
    }
    class UVVisNirTransmissionSettings {
        +str sample_beam_position
        +float common_beam_mask
        +bool common_beam_depolarizer
        +str detector_module
        +LampSettings[] light_sources
        +AttenuatorSettings attenuator
        +MonochromatorSettings[] monochromators
        +MonochromatorSlitWidth[] monochromator_slit_width
        +DetectorSettings[] detectors
        +DetectorGain[] detector_gain
        +DetectorIntegrationTime[] detector_integration_time
        +Accessory[] accessories
    }

    Measurement <|-- UVVisNirTransmission
    UVVisNirTransmission *-- TransmissionSampleReference
    UVVisNirTransmission *-- UVVisNirTransmissionResult
    UVVisNirTransmission *-- UVVisNirTransmissionSettings
Loading

Class diagram for the Transmission Spectrophotometry instrument model

classDiagram
    class Entity {
        <<abstract>>
    }
    class Instrument {
        <<abstract>>
    }
    class Spectrophotometer {
        +str serial_number
        +str software_version
        +Detector[] detectors
        +Lamp[] light_sources
        +Monochromator[] monochromators
    }
    class Detector {
        +str type
    }
    class LightSource {
        +float power
    }
    class Lamp {
        +str type
    }
    class Monochromator {
    }
    class GratingMonochromator {
        +float groove_density
    }

    Entity <|-- Detector
    Entity <|-- LightSource
    LightSource <|-- Lamp
    Entity <|-- Monochromator
    Monochromator <|-- GratingMonochromator
    Instrument <|-- Spectrophotometer
    Spectrophotometer *-- Detector
    Spectrophotometer *-- Lamp
    Spectrophotometer *-- Monochromator
Loading

File-Level Changes

Change Details Files
Copy the latest schema and parser to src/nomad_measurements/transmission
  • Added schema for transmission spectrophotometry, sample, and measurement.
  • Added parser for transmission data files.
  • Added transmission schema and parser to pyproject.toml
src/nomad_measurements/transmission/schema.py
src/nomad_measurements/transmission/parser.py
pyproject.toml
Move readers to fairmat-readers-transmission
  • Added fairmat-readers-transmission dependency to pyproject.toml
pyproject.toml
Allow for specialization of the plugin
  • Added plugin specialization to allow IKZ to specialize the plugin in their repository
src/nomad_measurements/transmission/schema.py
Add tests for transmission
  • Added tests for transmission spectrophotometry
  • Added test data files
tests/test_transmission.py
tests/data/transmission/3DM_test01.Probe.Raw.asc
tests/data/transmission/F4-P3HT 1-10 0,5 mgml.Probe.Raw.asc
tests/data/transmission/KTF-D.Probe.Raw.asc
tests/data/transmission/Sample5926.Probe.Raw.asc
tests/data/transmission/sphere_test01.Probe.Raw.asc
Use CompositeSystem for sample reference
  • Used CompositeSystem for sample reference, allowing specialization in IKZ plugin for sample classes
src/nomad_measurements/transmission/schema.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ka-sarthak - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/nomad_measurements/transmission/schema.py Show resolved Hide resolved
tests/test_transmission.py Show resolved Hide resolved
tests/test_transmission.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Outdated Show resolved Hide resolved
tests/test_transmission.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/schema.py Show resolved Hide resolved
Copy link
Contributor

@aalbino2 aalbino2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as commented this morning:

  • need for a mechanism to be able so subclass this plugin

additionally:

  • modify the toml of ikz-plugin and ikz-oasis!!

@ka-sarthak
Copy link
Collaborator Author

modify the toml of ikz-plugin and ikz-oasis!!

@aalbino2 Indeed, I made another issue yesterday to track this #151

@ka-sarthak
Copy link
Collaborator Author

need for a mechanism to be able so subclass this plugin

@aalbino2 Will handle this collectively for XRD and transmission in #131

Copy link
Collaborator

@hampusnasstrom hampusnasstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Maybe just add a short description on what files the parser can currently parse. Then you can merge from my side.

src/nomad_measurements/transmission/__init__.py Outdated Show resolved Hide resolved
src/nomad_measurements/transmission/__init__.py Outdated Show resolved Hide resolved
@ka-sarthak ka-sarthak merged commit 5d8cc94 into main Jan 8, 2025
5 checks passed
@ka-sarthak ka-sarthak deleted the 122-move-the-transmission-code-from-areaa-repo branch January 8, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the transmission code from AreaA repo
3 participants