Skip to content

Commit

Permalink
update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
sH4MbLe5 committed Sep 19, 2023
1 parent 40e084e commit 8779bd0
Show file tree
Hide file tree
Showing 35 changed files with 1,684 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ datasets/*
*.pyc

# generated python objects
datamodel_b07_tc/core
# datamodel_b07_tc/core

# compiled bython files
datamodel_b07_tc/__pycache__
Expand Down
69 changes: 69 additions & 0 deletions datamodel_b07_tc/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from .dataset import Dataset
from .generalinformation import GeneralInformation
from .author import Author
from .experiment import Experiment
from .plantsetup import PlantSetup
from .device import Device
from .pump import Pump
from .thermocouple import Thermocouple
from .massflowmeter import MassFlowMeter
from .parameter import Parameter
from .potentiostat import Potentiostat
from .tubing import Tubing
from .insulation import Insulation
from .input import Input
from .output import Output
from .chemical import Chemical
from .stoichiometry import Stoichiometry
from .data import Data
from .metadata import Metadata
from .measurement import Measurement
from .speciesdata import SpeciesData
from .calibration import Calibration
from .datatype import DataType
from .thermocoupletype import ThermocoupleType
from .material import Material
from .pumptype import PumpType
from .reactantrole import ReactantRole
from .devicelist import DeviceList
from .quantity import Quantity
from .measurementtype import MeasurementType
from .species import Species
from .chemicalformula import ChemicalFormula

__doc__ = ""

__all__ = [
"Dataset",
"GeneralInformation",
"Author",
"Experiment",
"PlantSetup",
"Device",
"Pump",
"Thermocouple",
"MassFlowMeter",
"Parameter",
"Potentiostat",
"Tubing",
"Insulation",
"Input",
"Output",
"Chemical",
"Stoichiometry",
"Data",
"Metadata",
"Measurement",
"SpeciesData",
"Calibration",
"DataType",
"ThermocoupleType",
"Material",
"PumpType",
"ReactantRole",
"DeviceList",
"Quantity",
"MeasurementType",
"Species",
"ChemicalFormula",
]
113 changes: 113 additions & 0 deletions datamodel_b07_tc/core/analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import sdRDM

from typing import Optional, Union, List
from pydantic import Field, PrivateAttr
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature, IDGenerator

from datetime import datetime as Datetime
from astropy.units import UnitBase

from .quantity import Quantity
from .data import Data
from .species import Species
from .calibration import Calibration


@forge_signature
class Analysis(sdRDM.DataModel):
""""""

id: Optional[str] = Field(
description="Unique identifier of the given object.",
default_factory=IDGenerator("analysisINDEX"),
xml="@id",
)

calibrations: List[Calibration] = Field(
default_factory=ListPlus,
multiple=True,
description="Calibration measurement.",
)

faraday_coefficients: List[Data] = Field(
default_factory=ListPlus,
multiple=True,
description="Faraday coefficients.",
)

__repo__: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="a4c50b26815a02cca2986380d5aeb8c023e877eb"
)

def add_to_calibrations(
self,
species: Optional[Species] = None,
peak_areas: Optional[Data] = None,
concentrations: Optional[Data] = None,
slope: Optional[Data] = None,
intercept: Optional[Data] = None,
coefficient_of_determination: Optional[Data] = None,
id: Optional[str] = None,
) -> None:
"""
This method adds an object of type 'Calibration' to attribute calibrations
Args:
id (str): Unique identifier of the 'Calibration' object. Defaults to 'None'.
species (): Species for which the calibration was performed.. Defaults to None
peak_areas (): Recorded peak areas of the individual calibration solutions.. Defaults to None
concentrations (): concentrations of the individual calibration solutions.. Defaults to None
slope (): slopes of the (linear) calibration functions.. Defaults to None
intercept (): intercept of the (linear) calibration functions.. Defaults to None
coefficient_of_determination (): coefficients of the (linear) calibration functions.. Defaults to None
"""

params = {
"species": species,
"peak_areas": peak_areas,
"concentrations": concentrations,
"slope": slope,
"intercept": intercept,
"coefficient_of_determination": coefficient_of_determination,
}

if id is not None:
params["id"] = id

self.calibrations.append(Calibration(**params))

return self.calibrations[-1]

def add_to_faraday_coefficients(
self,
quantity: Optional[Quantity] = None,
values: List[Union[float, str, Datetime]] = ListPlus(),
unit: Optional[UnitBase] = None,
id: Optional[str] = None,
) -> None:
"""
This method adds an object of type 'Data' to attribute faraday_coefficients
Args:
id (str): Unique identifier of the 'Data' object. Defaults to 'None'.
quantity (): quantity of a value.. Defaults to None
values (): values.. Defaults to ListPlus()
unit (): unit of the values.. Defaults to None
"""

params = {
"quantity": quantity,
"values": values,
"unit": unit,
}

if id is not None:
params["id"] = id

self.faraday_coefficients.append(Data(**params))

return self.faraday_coefficients[-1]
33 changes: 33 additions & 0 deletions datamodel_b07_tc/core/author.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import sdRDM

from typing import Optional
from pydantic import Field, PrivateAttr
from sdRDM.base.utils import forge_signature, IDGenerator


@forge_signature
class Author(sdRDM.DataModel):
"""This is another object that represents the author of the dataset. Please note, that the options here contain all required fields but also custom ones. In this example, the ```Dataverse``` option specifies where each field should be mapped, when exported to a Dataverse format. Hence, these options allow you to link your dataset towards any other data model without writing code by yourself."""

id: Optional[str] = Field(
description="Unique identifier of the given object.",
default_factory=IDGenerator("authorINDEX"),
xml="@id",
)

name: Optional[str] = Field(
default=None,
description="full name including given and family name.",
)

affiliation: Optional[str] = Field(
default=None,
description="organization the author is affiliated to.",
)

__repo__: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="84c47e3b42d9bd24447f9f5668612ba7a70e39c3"
)
51 changes: 51 additions & 0 deletions datamodel_b07_tc/core/calibration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import sdRDM

from typing import Optional
from pydantic import Field, PrivateAttr
from sdRDM.base.utils import forge_signature, IDGenerator


from .data import Data


@forge_signature
class Calibration(sdRDM.DataModel):
""""""

id: Optional[str] = Field(
description="Unique identifier of the given object.",
default_factory=IDGenerator("calibrationINDEX"),
xml="@id",
)

peak_areas: Optional[Data] = Field(
default=Data(),
description="Recorded peak areas of the individual calibration solutions.",
)

concentrations: Optional[Data] = Field(
default=Data(),
description="concentrations of the individual calibration solutions.",
)

slope: Optional[Data] = Field(
default=Data(),
description="slopes of the (linear) calibration functions.",
)

intercept: Optional[Data] = Field(
default=Data(),
description="intercept of the (linear) calibration functions.",
)

coefficient_of_determination: Optional[Data] = Field(
default=Data(),
description="coefficients of the (linear) calibration functions.",
)

__repo__: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="84c47e3b42d9bd24447f9f5668612ba7a70e39c3"
)
69 changes: 69 additions & 0 deletions datamodel_b07_tc/core/chemical.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import sdRDM

from typing import List, Optional
from pydantic import Field, PrivateAttr
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature, IDGenerator


from .stoichiometry import Stoichiometry
from .reactantrole import ReactantRole


@forge_signature
class Chemical(sdRDM.DataModel):
""""""

id: Optional[str] = Field(
description="Unique identifier of the given object.",
default_factory=IDGenerator("chemicalINDEX"),
xml="@id",
)

name: List[str] = Field(
description="IUPAC name of the compound.",
default_factory=ListPlus,
multiple=True,
)

formula: Optional[str] = Field(
default=None,
description="molecular formula of the compound.",
)

pureness: Optional[float] = Field(
default=None,
description="pureness of the compound in percent.",
)

supplier: Optional[str] = Field(
default=None,
description="name of the supplier of the compound.",
)

stoichiometry: Optional[Stoichiometry] = Field(
default=Stoichiometry(),
description=(
"stoichiometric information like equivalents, mass, amount of substance,"
" volume"
),
)

state_of_matter: Optional[str] = Field(
default=None,
description="s for solid, l for liquid and g for gaseous",
)

reactant_role: Optional[ReactantRole] = Field(
default=None,
description=(
"Role that a reactand plays in a chemical reaction or in a process."
),
)

__repo__: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="84c47e3b42d9bd24447f9f5668612ba7a70e39c3"
)
10 changes: 10 additions & 0 deletions datamodel_b07_tc/core/chemicalformula.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from enum import Enum


class ChemicalFormula(Enum):
H2 = "H2"
CO2 = "CO2"
CO = "CO"
CH4 = "CH4"
C2H4 = "C2H4"
C2H6 = "C2H6"
Loading

0 comments on commit 8779bd0

Please sign in to comment.