nomad-hzb / hzb-combinatorial-libraries-plugin

Apache License 2.0
0 stars 0 forks source link

Some improvements in Quantities and section definitions #4

Open Pepe-Marquez opened 3 months ago

Pepe-Marquez commented 3 months ago

Some suggestions for quantities and descriptions:

class PixelProperties(ArchiveSection):
    """
    A set of properties derived for a pixel being part of a combinatorial library.
    """

    m_def = Section(categories=[UnoldLabCategory], label='UnoldPixelProperties')

    thickness = Quantity(
        type=np.dtype(np.float64),
        unit='cm',
        shape=[],
        description="""
            The thickness of the investigated layer in the pixel.
            """,
        a_eln=dict(
            component='NumberEditQuantity',
            defaultDisplayUnit='mm',
        ),
    )
    conductivity = Quantity(
        type=np.dtype(np.float64),
        unit='S/cm',
        shape=[],
        description="""
                The conductivity of the investigated layer in the pixel.
                """,
        a_eln=dict(
            component='NumberEditQuantity',
            defaultDisplayUnit='S/cm',
        ),
    )
    # sheet_resistance = Quantity(
    #     type=np.dtype(np.float64),
    #     unit='Ohm/sq',
    #     shape=[],
    #     description="""
    #             The sheet resistance of the investigated layer in the pixel.
    #             """,
    #     a_eln=dict(
    #         component='NumberEditQuantity',
    #         defaultDisplayUnit='Ohm/sq',
    #     ),
    # )
    resistivity = Quantity(
        type=np.dtype(np.float64),
        unit='Ohm*cm',
        shape=[],
        description="""
                The resistivity of the investigated layer in the pixel.
                """,
        a_eln=dict(
            component='NumberEditQuantity',
            defaultDisplayUnit='Ohm*cm',
        ),
    )
    bandgap = Quantity(
        type=np.dtype(np.float64),
        unit='eV',
        description='Bandgap value of the investigated layer in the pixel.',
        a_eln=dict(
            component='NumberEditQuantity',
            defaultDisplayUnit='eV',
        ),
    )
    photoluminescence_quantum_yield = Quantity(
        type=np.dtype(np.float64),
        description='The efficiency with which absorbed photon flux is converted into emitted photons in luminescent process.',
        a_eln=dict(component='NumberEditQuantity'),
    )

    implied_voc = Quantity(
        type=np.dtype(np.float64),
        unit='eV',
        description="""
        Estimated quasi-Fermi level splitting based on intensity calibrated
        photoluminescence (PL) measurements.
        """,
        a_eln=dict(
            component='NumberEditQuantity',
            defaultDisplayUnit='eV',
        ),
    )
    photoluminescence_full_width_half_maximun = Quantity(
        type=np.dtype(np.float64),
        unit='eV',
        description="""
        Full width at half-maximun (FWHM) of a fitted single peak from a
        photoluminescence (PL) spectrum.""",
        a_eln=dict(component='NumberEditQuantity', defaultDisplayUnit='eV'),
    )
    implied_short_circuit_current_density = Quantity(
        type=np.dtype(np.float64),
        unit='A/cm^2',
        description="""
        Estimated short-circuit current density calculated by integrating the product of the absorptivity spectrum
        and the AM1.5GT solar spectrum.""",
        a_eln=dict(component='NumberEditQuantity', defaultDisplayUnit='A/cm^2'),
    )

class Pixel(ContinuousCombiSample, EntryData):
    """
    A pixel that is part of a combinatorial library with defined coordinates.
    """

    m_def = Section(categories=[UnoldLabCategory], label='UnoldPixel')

    properties = SubSection(
        section_def=PixelProperties,
        description="""
          The properties of the pixel.
          """,
    )
    samples = SubSection(
        section_def=CompositeSystemReference,
        description="""
          The samples refer to the library ID.
          """,
        repeats=True,
    )

    def normalize(self, archive, logger):
        super(ContinuousCombiSample, self).normalize(archive, logger)

        # self.components for xrf, check htem how to do it, and add element to results.materials.elements
        if self.lab_id:
            id = self.lab_id.split(':')[0].strip()
            set_sample_reference(archive, self, id)

        if self.properties and self.properties.bandgap:
            bg = BandGap(value=np.float64(self.properties.bandgap) * ureg('eV'))
            if not archive.results.properties:
                archive.results.properties = Properties()
            if not archive.results.properties.electronic:
                archive.results.properties.electronic = ElectronicProperties(
                    band_gap=[bg]
                )

Also, the normalizer of Pixel in the super calls ContinousCombiSample. Is this correct?

I haven't validated the definitions, it should be tested.