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

Extending plugin to tandem solar cells #31

Draft
wants to merge 56 commits into
base: main
Choose a base branch
from

Conversation

fabianschoeppach
Copy link
Collaborator

@fabianschoeppach fabianschoeppach commented Nov 13, 2024

PR to track work on issue #8 - extending plugin to tandem solar cells.

Tasks:

  • Schema and parser Entrypoints
  • Schema and parsing of Reference (cf. Ref. section)
    • Population via PublicationReference not working?
  • Schema and parsing of general information (c.f. Tandem. section)
  • Schema and parsing of layer stack,
    each with properties and synthesis information (c.f. NAlayer and)
  • Schema and parsing of measurements and their results
    • target Quantity to reference the state/part which is being measured
  • Schema and parsing of encapsulation
  • Updating to the new Perovskite composition classes (PR Extend Ion Schema #22)
  • Writing pytest and including minimal example
  • Integrate back into src/perovskite_solar_cell_database

@fabianschoeppach fabianschoeppach linked an issue Nov 13, 2024 that may be closed by this pull request
Copy link

sourcery-ai bot commented Nov 13, 2024

Reviewer's Guide by Sourcery

This PR extends the existing plugin to support tandem solar cells by introducing new schema definitions and parsers. The implementation follows a modular approach, defining separate schema packages for different components of tandem solar cells (layers, measurements, references) and a parser to handle Excel-based data input. The schema is designed to capture detailed information about tandem solar cell architectures, including layer stacks, material compositions, and synthesis processes.

Class diagram for Tandem Solar Cell Schema

classDiagram
    class PerovskiteTandemSolarCell {
        +General general
        +Reference reference
        +Layer[] layer_stack
    }

    class General {
        +String architecture
        +int number_of_terminals
        +int number_of_junctions
        +int number_of_cells
        +String[] photoabsorber
        +float[] photoabsorber_bandgaps
        +float area
        +float area_measured
        +bool flexibility
        +bool semitransparent
        +bool contains_textured_layers
        +bool contains_antireflectie_coating
        +SubCell[] subcell
    }

    class Reference {
        +int ID_temp
        +int ID
        +String free_text_comment
        +String name_of_person_entering_the_data
        +bool data_entered_by_author
    }

    class Layer {
        +String name
        +String functionality
        +float thickness
        +float area
        +float surface_roughness
        +String origin
        +String supplier
        +String supplier_brand
        +Cleaning cleaning
        +Synthesis synthesis
        +Storage storage
        +Substance[] additives
    }

    class SubCell {
        +float area
        +bool module
        +bool commercial_unit
        +String supplier
    }

    class Synthesis {
        +SynthesisStep[] steps
    }

    class Cleaning {
        +CleaningStep[] steps
    }

    class Storage {
        +String atmosphere
        +float humidity_relative
        +float time_until_next_step
    }

    class Substance {
        +String name
        +String supplier
        +String purity
        +String concentration
        +float volume
        +float age
        +float temperature
    }

    PerovskiteTandemSolarCell --> General
    PerovskiteTandemSolarCell --> Reference
    PerovskiteTandemSolarCell --> Layer
    General --> SubCell
    Layer --> Cleaning
    Layer --> Synthesis
    Layer --> Storage
    Layer --> Substance
Loading

Class diagram for Tandem Parser

classDiagram
    class TandemParser {
        +parse(String mainfile, EntryArchive archive, BoundLogger logger, dict child_archives)
    }

    class EntryArchive {
        +data
    }

    TandemParser --> EntryArchive
    TandemParser : +parse()
    TandemParser : -cleanup_dataframe()
    TandemParser : -split_data()
    TandemParser : -convert_value()
    TandemParser : -partial_get()
    TandemParser : -exact_get()
    TandemParser : -extract_cleaning()
    TandemParser : -extract_additives()
    TandemParser : -extract_solvents()
    TandemParser : -extract_reactants()
    TandemParser : -extract_quenching_solvents()
    TandemParser : -extract_perovskite_composition()
    TandemParser : -extract_chalcopyrite_composition()
    TandemParser : -extract_alkali_doping()
    TandemParser : -extract_annealing()
    TandemParser : -extract_storage()
    TandemParser : -extract_reference()
    TandemParser : -extract_general()
    TandemParser : -extract_layer_stack()
Loading

File-Level Changes

Change Details Files
Added new schema package for tandem solar cells
  • Created base schema class PerovskiteTandemSolarCell with general information, reference, and layer stack sections
  • Defined comprehensive layer hierarchy (Layer, NonAbsorbingLayer, PhotoAbsorber, etc.)
  • Implemented material-specific layer classes (PerovskiteLayer, SiliconLayer, ChalcopyriteLayer)
  • Added support for composition tracking (ions, dopants, additives)
src/perovskite_tandem_database/schema_packages/schema.py
src/perovskite_tandem_database/schema_packages/tandem.py
Implemented Excel parser for tandem solar cell data
  • Created TandemParser class to handle Excel file parsing
  • Added support for extracting layer stack information
  • Implemented parsing of synthesis steps and cleaning procedures
  • Added utilities for data cleaning and value conversion
src/perovskite_tandem_database/parsers/tandemparser.py
src/perovskite_tandem_database/parsers/utils.py
Set up plugin entry points and package structure
  • Added parser entry point for Excel files
  • Created schema package entry point for tandem solar cells
  • Updated pyproject.toml with new entry points
pyproject.toml
src/perovskite_tandem_database/parsers/__init__.py
src/perovskite_tandem_database/schema_packages/__init__.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

@fabianschoeppach fabianschoeppach self-assigned this Nov 13, 2024
@fabianschoeppach fabianschoeppach added the enhancement New feature or request label Nov 13, 2024
- fix label for ThermalAnnealing
- discard nan-containing annealing processes
- fix overwriting SynthesisSteps
- fix several defaultDisplayUnits
@fabianschoeppach fabianschoeppach force-pushed the 8-fabian-tandem-cells-schema branch from a2adb4e to a011afe Compare November 21, 2024 16:25
src/perovskite_tandem_database/schema_packages/ref.py Outdated Show resolved Hide resolved
),
description='The type of silicon used in the layer',
)
doping_sequence = Quantity(
Copy link
Contributor

Choose a reason for hiding this comment

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

Sometimes I get Silicon repeated as multiple layers and I think the only thing that seems to change is the doping sequence. Is this intended or should teh doping sequence be of shape '*'?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Some other layers parsed here are also weird, see for example this from tandem_4, where layer 4 and layer 11 appeared there

image

Copy link
Collaborator Author

@fabianschoeppach fabianschoeppach Nov 22, 2024

Choose a reason for hiding this comment

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

Good catch. These both looks like bugs in the parser.

  • Empty Layers
  • Merge Silicon into single Layer

src/perovskite_tandem_database/schema_packages/ref.py Outdated Show resolved Hide resolved
Substrate,
)

from .ref import Reference
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using relative imports for any specific reason here?

Copy link
Collaborator Author

@fabianschoeppach fabianschoeppach Nov 22, 2024

Choose a reason for hiding this comment

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

No. I wasn't aware of the difference that makes.
So you would always go for absolute imports even within the same package?

)


class PerovskiteComposition(ArchiveSection):
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this can be replaced with the new PerovskiteComposition Section. We will need to make sure that bthe normalizer work also in the case one more than one perovksite is present in the tandem device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Draft of tandem database schema
2 participants