From e8eb42f3ed30a3b47a5f17238ca156f6ff6d5e4b Mon Sep 17 00:00:00 2001 From: sH4MbLe5 Date: Thu, 17 Oct 2024 23:26:50 +0200 Subject: [PATCH] remove FAIRFlowChemistry --- FAIRFlowChemistry/.DS_Store | Bin 6148 -> 0 bytes FAIRFlowChemistry/__init__.py | 3 - FAIRFlowChemistry/core/__init__.py | 34 - FAIRFlowChemistry/core/calibration.py | 92 -- FAIRFlowChemistry/core/component.py | 133 --- FAIRFlowChemistry/core/componenttype.py | 6 - FAIRFlowChemistry/core/data.py | 64 -- FAIRFlowChemistry/core/dataset.py | 128 --- FAIRFlowChemistry/core/datatype.py | 13 - FAIRFlowChemistry/core/experiment.py | 231 ----- FAIRFlowChemistry/core/genericattibute.py | 82 -- FAIRFlowChemistry/core/measurement.py | 138 --- FAIRFlowChemistry/core/measurementtype.py | 7 - FAIRFlowChemistry/core/metadata.py | 92 -- FAIRFlowChemistry/core/parameter.py | 55 -- FAIRFlowChemistry/core/plantsetup.py | 140 --- FAIRFlowChemistry/core/quantity.py | 22 - FAIRFlowChemistry/core/speciesdata.py | 84 -- .../schemes/fairflowchemistry_schema.md | 148 --- FAIRFlowChemistry/schemes/json/Author.json | 70 -- .../schemes/json/Calibration.json | 198 ---- FAIRFlowChemistry/schemes/json/Chemical.json | 242 ----- FAIRFlowChemistry/schemes/json/Component.json | 206 ---- FAIRFlowChemistry/schemes/json/Data.json | 136 --- FAIRFlowChemistry/schemes/json/Dataset.json | 888 ------------------ FAIRFlowChemistry/schemes/json/Device.json | 70 -- .../schemes/json/Experiment.json | 783 --------------- .../schemes/json/GeneralInformation.json | 426 --------- .../schemes/json/GenericAttibute.json | 96 -- FAIRFlowChemistry/schemes/json/Keyword.json | 57 -- .../schemes/json/MassFlowMeter.json | 186 ---- .../schemes/json/Measurement.json | 537 ----------- FAIRFlowChemistry/schemes/json/Metadata.json | 180 ---- FAIRFlowChemistry/schemes/json/Parameter.json | 94 -- .../schemes/json/PlantSetup.json | 251 ----- .../schemes/json/Potentiostat.json | 419 --------- FAIRFlowChemistry/schemes/json/Pump.json | 92 -- .../schemes/json/RelatedPublication.json | 70 -- .../schemes/json/SpeciesData.json | 290 ------ .../schemes/json/Stoichiometry.json | 123 --- .../schemes/json/Thermocouple.json | 92 -- .../schemes/json/TopicClassification.json | 57 -- FAIRFlowChemistry/schemes/json/Tubing.json | 139 --- .../initialize-checkpoint.py | 172 ---- FAIRFlowChemistry/tools/__init__.py | 5 - FAIRFlowChemistry/tools/acquisition.py | 485 ---------- FAIRFlowChemistry/tools/analysis.py | 158 ---- FAIRFlowChemistry/tools/auxiliary.py | 503 ---------- FAIRFlowChemistry/tools/calculator.py | 184 ---- FAIRFlowChemistry/tools/initialize.py | 94 -- FAIRFlowChemistry/tools/logger_setup.py | 35 - FAIRFlowChemistry/tools/reader.py | 289 ------ 52 files changed, 9099 deletions(-) delete mode 100644 FAIRFlowChemistry/.DS_Store delete mode 100644 FAIRFlowChemistry/__init__.py delete mode 100644 FAIRFlowChemistry/core/__init__.py delete mode 100644 FAIRFlowChemistry/core/calibration.py delete mode 100644 FAIRFlowChemistry/core/component.py delete mode 100644 FAIRFlowChemistry/core/componenttype.py delete mode 100644 FAIRFlowChemistry/core/data.py delete mode 100644 FAIRFlowChemistry/core/dataset.py delete mode 100644 FAIRFlowChemistry/core/datatype.py delete mode 100644 FAIRFlowChemistry/core/experiment.py delete mode 100644 FAIRFlowChemistry/core/genericattibute.py delete mode 100644 FAIRFlowChemistry/core/measurement.py delete mode 100644 FAIRFlowChemistry/core/measurementtype.py delete mode 100644 FAIRFlowChemistry/core/metadata.py delete mode 100644 FAIRFlowChemistry/core/parameter.py delete mode 100644 FAIRFlowChemistry/core/plantsetup.py delete mode 100644 FAIRFlowChemistry/core/quantity.py delete mode 100644 FAIRFlowChemistry/core/speciesdata.py delete mode 100644 FAIRFlowChemistry/schemes/fairflowchemistry_schema.md delete mode 100644 FAIRFlowChemistry/schemes/json/Author.json delete mode 100644 FAIRFlowChemistry/schemes/json/Calibration.json delete mode 100644 FAIRFlowChemistry/schemes/json/Chemical.json delete mode 100644 FAIRFlowChemistry/schemes/json/Component.json delete mode 100644 FAIRFlowChemistry/schemes/json/Data.json delete mode 100644 FAIRFlowChemistry/schemes/json/Dataset.json delete mode 100644 FAIRFlowChemistry/schemes/json/Device.json delete mode 100644 FAIRFlowChemistry/schemes/json/Experiment.json delete mode 100644 FAIRFlowChemistry/schemes/json/GeneralInformation.json delete mode 100644 FAIRFlowChemistry/schemes/json/GenericAttibute.json delete mode 100644 FAIRFlowChemistry/schemes/json/Keyword.json delete mode 100644 FAIRFlowChemistry/schemes/json/MassFlowMeter.json delete mode 100644 FAIRFlowChemistry/schemes/json/Measurement.json delete mode 100644 FAIRFlowChemistry/schemes/json/Metadata.json delete mode 100644 FAIRFlowChemistry/schemes/json/Parameter.json delete mode 100644 FAIRFlowChemistry/schemes/json/PlantSetup.json delete mode 100644 FAIRFlowChemistry/schemes/json/Potentiostat.json delete mode 100644 FAIRFlowChemistry/schemes/json/Pump.json delete mode 100644 FAIRFlowChemistry/schemes/json/RelatedPublication.json delete mode 100644 FAIRFlowChemistry/schemes/json/SpeciesData.json delete mode 100644 FAIRFlowChemistry/schemes/json/Stoichiometry.json delete mode 100644 FAIRFlowChemistry/schemes/json/Thermocouple.json delete mode 100644 FAIRFlowChemistry/schemes/json/TopicClassification.json delete mode 100644 FAIRFlowChemistry/schemes/json/Tubing.json delete mode 100644 FAIRFlowChemistry/tools/.ipynb_checkpoints/initialize-checkpoint.py delete mode 100644 FAIRFlowChemistry/tools/__init__.py delete mode 100644 FAIRFlowChemistry/tools/acquisition.py delete mode 100644 FAIRFlowChemistry/tools/analysis.py delete mode 100644 FAIRFlowChemistry/tools/auxiliary.py delete mode 100644 FAIRFlowChemistry/tools/calculator.py delete mode 100644 FAIRFlowChemistry/tools/initialize.py delete mode 100644 FAIRFlowChemistry/tools/logger_setup.py delete mode 100644 FAIRFlowChemistry/tools/reader.py diff --git a/FAIRFlowChemistry/.DS_Store b/FAIRFlowChemistry/.DS_Store deleted file mode 100644 index 7439edbcd1131b301ab364316930eadbc487ca03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5Iwu5S;->L`svA25CD+S|&PN4rK0$cn8X=gm zcHivooALTd-VYJ+^yU7XXiP*y6hRiJ$E3S==*Yf{A8WC=d#S0-?Y^R{(pq*l=VRbtn)DgaTg*$oh~_1hZpn zs7nVby#fF$bgRLa!?MIA$L!b|Vg$w(3bau6D+XIQ`jhjrV{2&P#D4i;fAjwG!uodP zPf91whEazCp+HxGV{49O|G&g9(|gJ9hD0kA2nGI_0$k0mXH$HX@2v-)Cwpx|xkV8Z pUMmg^e&-N?hO8r}I%wlbeDJbkYbaTyU&DcM5Kuv)3I%>ZflrG}O@#me diff --git a/FAIRFlowChemistry/__init__.py b/FAIRFlowChemistry/__init__.py deleted file mode 100644 index 36a78de..0000000 --- a/FAIRFlowChemistry/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ - -__URL__ = "https://github.com/FAIRChemistry/FAIRFlowChemistry" -__COMMIT__ = "ea8516ab28242e8d386584928b332f9c81a028d5" diff --git a/FAIRFlowChemistry/core/__init__.py b/FAIRFlowChemistry/core/__init__.py deleted file mode 100644 index 5ef3331..0000000 --- a/FAIRFlowChemistry/core/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -from .dataset import Dataset -from .experiment import Experiment -from .plantsetup import PlantSetup -from .measurement import Measurement -from .speciesdata import SpeciesData -from .component import Component -from .genericattibute import GenericAttibute -from .parameter import Parameter -from .data import Data -from .metadata import Metadata -from .calibration import Calibration -from .componenttype import ComponentType -from .datatype import DataType -from .quantity import Quantity -from .measurementtype import MeasurementType - -__doc__ = "" -__all__ = [ - "Dataset", - "Experiment", - "PlantSetup", - "Measurement", - "SpeciesData", - "Component", - "GenericAttibute", - "Parameter", - "Data", - "Metadata", - "Calibration", - "ComponentType", - "DataType", - "Quantity", - "MeasurementType", -] diff --git a/FAIRFlowChemistry/core/calibration.py b/FAIRFlowChemistry/core/calibration.py deleted file mode 100644 index 2a1475e..0000000 --- a/FAIRFlowChemistry/core/calibration.py +++ /dev/null @@ -1,92 +0,0 @@ -import sdRDM - -import numpy as np -from typing import Dict, List, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .data import Data - - -@forge_signature -class Calibration(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - peak_areas: Optional[Data] = element( - description="recorded peak areas of the individual calibration solutions.", - default_factory=Data, - tag="peak_areas", - json_schema_extra=dict(), - ) - - concentrations: Optional[Data] = element( - description="concentrations of the individual calibration solutions.", - default_factory=Data, - tag="concentrations", - json_schema_extra=dict(), - ) - - regression_coefficients: List[float] = element( - description="regression coefficients in order of increasing degree.", - default_factory=ListPlus, - tag="regression_coefficients", - json_schema_extra=dict(multiple=True), - ) - - degree: Optional[int] = element( - description="degree of regression model.", - default=1, - tag="degree", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def calibrate(self): - """ - Calibrate the regression model on seen data - """ - - self.regression_coefficients = np.polynomial.polynomial.polyfit( - self.peak_areas.values, self.concentrations.values, self.degree - ).tolist() - - def predict(self, x: list) -> np.ndarray: - """ - Predict with regression model - - Args: - x (1D list): New locations for which predictions should be made - - Returns: - (1D numpy array): Predicted data at new locations - """ - - return np.polynomial.Polynomial(self.regression_coefficients)(np.array(x)) diff --git a/FAIRFlowChemistry/core/component.py b/FAIRFlowChemistry/core/component.py deleted file mode 100644 index 0b2ea77..0000000 --- a/FAIRFlowChemistry/core/component.py +++ /dev/null @@ -1,133 +0,0 @@ -import sdRDM - -from typing import Dict, List, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .genericattibute import GenericAttibute -from .componenttype import ComponentType - - -@forge_signature -class Component(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - component_type: Optional[ComponentType] = element( - description="equipment or piping component.", - default=None, - tag="component_type", - json_schema_extra=dict(), - ) - - component_id: Optional[str] = element( - description="id used to unambiguously identify the component.", - default=None, - tag="component_id", - json_schema_extra=dict(), - ) - - component_class: Optional[str] = element( - description="class of the component.", - default=None, - tag="component_class", - json_schema_extra=dict(), - ) - - component_class_uri: Optional[str] = element( - description="uri of the component.", - default=None, - tag="component_class_uri", - json_schema_extra=dict(), - ) - - component_name: Optional[str] = element( - description=( - "name of the component used to link between the abstract component and its" - " shape." - ), - default=None, - tag="component_name", - json_schema_extra=dict(), - ) - - generic_attributes: List[GenericAttibute] = element( - description="a generic attribute as defined by DEXPI.", - default_factory=ListPlus, - tag="generic_attributes", - json_schema_extra=dict(multiple=True), - ) - - connections: List[str] = element( - description=( - "component id of other component this component is connected to via pipes," - " wires or similar." - ), - default_factory=ListPlus, - tag="connections", - json_schema_extra=dict(multiple=True), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def add_to_generic_attributes( - self, - name: Optional[str] = None, - attribute_uri: Optional[str] = None, - value: Optional[str] = None, - format: Optional[str] = None, - units: Optional[str] = None, - units_uri: Optional[str] = None, - id: Optional[str] = None, - **kwargs - ) -> GenericAttibute: - """ - This method adds an object of type 'GenericAttibute' to attribute generic_attributes - - Args: - id (str): Unique identifier of the 'GenericAttibute' object. Defaults to 'None'. - name (): bla.. Defaults to None - attribute_uri (): bla.. Defaults to None - value (): bla.. Defaults to None - format (): bla.. Defaults to None - units (): bla.. Defaults to None - units_uri (): bla. Defaults to None - """ - params = { - "name": name, - "attribute_uri": attribute_uri, - "value": value, - "format": format, - "units": units, - "units_uri": units_uri, - } - if id is not None: - params["id"] = id - self.generic_attributes.append(GenericAttibute(**params)) - return self.generic_attributes[-1] diff --git a/FAIRFlowChemistry/core/componenttype.py b/FAIRFlowChemistry/core/componenttype.py deleted file mode 100644 index a0d6cf5..0000000 --- a/FAIRFlowChemistry/core/componenttype.py +++ /dev/null @@ -1,6 +0,0 @@ -from enum import Enum - - -class ComponentType(Enum): - EQUIPMENT = "Equipment" - PIPINGCOMPONENT = "Piping component" diff --git a/FAIRFlowChemistry/core/data.py b/FAIRFlowChemistry/core/data.py deleted file mode 100644 index 379377e..0000000 --- a/FAIRFlowChemistry/core/data.py +++ /dev/null @@ -1,64 +0,0 @@ -import sdRDM - -from typing import Optional, Union, List, Dict -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.base.datatypes import Unit -from sdRDM.tools.utils import elem2dict -from datetime import datetime as Datetime -from .quantity import Quantity - - -@forge_signature -class Data(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - quantity: Optional[Quantity] = element( - description="quantity of a value.", - default=None, - tag="quantity", - json_schema_extra=dict(), - ) - - values: List[Union[float, str, Datetime]] = element( - description="values.", - default_factory=ListPlus, - tag="values", - json_schema_extra=dict(multiple=True), - ) - - unit: Optional[Unit] = element( - description="unit of the values.", - default=None, - tag="unit", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self diff --git a/FAIRFlowChemistry/core/dataset.py b/FAIRFlowChemistry/core/dataset.py deleted file mode 100644 index 95f981a..0000000 --- a/FAIRFlowChemistry/core/dataset.py +++ /dev/null @@ -1,128 +0,0 @@ -import sdRDM - -from typing import Dict, List, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .experiment import Experiment -from .speciesdata import SpeciesData -from .plantsetup import PlantSetup -from .measurement import Measurement - - -@forge_signature -class GeneralInformation(sdRDM.DataModel, search_mode="unordered"): - """Small type for attribute 'general_information'""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - title: Optional[str] = element(default=None, tag="title", json_schema_extra=dict()) - project: Optional[str] = element( - default=None, tag="project", json_schema_extra=dict() - ) - description: Optional[str] = element( - default=None, tag="description", json_schema_extra=dict() - ) - purpose: Optional[str] = element( - default=None, tag="purpose", json_schema_extra=dict() - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - -@forge_signature -class Dataset(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - general_information: Optional[GeneralInformation] = element( - description=( - "general data about the dataset like titel, project name, description, and" - " purpose." - ), - default_factory=GeneralInformation, - tag="general_information", - json_schema_extra=dict(), - ) - - experiments: List[Experiment] = element( - description="information about the individual experiment.", - default_factory=ListPlus, - tag="experiments", - json_schema_extra=dict(multiple=True), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def add_to_experiments( - self, - plant_setup: Optional[PlantSetup] = None, - measurements: List[Measurement] = ListPlus(), - species_data: List[SpeciesData] = ListPlus(), - id: Optional[str] = None, - **kwargs - ) -> Experiment: - """ - This method adds an object of type 'Experiment' to attribute experiments - - Args: - id (str): Unique identifier of the 'Experiment' object. Defaults to 'None'. - plant_setup (): the individual plant setup that is used in this one experiment.. Defaults to None - measurements (): different measurements that are made within the scope of one experiment.. Defaults to ListPlus() - species_data (): all provided and calculated data about a specific species.. Defaults to ListPlus() - """ - params = { - "plant_setup": plant_setup, - "measurements": measurements, - "species_data": species_data, - } - if id is not None: - params["id"] = id - self.experiments.append(Experiment(**params)) - return self.experiments[-1] diff --git a/FAIRFlowChemistry/core/datatype.py b/FAIRFlowChemistry/core/datatype.py deleted file mode 100644 index f75edf1..0000000 --- a/FAIRFlowChemistry/core/datatype.py +++ /dev/null @@ -1,13 +0,0 @@ -from enum import Enum - - -class DataType(Enum): - STRING = "string" - FLOAT = "float" - DATE = "date" - TIME = "time" - DATETIME = "datetime" - BOOLEAN = "Boolean" - INTEGER = "int" - NONE = "NONE" - LABEL = "label" diff --git a/FAIRFlowChemistry/core/experiment.py b/FAIRFlowChemistry/core/experiment.py deleted file mode 100644 index 069c02f..0000000 --- a/FAIRFlowChemistry/core/experiment.py +++ /dev/null @@ -1,231 +0,0 @@ -import sdRDM - -import yaml -import pandas as pd -from typing import Dict, List, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .speciesdata import SpeciesData -from .data import Data -from .quantity import Quantity -from .plantsetup import PlantSetup -from .measurement import Measurement -from .component import Component -from .metadata import Metadata -from .measurementtype import MeasurementType -from .calibration import Calibration -from .datatype import DataType - - -@forge_signature -class Experiment(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - plant_setup: Optional[PlantSetup] = element( - description="the individual plant setup that is used in this one experiment.", - default_factory=PlantSetup, - tag="plant_setup", - json_schema_extra=dict(), - ) - - measurements: List[Measurement] = element( - description=( - "different measurements that are made within the scope of one experiment." - ), - default_factory=ListPlus, - tag="measurements", - json_schema_extra=dict(multiple=True), - ) - - species_data: List[SpeciesData] = element( - description="all provided and calculated data about a specific species.", - default_factory=ListPlus, - tag="species_data", - json_schema_extra=dict(multiple=True), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def add_to_measurements( - self, - measurement_type: Optional[MeasurementType] = None, - metadata: List[Metadata] = ListPlus(), - experimental_data: List[Data] = ListPlus(), - source: Optional[Component] = None, - id: Optional[str] = None, - **kwargs, - ) -> Measurement: - """ - This method adds an object of type 'Measurement' to attribute measurements - - Args: - id (str): Unique identifier of the 'Measurement' object. Defaults to 'None'. - measurement_type (): type of a measurement, e.g. potentiostatic or gas chromatography.. Defaults to None - metadata (): metadata of a measurement.. Defaults to ListPlus() - experimental_data (): experimental data of a measurement.. Defaults to ListPlus() - source (): measuring device the data stems from.. Defaults to None - """ - params = { - "measurement_type": measurement_type, - "metadata": metadata, - "experimental_data": experimental_data, - "source": source, - } - if id is not None: - params["id"] = id - self.measurements.append(Measurement(**params)) - return self.measurements[-1] - - def add_to_species_data( - self, - species: Optional[str] = None, - chemical_formula: Optional[str] = None, - calibration: Optional[Calibration] = None, - correction_factor: Optional[float] = None, - electron_transfer: Optional[float] = None, - faraday_efficiency: Optional[Data] = None, - id: Optional[str] = None, - **kwargs, - ) -> SpeciesData: - """ - This method adds an object of type 'SpeciesData' to attribute species_data - - Args: - id (str): Unique identifier of the 'SpeciesData' object. Defaults to 'None'. - species (): name of the species.. Defaults to None - chemical_formula (): chemical formula of the species.. Defaults to None - calibration (): calibration measurement.. Defaults to None - correction_factor (): correction factors of the individual species.. Defaults to None - electron_transfer (): Number of transfered electrons of the individual species.. Defaults to None - faraday_efficiency (): Faraday efficiencies of the individual species.. Defaults to None - """ - params = { - "species": species, - "chemical_formula": chemical_formula, - "calibration": calibration, - "correction_factor": correction_factor, - "electron_transfer": electron_transfer, - "faraday_efficiency": faraday_efficiency, - } - if id is not None: - params["id"] = id - self.species_data.append(SpeciesData(**params)) - return self.species_data[-1] - - def initialize_species_from_yaml(self, yaml_file: str): - """ - Function that initializes species from a yaml file - - Args: - yaml_file (str): Path to the yaml file - """ - - with open(yaml_file) as f: - species_data = yaml.safe_load(f) - - for species, item in species_data.items(): - - if not "calibration" in item.keys(): - raise KeyError(f"No calibration data provided for species: {species}!") - else: - if not "peak_areas" in item["calibration"].keys(): - raise KeyError( - f"No peak areas provided for calibration of species: {species}!" - ) - if not "concentrations" in item["calibration"].keys(): - raise KeyError( - "No concentrations provided for calibration of species:" - f" {species}!" - ) - - if not "chemical_formula" in item.keys(): - raise KeyError(f"No chemical formula provided for species: {species}!") - - if not "correction_factor" in item.keys(): - raise KeyError(f"No correction factor provided for species: {species}!") - - if not "electron_transfer" in item.keys(): - raise KeyError(f"No electron transfer provided for species: {species}!") - - # Create Calibration object and fit it to the given data - calibration = Calibration( - peak_areas=Data( - quantity="Peak area", values=item["calibration"]["peak_areas"] - ), - concentrations=Data( - quantity=Quantity.CONCENTRATION.value, - values=item["calibration"]["concentrations"], - ), - ) - calibration.calibrate() - - # Add species - self.add_to_species_data( - species=species, - chemical_formula=item["chemical_formula"], - calibration=calibration, - correction_factor=item["correction_factor"], - electron_transfer=item["electron_transfer"], - ) - - @property - def volumetric_flow_time_course(self) -> list: - """This property extracts the volumetric flow time as well as the flow it self from the experiment class - - Returns: - list: Datetime list and flow value list - """ - volumetric_flow_datetime_list = [] - volumetric_flow_values_list = [] - - mfm_measurements = self.get( - "measurements", "measurement_type", "MFM measurement" - )[0] - for mfm_measurement in mfm_measurements: - volumetric_flow_datetime_list.extend( - mfm_measurement.get( - "experimental_data", "quantity", Quantity.DATETIME.value - )[0][0].values - ) - volumetric_flow_values_list.extend( - mfm_measurement.get( - "experimental_data", "quantity", Quantity.VOLUMETRICFLOWRATE.value - )[0][0].values - ) - - # If data is directly read in from the experiment, it is the correct format, if read from json dataset, it is a string and needs to be converted - if not type(volumetric_flow_datetime_list[0]) == DataType.DATETIME.value: - volumetric_flow_datetime_list = [ - pd.to_datetime(timestamp, format="%Y-%m-%dT%H:%M:%S").to_pydatetime() - for timestamp in volumetric_flow_datetime_list - ] - - return [volumetric_flow_datetime_list, volumetric_flow_values_list] diff --git a/FAIRFlowChemistry/core/genericattibute.py b/FAIRFlowChemistry/core/genericattibute.py deleted file mode 100644 index eb7477a..0000000 --- a/FAIRFlowChemistry/core/genericattibute.py +++ /dev/null @@ -1,82 +0,0 @@ -import sdRDM - -from typing import Dict, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict - - -@forge_signature -class GenericAttibute(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - name: Optional[str] = element( - description="bla.", - default=None, - tag="name", - json_schema_extra=dict(), - ) - - attribute_uri: Optional[str] = element( - description="bla.", - default=None, - tag="attribute_uri", - json_schema_extra=dict(), - ) - - value: Optional[str] = element( - description="bla.", - default=None, - tag="value", - json_schema_extra=dict(), - ) - - format: Optional[str] = element( - description="bla.", - default=None, - tag="format", - json_schema_extra=dict(), - ) - - units: Optional[str] = element( - description="bla.", - default=None, - tag="units", - json_schema_extra=dict(), - ) - - units_uri: Optional[str] = element( - description="bla", - default=None, - tag="units_uri", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self diff --git a/FAIRFlowChemistry/core/measurement.py b/FAIRFlowChemistry/core/measurement.py deleted file mode 100644 index 7a14c15..0000000 --- a/FAIRFlowChemistry/core/measurement.py +++ /dev/null @@ -1,138 +0,0 @@ -import sdRDM - -from typing import Optional, Union, List, Dict -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.base.datatypes import Unit -from sdRDM.tools.utils import elem2dict -from datetime import datetime as Datetime -from .quantity import Quantity -from .data import Data -from .component import Component -from .metadata import Metadata -from .measurementtype import MeasurementType -from .datatype import DataType - - -@forge_signature -class Measurement(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - measurement_type: Optional[MeasurementType] = element( - description="type of a measurement, e.g. potentiostatic or gas chromatography.", - default=None, - tag="measurement_type", - json_schema_extra=dict(), - ) - - metadata: List[Metadata] = element( - description="metadata of a measurement.", - default_factory=ListPlus, - tag="metadata", - json_schema_extra=dict(multiple=True), - ) - - experimental_data: List[Data] = element( - description="experimental data of a measurement.", - default_factory=ListPlus, - tag="experimental_data", - json_schema_extra=dict(multiple=True), - ) - - source: Optional[Component] = element( - description="measuring device the data stems from.", - default_factory=Component, - tag="source", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def add_to_metadata( - self, - parameter: Optional[str] = None, - value: Union[str, float, Datetime, None] = None, - abbreviation: Optional[str] = None, - data_type: Optional[DataType] = None, - mode: Optional[str] = None, - unit: Optional[Unit] = None, - description: Optional[str] = None, - id: Optional[str] = None, - **kwargs - ) -> Metadata: - """ - This method adds an object of type 'Metadata' to attribute metadata - - Args: - id (str): Unique identifier of the 'Metadata' object. Defaults to 'None'. - parameter (): name of the parameter.. Defaults to None - value (): value of the parameter.. Defaults to None - abbreviation (): abbreviation for the parameter.. Defaults to None - data_type (): type of the parameter.. Defaults to None - mode (): mode of the parameter. e.g., on and off.. Defaults to None - unit (): unit of the parameter.. Defaults to None - description (): description of the parameter.. Defaults to None - """ - params = { - "parameter": parameter, - "value": value, - "abbreviation": abbreviation, - "data_type": data_type, - "mode": mode, - "unit": unit, - "description": description, - } - if id is not None: - params["id"] = id - self.metadata.append(Metadata(**params)) - return self.metadata[-1] - - def add_to_experimental_data( - self, - quantity: Optional[Quantity] = None, - values: List[Union[float, str, Datetime]] = ListPlus(), - unit: Optional[Unit] = None, - id: Optional[str] = None, - **kwargs - ) -> Data: - """ - This method adds an object of type 'Data' to attribute experimental_data - - 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.experimental_data.append(Data(**params)) - return self.experimental_data[-1] diff --git a/FAIRFlowChemistry/core/measurementtype.py b/FAIRFlowChemistry/core/measurementtype.py deleted file mode 100644 index f50103d..0000000 --- a/FAIRFlowChemistry/core/measurementtype.py +++ /dev/null @@ -1,7 +0,0 @@ -from enum import Enum - - -class MeasurementType(Enum): - POTENTIOSTATIC = "Potentiostatic measurement" - GC = "GC measurement" - MFM = "MFM measurement" diff --git a/FAIRFlowChemistry/core/metadata.py b/FAIRFlowChemistry/core/metadata.py deleted file mode 100644 index 8150678..0000000 --- a/FAIRFlowChemistry/core/metadata.py +++ /dev/null @@ -1,92 +0,0 @@ -import sdRDM - -from typing import Dict, Optional, Union -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.base.datatypes import Unit -from sdRDM.tools.utils import elem2dict -from datetime import datetime as Datetime -from .datatype import DataType - - -@forge_signature -class Metadata(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - parameter: Optional[str] = element( - description="name of the parameter.", - default=None, - tag="parameter", - json_schema_extra=dict(), - ) - - value: Union[str, float, Datetime, None] = element( - description="value of the parameter.", - default=None, - tag="value", - json_schema_extra=dict(), - ) - - abbreviation: Optional[str] = element( - description="abbreviation for the parameter.", - default=None, - tag="abbreviation", - json_schema_extra=dict(), - ) - - data_type: Optional[DataType] = element( - description="type of the parameter.", - default=None, - tag="data_type", - json_schema_extra=dict(), - ) - - mode: Optional[str] = element( - description="mode of the parameter. e.g., on and off.", - default=None, - tag="mode", - json_schema_extra=dict(), - ) - - unit: Optional[Unit] = element( - description="unit of the parameter.", - default=None, - tag="unit", - json_schema_extra=dict(), - ) - - description: Optional[str] = element( - description="description of the parameter.", - default=None, - tag="description", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self diff --git a/FAIRFlowChemistry/core/parameter.py b/FAIRFlowChemistry/core/parameter.py deleted file mode 100644 index ff41cd4..0000000 --- a/FAIRFlowChemistry/core/parameter.py +++ /dev/null @@ -1,55 +0,0 @@ -import sdRDM - -from typing import Dict, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.base.datatypes import Unit -from sdRDM.tools.utils import elem2dict - - -@forge_signature -class Parameter(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - value: Optional[float] = element( - description="values.", - default=None, - tag="value", - json_schema_extra=dict(), - ) - - unit: Optional[Unit] = element( - description="unit of the values.", - default=None, - tag="unit", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self diff --git a/FAIRFlowChemistry/core/plantsetup.py b/FAIRFlowChemistry/core/plantsetup.py deleted file mode 100644 index e3bf8f9..0000000 --- a/FAIRFlowChemistry/core/plantsetup.py +++ /dev/null @@ -1,140 +0,0 @@ -import sdRDM - -import networkx as nx -import matplotlib.pyplot as plt -from typing import Dict, List, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .component import Component -from .genericattibute import GenericAttibute -from .componenttype import ComponentType - - -@forge_signature -class PlantSetup(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - components: List[Component] = element( - description="bla.", - default_factory=ListPlus, - tag="components", - json_schema_extra=dict(multiple=True), - ) - - input: List[str] = element( - description="bla.", - default_factory=ListPlus, - tag="input", - json_schema_extra=dict(multiple=True), - ) - - output: List[str] = element( - description="bla.", - default_factory=ListPlus, - tag="output", - json_schema_extra=dict(multiple=True), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self - - def add_to_components( - self, - component_type: Optional[ComponentType] = None, - component_id: Optional[str] = None, - component_class: Optional[str] = None, - component_class_uri: Optional[str] = None, - component_name: Optional[str] = None, - generic_attributes: List[GenericAttibute] = ListPlus(), - connections: List[str] = ListPlus(), - id: Optional[str] = None, - **kwargs - ) -> Component: - """ - This method adds an object of type 'Component' to attribute components - - Args: - id (str): Unique identifier of the 'Component' object. Defaults to 'None'. - component_type (): equipment or piping component.. Defaults to None - component_id (): id used to unambiguously identify the component.. Defaults to None - component_class (): class of the component.. Defaults to None - component_class_uri (): uri of the component.. Defaults to None - component_name (): name of the component used to link between the abstract component and its shape.. Defaults to None - generic_attributes (): a generic attribute as defined by DEXPI.. Defaults to ListPlus() - connections (): component id of other component this component is connected to via pipes, wires or similar.. Defaults to ListPlus() - """ - params = { - "component_type": component_type, - "component_id": component_id, - "component_class": component_class, - "component_class_uri": component_class_uri, - "component_name": component_name, - "generic_attributes": generic_attributes, - "connections": connections, - } - if id is not None: - params["id"] = id - self.components.append(Component(**params)) - return self.components[-1] - - def visualize(self, save_path: str = ""): - """ - Function that visualize the plantsetup as graph. - Args: - save_path (str, optional): Path to save the graph (if wanted). Defaults to "". - """ - # Create a directed graph - G = nx.DiGraph() - - # Add nodes and edges - for component in self.components: - G.add_node(component.component_id) - for connection in component.connections: - G.add_edge(component.component_id, connection) - - # Draw the graph - plt.figure() - pos = nx.spring_layout(G, seed=42) - nx.draw( - G, - pos, - with_labels=True, - node_size=2000, - node_color="skyblue", - font_size=10, - font_weight="bold", - arrowsize=20, - linewidths=2, - ) - plt.title("Plantsetup") - if save_path: - plt.savefig(save_path) - plt.show() - plt.close() diff --git a/FAIRFlowChemistry/core/quantity.py b/FAIRFlowChemistry/core/quantity.py deleted file mode 100644 index 647d676..0000000 --- a/FAIRFlowChemistry/core/quantity.py +++ /dev/null @@ -1,22 +0,0 @@ -from enum import Enum - - -class Quantity(Enum): - TIME = "Time" - VOLTAGE = "Voltage" - CURRENT = "Current" - SURFACEAREA = "Electrode surface area" - CONCENTRATION = "Concentration" - MASS = "Mass" - MASSFLOWRATE = "Mass flow rate" - VOLUMETRICFLOWRATE = "Volumetric flow rate" - DATETIME = "Date time" - FRACTION = "Fraction" - RETENTIONTIME = "Retention time" - PEAKTYPE = "Peak type" - PEAKAREA = "Peak area" - PEAKHEIGHT = "Peak height" - PEAKAREAPERCENTAGE = "Peak area percentage" - PEAKASSIGNMENT = "Peak assignment" - FARADAYEFFIECENCY = "Faraday efficiency" - SIGNAL = "Signal" diff --git a/FAIRFlowChemistry/core/speciesdata.py b/FAIRFlowChemistry/core/speciesdata.py deleted file mode 100644 index 7a6b650..0000000 --- a/FAIRFlowChemistry/core/speciesdata.py +++ /dev/null @@ -1,84 +0,0 @@ -import sdRDM - -from typing import Dict, Optional -from pydantic import PrivateAttr, model_validator -from uuid import uuid4 -from pydantic_xml import attr, element -from lxml.etree import _Element -from sdRDM.base.listplus import ListPlus -from sdRDM.base.utils import forge_signature -from sdRDM.tools.utils import elem2dict -from .data import Data -from .calibration import Calibration - - -@forge_signature -class SpeciesData(sdRDM.DataModel, search_mode="unordered"): - """""" - - id: Optional[str] = attr( - name="id", - description="Unique identifier of the given object.", - default_factory=lambda: str(uuid4()), - xml="@id", - ) - - species: Optional[str] = element( - description="name of the species.", - default=None, - tag="species", - json_schema_extra=dict(), - ) - - chemical_formula: Optional[str] = element( - description="chemical formula of the species.", - default=None, - tag="chemical_formula", - json_schema_extra=dict(), - ) - - calibration: Optional[Calibration] = element( - description="calibration measurement.", - default_factory=Calibration, - tag="calibration", - json_schema_extra=dict(), - ) - - correction_factor: Optional[float] = element( - description="correction factors of the individual species.", - default=None, - tag="correction_factor", - json_schema_extra=dict(), - ) - - electron_transfer: Optional[float] = element( - description="Number of transfered electrons of the individual species.", - default=None, - tag="electron_transfer", - json_schema_extra=dict(), - ) - - faraday_efficiency: Optional[Data] = element( - description="Faraday efficiencies of the individual species.", - default_factory=Data, - tag="faraday_efficiency", - json_schema_extra=dict(), - ) - _repo: Optional[str] = PrivateAttr( - default="https://github.com/FAIRChemistry/FAIRFlowChemistry" - ) - _commit: Optional[str] = PrivateAttr( - default="ea8516ab28242e8d386584928b332f9c81a028d5" - ) - _raw_xml_data: Dict = PrivateAttr(default_factory=dict) - - @model_validator(mode="after") - def _parse_raw_xml_data(self): - for attr, value in self: - if isinstance(value, (ListPlus, list)) and all( - (isinstance(i, _Element) for i in value) - ): - self._raw_xml_data[attr] = [elem2dict(i) for i in value] - elif isinstance(value, _Element): - self._raw_xml_data[attr] = elem2dict(value) - return self diff --git a/FAIRFlowChemistry/schemes/fairflowchemistry_schema.md b/FAIRFlowChemistry/schemes/fairflowchemistry_schema.md deleted file mode 100644 index f99e100..0000000 --- a/FAIRFlowChemistry/schemes/fairflowchemistry_schema.md +++ /dev/null @@ -1,148 +0,0 @@ -```mermaid -classDiagram - Dataset *-- Experiment - Experiment *-- PlantSetup - Experiment *-- Measurement - Experiment *-- SpeciesData - PlantSetup *-- Component - Measurement *-- MeasurementType - Measurement *-- Component - Measurement *-- Data - Measurement *-- Metadata - SpeciesData *-- Data - SpeciesData *-- Calibration - Component *-- ComponentType - Component *-- GenericAttibute - Data *-- Quantity - Metadata *-- DataType - Calibration *-- Data - - class Dataset { - +GeneralInformation general_information - +Experiment[0..*] experiments - } - - class Experiment { - +PlantSetup plant_setup - +Measurement[0..*] measurements - +SpeciesData[0..*] species_data - } - - class PlantSetup { - +Component[0..*] components - +string[0..*] input - +string[0..*] output - } - - class Measurement { - +MeasurementType measurement_type - +Metadata[0..*] metadata - +Data[0..*] experimental_data - +Component source - } - - class SpeciesData { - +string species - +string chemical_formula - +Calibration calibration - +float correction_factor - +float electron_transfer - +Data faraday_efficiency - } - - class Component { - +ComponentType component_type - +string component_id - +string component_class - +string component_class_uri - +string component_name - +GenericAttibute[0..*] generic_attributes - +string[0..*] connections - } - - class GenericAttibute { - +string name - +string attribute_uri - +string value - +string format - +string units - +string units_uri - } - - class Parameter { - +float value - +Unit unit - } - - class Data { - +Quantity quantity - +float, string, datetime[0..*] values - +Unit unit - } - - class Metadata { - +string parameter - +string, float, datetime value - +string abbreviation - +DataType data_type - +string mode - +Unit unit - +string description - } - - class Calibration { - +Data peak_areas - +Data concentrations - +float[0..*] regression_coefficients - +int degree - } - - class ComponentType { - << Enumeration >> - +EQUIPMENT - +PIPINGCOMPONENT - } - - class DataType { - << Enumeration >> - +STRING - +FLOAT - +DATE - +TIME - +DATETIME - +BOOLEAN - +INTEGER - +NONE - +LABEL - } - - class Quantity { - << Enumeration >> - +TIME - +VOLTAGE - +CURRENT - +SURFACEAREA - +CONCENTRATION - +MASS - +MASSFLOWRATE - +VOLUMETRICFLOWRATE - +DATETIME - +FRACTION - +RETENTIONTIME - +PEAKTYPE - +PEAKAREA - +PEAKHEIGHT - +PEAKAREAPERCENTAGE - +PEAKASSIGNMENT - +FARADAYEFFIECENCY - +SIGNAL - } - - class MeasurementType { - << Enumeration >> - +POTENTIOSTATIC - +GC - +MFM - } - -``` \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Author.json b/FAIRFlowChemistry/schemes/json/Author.json deleted file mode 100644 index da64b39..0000000 --- a/FAIRFlowChemistry/schemes/json/Author.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "full name including given and family name.", - "title": "Name" - }, - "affiliation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "organization the author is affiliated to.", - "title": "Affiliation" - }, - "identifier_scheme": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the identifier scheme (ORCID, ISNI).", - "title": "Identifier Scheme" - }, - "identifier": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Uniquely identifies an individual author or organization, according to various schemes.", - "title": "Identifier" - } - }, - "title": "Author", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Calibration.json b/FAIRFlowChemistry/schemes/json/Calibration.json deleted file mode 100644 index 65ac32c..0000000 --- a/FAIRFlowChemistry/schemes/json/Calibration.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "peak_areas": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "recorded peak areas of the individual calibration solutions." - }, - "concentrations": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "concentrations of the individual calibration solutions." - }, - "regression_coefficients": { - "description": "regression coefficients in order of increasing degree.", - "items": { - "type": "number" - }, - "multiple": true, - "title": "Regression Coefficients", - "type": "array" - }, - "degree": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 1, - "description": "degree of regression model.", - "title": "Degree" - } - }, - "title": "Calibration", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Chemical.json b/FAIRFlowChemistry/schemes/json/Chemical.json deleted file mode 100644 index f290363..0000000 --- a/FAIRFlowChemistry/schemes/json/Chemical.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "$defs": { - "ReactantRole": { - "enum": [ - "Educt", - "Product", - "Catalyst", - "Solvent", - "Inert Gas" - ], - "title": "ReactantRole", - "type": "string" - }, - "Stoichiometry": { - "description": "Stoichiometric information about the compound.", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "equivalents": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "used equivalents in relation to the reference compound", - "title": "Equivalents" - }, - "amount_of_substance": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "amount of substance n in mmol", - "title": "Amount Of Substance" - }, - "mass": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "used mass of the compound in g", - "title": "Mass" - }, - "volume": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "volume of the compound", - "title": "Volume" - }, - "density": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "density of the compound at standard temperature and pressure.", - "title": "Density" - }, - "molar_mass": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "molar mass of the compound in g per mol", - "title": "Molar Mass" - }, - "mass_concentration": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mass concentration in percent.", - "title": "Mass Concentration" - }, - "molar_concentration": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "molar concentration in mol per l.", - "title": "Molar Concentration" - } - }, - "title": "Stoichiometry", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "IUPAC name of the compound.", - "title": "Name" - }, - "formula": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "molecular formula of the compound.", - "title": "Formula" - }, - "pureness": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "pureness of the compound in percent.", - "title": "Pureness" - }, - "supplier": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the supplier of the compound.", - "title": "Supplier" - }, - "stoichiometry": { - "anyOf": [ - { - "$ref": "#/$defs/Stoichiometry" - }, - { - "type": "null" - } - ], - "description": "stoichiometric information like equivalents, mass, amount of substance, volume" - }, - "state_of_matter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "s for solid, l for liquid and g for gaseous", - "title": "State Of Matter" - }, - "reactant_role": { - "anyOf": [ - { - "$ref": "#/$defs/ReactantRole" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role that a reactand plays in a chemical reaction or in a process." - } - }, - "title": "Chemical", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Component.json b/FAIRFlowChemistry/schemes/json/Component.json deleted file mode 100644 index 06875a0..0000000 --- a/FAIRFlowChemistry/schemes/json/Component.json +++ /dev/null @@ -1,206 +0,0 @@ -{ - "$defs": { - "ComponentType": { - "enum": [ - "Equipment", - "Piping component" - ], - "title": "ComponentType", - "type": "string" - }, - "GenericAttibute": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "component_type": { - "anyOf": [ - { - "$ref": "#/$defs/ComponentType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "equipment or piping component." - }, - "component_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "id used to unambiguously identify the component.", - "title": "Component Id" - }, - "component_class": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "class of the component.", - "title": "Component Class" - }, - "component_class_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "uri of the component.", - "title": "Component Class Uri" - }, - "component_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the component used to link between the abstract component and its shape.", - "title": "Component Name" - }, - "generic_attributes": { - "description": "a generic attribute as defined by DEXPI.", - "items": { - "$ref": "#/$defs/GenericAttibute" - }, - "multiple": true, - "title": "Generic Attributes", - "type": "array" - }, - "connections": { - "description": "component id of other component this component is connected to via pipes, wires or similar.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Connections", - "type": "array" - } - }, - "title": "Component", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Data.json b/FAIRFlowChemistry/schemes/json/Data.json deleted file mode 100644 index 6d6a877..0000000 --- a/FAIRFlowChemistry/schemes/json/Data.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Dataset.json b/FAIRFlowChemistry/schemes/json/Dataset.json deleted file mode 100644 index abe7d23..0000000 --- a/FAIRFlowChemistry/schemes/json/Dataset.json +++ /dev/null @@ -1,888 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Calibration": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "peak_areas": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "recorded peak areas of the individual calibration solutions." - }, - "concentrations": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "concentrations of the individual calibration solutions." - }, - "regression_coefficients": { - "description": "regression coefficients in order of increasing degree.", - "items": { - "type": "number" - }, - "multiple": true, - "title": "Regression Coefficients", - "type": "array" - }, - "degree": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 1, - "description": "degree of regression model.", - "title": "Degree" - } - }, - "title": "Calibration", - "type": "object" - }, - "Component": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "component_type": { - "anyOf": [ - { - "$ref": "#/$defs/ComponentType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "equipment or piping component." - }, - "component_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "id used to unambiguously identify the component.", - "title": "Component Id" - }, - "component_class": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "class of the component.", - "title": "Component Class" - }, - "component_class_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "uri of the component.", - "title": "Component Class Uri" - }, - "component_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the component used to link between the abstract component and its shape.", - "title": "Component Name" - }, - "generic_attributes": { - "description": "a generic attribute as defined by DEXPI.", - "items": { - "$ref": "#/$defs/GenericAttibute" - }, - "multiple": true, - "title": "Generic Attributes", - "type": "array" - }, - "connections": { - "description": "component id of other component this component is connected to via pipes, wires or similar.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Connections", - "type": "array" - } - }, - "title": "Component", - "type": "object" - }, - "ComponentType": { - "enum": [ - "Equipment", - "Piping component" - ], - "title": "ComponentType", - "type": "string" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "DataType": { - "enum": [ - "string", - "float", - "date", - "time", - "datetime", - "Boolean", - "int", - "NONE", - "label" - ], - "title": "DataType", - "type": "string" - }, - "Experiment": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "plant_setup": { - "anyOf": [ - { - "$ref": "#/$defs/PlantSetup" - }, - { - "type": "null" - } - ], - "description": "the individual plant setup that is used in this one experiment." - }, - "measurements": { - "description": "different measurements that are made within the scope of one experiment.", - "items": { - "$ref": "#/$defs/Measurement" - }, - "multiple": true, - "title": "Measurements", - "type": "array" - }, - "species_data": { - "description": "all provided and calculated data about a specific species.", - "items": { - "$ref": "#/$defs/SpeciesData" - }, - "multiple": true, - "title": "Species Data", - "type": "array" - } - }, - "title": "Experiment", - "type": "object" - }, - "GeneralInformation": { - "description": "Small type for attribute 'general_information'", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "title": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Title" - }, - "project": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Project" - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Description" - }, - "purpose": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Purpose" - } - }, - "title": "GeneralInformation", - "type": "object" - }, - "GenericAttibute": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" - }, - "Measurement": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "measurement_type": { - "anyOf": [ - { - "$ref": "#/$defs/MeasurementType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of a measurement, e.g. potentiostatic or gas chromatography." - }, - "metadata": { - "description": "metadata of a measurement.", - "items": { - "$ref": "#/$defs/Metadata" - }, - "multiple": true, - "title": "Metadata", - "type": "array" - }, - "experimental_data": { - "description": "experimental data of a measurement.", - "items": { - "$ref": "#/$defs/Data" - }, - "multiple": true, - "title": "Experimental Data", - "type": "array" - }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/Component" - }, - { - "type": "null" - } - ], - "description": "measuring device the data stems from." - } - }, - "title": "Measurement", - "type": "object" - }, - "MeasurementType": { - "enum": [ - "Potentiostatic measurement", - "GC measurement", - "MFM measurement" - ], - "title": "MeasurementType", - "type": "string" - }, - "Metadata": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "parameter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the parameter.", - "title": "Parameter" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "format": "date-time", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "value of the parameter.", - "title": "Value" - }, - "abbreviation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "abbreviation for the parameter.", - "title": "Abbreviation" - }, - "data_type": { - "anyOf": [ - { - "$ref": "#/$defs/DataType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the parameter." - }, - "mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mode of the parameter. e.g., on and off.", - "title": "Mode" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the parameter." - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "description of the parameter.", - "title": "Description" - } - }, - "title": "Metadata", - "type": "object" - }, - "PlantSetup": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "components": { - "description": "bla.", - "items": { - "$ref": "#/$defs/Component" - }, - "multiple": true, - "title": "Components", - "type": "array" - }, - "input": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Input", - "type": "array" - }, - "output": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Output", - "type": "array" - } - }, - "title": "PlantSetup", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "SpeciesData": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "species": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the species.", - "title": "Species" - }, - "chemical_formula": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "chemical formula of the species.", - "title": "Chemical Formula" - }, - "calibration": { - "anyOf": [ - { - "$ref": "#/$defs/Calibration" - }, - { - "type": "null" - } - ], - "description": "calibration measurement." - }, - "correction_factor": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "correction factors of the individual species.", - "title": "Correction Factor" - }, - "electron_transfer": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Number of transfered electrons of the individual species.", - "title": "Electron Transfer" - }, - "faraday_efficiency": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "Faraday efficiencies of the individual species." - } - }, - "title": "SpeciesData", - "type": "object" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "general_information": { - "anyOf": [ - { - "$ref": "#/$defs/GeneralInformation" - }, - { - "type": "null" - } - ], - "description": "general data about the dataset like titel, project name, description, and purpose." - }, - "experiments": { - "description": "information about the individual experiment.", - "items": { - "$ref": "#/$defs/Experiment" - }, - "multiple": true, - "title": "Experiments", - "type": "array" - } - }, - "title": "Dataset", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Device.json b/FAIRFlowChemistry/schemes/json/Device.json deleted file mode 100644 index 99c8846..0000000 --- a/FAIRFlowChemistry/schemes/json/Device.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "manufacturer": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the manufacturer of the device.", - "title": "Manufacturer" - }, - "device_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type given by the manufacturer of the device.", - "title": "Device Type" - }, - "series": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "the series of the device.", - "title": "Series" - }, - "on_off": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "operational mode of the flow module. True is on and False is off.", - "title": "On Off" - } - }, - "title": "Device", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Experiment.json b/FAIRFlowChemistry/schemes/json/Experiment.json deleted file mode 100644 index 1459118..0000000 --- a/FAIRFlowChemistry/schemes/json/Experiment.json +++ /dev/null @@ -1,783 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Calibration": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "peak_areas": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "recorded peak areas of the individual calibration solutions." - }, - "concentrations": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "concentrations of the individual calibration solutions." - }, - "regression_coefficients": { - "description": "regression coefficients in order of increasing degree.", - "items": { - "type": "number" - }, - "multiple": true, - "title": "Regression Coefficients", - "type": "array" - }, - "degree": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 1, - "description": "degree of regression model.", - "title": "Degree" - } - }, - "title": "Calibration", - "type": "object" - }, - "Component": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "component_type": { - "anyOf": [ - { - "$ref": "#/$defs/ComponentType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "equipment or piping component." - }, - "component_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "id used to unambiguously identify the component.", - "title": "Component Id" - }, - "component_class": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "class of the component.", - "title": "Component Class" - }, - "component_class_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "uri of the component.", - "title": "Component Class Uri" - }, - "component_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the component used to link between the abstract component and its shape.", - "title": "Component Name" - }, - "generic_attributes": { - "description": "a generic attribute as defined by DEXPI.", - "items": { - "$ref": "#/$defs/GenericAttibute" - }, - "multiple": true, - "title": "Generic Attributes", - "type": "array" - }, - "connections": { - "description": "component id of other component this component is connected to via pipes, wires or similar.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Connections", - "type": "array" - } - }, - "title": "Component", - "type": "object" - }, - "ComponentType": { - "enum": [ - "Equipment", - "Piping component" - ], - "title": "ComponentType", - "type": "string" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "DataType": { - "enum": [ - "string", - "float", - "date", - "time", - "datetime", - "Boolean", - "int", - "NONE", - "label" - ], - "title": "DataType", - "type": "string" - }, - "GenericAttibute": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" - }, - "Measurement": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "measurement_type": { - "anyOf": [ - { - "$ref": "#/$defs/MeasurementType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of a measurement, e.g. potentiostatic or gas chromatography." - }, - "metadata": { - "description": "metadata of a measurement.", - "items": { - "$ref": "#/$defs/Metadata" - }, - "multiple": true, - "title": "Metadata", - "type": "array" - }, - "experimental_data": { - "description": "experimental data of a measurement.", - "items": { - "$ref": "#/$defs/Data" - }, - "multiple": true, - "title": "Experimental Data", - "type": "array" - }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/Component" - }, - { - "type": "null" - } - ], - "description": "measuring device the data stems from." - } - }, - "title": "Measurement", - "type": "object" - }, - "MeasurementType": { - "enum": [ - "Potentiostatic measurement", - "GC measurement", - "MFM measurement" - ], - "title": "MeasurementType", - "type": "string" - }, - "Metadata": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "parameter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the parameter.", - "title": "Parameter" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "format": "date-time", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "value of the parameter.", - "title": "Value" - }, - "abbreviation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "abbreviation for the parameter.", - "title": "Abbreviation" - }, - "data_type": { - "anyOf": [ - { - "$ref": "#/$defs/DataType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the parameter." - }, - "mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mode of the parameter. e.g., on and off.", - "title": "Mode" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the parameter." - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "description of the parameter.", - "title": "Description" - } - }, - "title": "Metadata", - "type": "object" - }, - "PlantSetup": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "components": { - "description": "bla.", - "items": { - "$ref": "#/$defs/Component" - }, - "multiple": true, - "title": "Components", - "type": "array" - }, - "input": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Input", - "type": "array" - }, - "output": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Output", - "type": "array" - } - }, - "title": "PlantSetup", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "SpeciesData": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "species": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the species.", - "title": "Species" - }, - "chemical_formula": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "chemical formula of the species.", - "title": "Chemical Formula" - }, - "calibration": { - "anyOf": [ - { - "$ref": "#/$defs/Calibration" - }, - { - "type": "null" - } - ], - "description": "calibration measurement." - }, - "correction_factor": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "correction factors of the individual species.", - "title": "Correction Factor" - }, - "electron_transfer": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Number of transfered electrons of the individual species.", - "title": "Electron Transfer" - }, - "faraday_efficiency": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "Faraday efficiencies of the individual species." - } - }, - "title": "SpeciesData", - "type": "object" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "plant_setup": { - "anyOf": [ - { - "$ref": "#/$defs/PlantSetup" - }, - { - "type": "null" - } - ], - "description": "the individual plant setup that is used in this one experiment." - }, - "measurements": { - "description": "different measurements that are made within the scope of one experiment.", - "items": { - "$ref": "#/$defs/Measurement" - }, - "multiple": true, - "title": "Measurements", - "type": "array" - }, - "species_data": { - "description": "all provided and calculated data about a specific species.", - "items": { - "$ref": "#/$defs/SpeciesData" - }, - "multiple": true, - "title": "Species Data", - "type": "array" - } - }, - "title": "Experiment", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/GeneralInformation.json b/FAIRFlowChemistry/schemes/json/GeneralInformation.json deleted file mode 100644 index 0799eb1..0000000 --- a/FAIRFlowChemistry/schemes/json/GeneralInformation.json +++ /dev/null @@ -1,426 +0,0 @@ -{ - "$defs": { - "Author": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "full name including given and family name.", - "title": "Name" - }, - "affiliation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "organization the author is affiliated to.", - "title": "Affiliation" - }, - "identifier_scheme": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the identifier scheme (ORCID, ISNI).", - "title": "Identifier Scheme" - }, - "identifier": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Uniquely identifies an individual author or organization, according to various schemes.", - "title": "Identifier" - } - }, - "title": "Author", - "type": "object" - }, - "Contact": { - "description": "Small type for attribute 'contact'", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Name" - }, - "affiliation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Affiliation" - }, - "email": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Email" - } - }, - "title": "Contact", - "type": "object" - }, - "Keyword": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Key terms that describe important aspects of the Dataset.", - "title": "Value" - }, - "vocabulary": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "For the specification of the keyword controlled vocabulary in use, such as LCSH, MeSH, or others.", - "title": "Vocabulary" - }, - "vocabulary_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Keyword vocabulary URI points to the web presence that describes the keyword vocabulary, if appropriate.", - "title": "Vocabulary Uri" - } - }, - "title": "Keyword", - "type": "object" - }, - "RelatedPublication": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "citation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The full bibliographic citation for this related publication.", - "title": "Citation" - }, - "id_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The type of digital identifier used for this publication (e.g., Digital Object Identifier (DOI)).", - "title": "Id Type" - }, - "id_number": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "'The identifier for the selected ID type.'", - "title": "Id Number" - }, - "url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "'Link to the publication web page (e.g., journal article page, archive record page, or other).", - "title": "Url" - } - }, - "title": "RelatedPublication", - "type": "object" - }, - "TopicClassification": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Topic or Subject term that is relevant to this Dataset.", - "title": "Value" - }, - "vocab": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Provided for specification of the controlled vocabulary in use, e.g., LCSH, MeSH, etc.", - "title": "Vocab" - }, - "vocab_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Specifies the URI location for the full controlled vocabulary.", - "title": "Vocab Uri" - } - }, - "title": "TopicClassification", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "title": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "title of the work.", - "title": "Title" - }, - "project": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the project this work is related to.", - "title": "Project" - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "describes the content of the dataset.", - "title": "Description" - }, - "authors": { - "description": "authors of this dataset.", - "items": { - "$ref": "#/$defs/Author" - }, - "multiple": true, - "title": "Authors", - "type": "array" - }, - "contact": { - "anyOf": [ - { - "$ref": "#/$defs/Contact" - }, - { - "type": "null" - } - ], - "description": "point of contact for this projecet" - }, - "subject": { - "description": "Domain-specific Subject Categories that are topically relevant to the Dataset.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Subject", - "type": "array" - }, - "related_publication": { - "anyOf": [ - { - "$ref": "#/$defs/RelatedPublication" - }, - { - "type": "null" - } - ], - "description": "Related publication to the dataset." - }, - "keywords": { - "description": "Keywords and url related to the project.", - "items": { - "$ref": "#/$defs/Keyword" - }, - "multiple": true, - "title": "Keywords", - "type": "array" - }, - "topic_classification": { - "description": "Topic classification.", - "items": { - "$ref": "#/$defs/TopicClassification" - }, - "multiple": true, - "title": "Topic Classification", - "type": "array" - } - }, - "title": "GeneralInformation", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/GenericAttibute.json b/FAIRFlowChemistry/schemes/json/GenericAttibute.json deleted file mode 100644 index d2e364e..0000000 --- a/FAIRFlowChemistry/schemes/json/GenericAttibute.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Keyword.json b/FAIRFlowChemistry/schemes/json/Keyword.json deleted file mode 100644 index 8319d40..0000000 --- a/FAIRFlowChemistry/schemes/json/Keyword.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Key terms that describe important aspects of the Dataset.", - "title": "Value" - }, - "vocabulary": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "For the specification of the keyword controlled vocabulary in use, such as LCSH, MeSH, or others.", - "title": "Vocabulary" - }, - "vocabulary_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Keyword vocabulary URI points to the web presence that describes the keyword vocabulary, if appropriate.", - "title": "Vocabulary Uri" - } - }, - "title": "Keyword", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/MassFlowMeter.json b/FAIRFlowChemistry/schemes/json/MassFlowMeter.json deleted file mode 100644 index b3b86eb..0000000 --- a/FAIRFlowChemistry/schemes/json/MassFlowMeter.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Parameter": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "values.", - "title": "Value" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Parameter", - "type": "object" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "manufacturer": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the manufacturer of the device.", - "title": "Manufacturer" - }, - "device_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type given by the manufacturer of the device.", - "title": "Device Type" - }, - "series": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "the series of the device.", - "title": "Series" - }, - "on_off": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "operational mode of the flow module. True is on and False is off.", - "title": "On Off" - }, - "min_flow": { - "anyOf": [ - { - "$ref": "#/$defs/Parameter" - }, - { - "type": "null" - } - ], - "description": "Minimum possible flow rate." - }, - "max_flow": { - "anyOf": [ - { - "$ref": "#/$defs/Parameter" - }, - { - "type": "null" - } - ], - "description": "Maximum possible flow rate." - } - }, - "title": "MassFlowMeter", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Measurement.json b/FAIRFlowChemistry/schemes/json/Measurement.json deleted file mode 100644 index 33037d9..0000000 --- a/FAIRFlowChemistry/schemes/json/Measurement.json +++ /dev/null @@ -1,537 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Component": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "component_type": { - "anyOf": [ - { - "$ref": "#/$defs/ComponentType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "equipment or piping component." - }, - "component_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "id used to unambiguously identify the component.", - "title": "Component Id" - }, - "component_class": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "class of the component.", - "title": "Component Class" - }, - "component_class_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "uri of the component.", - "title": "Component Class Uri" - }, - "component_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the component used to link between the abstract component and its shape.", - "title": "Component Name" - }, - "generic_attributes": { - "description": "a generic attribute as defined by DEXPI.", - "items": { - "$ref": "#/$defs/GenericAttibute" - }, - "multiple": true, - "title": "Generic Attributes", - "type": "array" - }, - "connections": { - "description": "component id of other component this component is connected to via pipes, wires or similar.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Connections", - "type": "array" - } - }, - "title": "Component", - "type": "object" - }, - "ComponentType": { - "enum": [ - "Equipment", - "Piping component" - ], - "title": "ComponentType", - "type": "string" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "DataType": { - "enum": [ - "string", - "float", - "date", - "time", - "datetime", - "Boolean", - "int", - "NONE", - "label" - ], - "title": "DataType", - "type": "string" - }, - "GenericAttibute": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" - }, - "MeasurementType": { - "enum": [ - "Potentiostatic measurement", - "GC measurement", - "MFM measurement" - ], - "title": "MeasurementType", - "type": "string" - }, - "Metadata": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "parameter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the parameter.", - "title": "Parameter" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "format": "date-time", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "value of the parameter.", - "title": "Value" - }, - "abbreviation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "abbreviation for the parameter.", - "title": "Abbreviation" - }, - "data_type": { - "anyOf": [ - { - "$ref": "#/$defs/DataType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the parameter." - }, - "mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mode of the parameter. e.g., on and off.", - "title": "Mode" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the parameter." - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "description of the parameter.", - "title": "Description" - } - }, - "title": "Metadata", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "measurement_type": { - "anyOf": [ - { - "$ref": "#/$defs/MeasurementType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of a measurement, e.g. potentiostatic or gas chromatography." - }, - "metadata": { - "description": "metadata of a measurement.", - "items": { - "$ref": "#/$defs/Metadata" - }, - "multiple": true, - "title": "Metadata", - "type": "array" - }, - "experimental_data": { - "description": "experimental data of a measurement.", - "items": { - "$ref": "#/$defs/Data" - }, - "multiple": true, - "title": "Experimental Data", - "type": "array" - }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/Component" - }, - { - "type": "null" - } - ], - "description": "measuring device the data stems from." - } - }, - "title": "Measurement", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Metadata.json b/FAIRFlowChemistry/schemes/json/Metadata.json deleted file mode 100644 index 180d9c0..0000000 --- a/FAIRFlowChemistry/schemes/json/Metadata.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "DataType": { - "enum": [ - "string", - "float", - "date", - "time", - "datetime", - "Boolean", - "int", - "NONE", - "label" - ], - "title": "DataType", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "parameter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the parameter.", - "title": "Parameter" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "format": "date-time", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "value of the parameter.", - "title": "Value" - }, - "abbreviation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "abbreviation for the parameter.", - "title": "Abbreviation" - }, - "data_type": { - "anyOf": [ - { - "$ref": "#/$defs/DataType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the parameter." - }, - "mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mode of the parameter. e.g., on and off.", - "title": "Mode" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the parameter." - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "description of the parameter.", - "title": "Description" - } - }, - "title": "Metadata", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Parameter.json b/FAIRFlowChemistry/schemes/json/Parameter.json deleted file mode 100644 index f03e10e..0000000 --- a/FAIRFlowChemistry/schemes/json/Parameter.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "values.", - "title": "Value" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Parameter", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/PlantSetup.json b/FAIRFlowChemistry/schemes/json/PlantSetup.json deleted file mode 100644 index 05de176..0000000 --- a/FAIRFlowChemistry/schemes/json/PlantSetup.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "$defs": { - "Component": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "component_type": { - "anyOf": [ - { - "$ref": "#/$defs/ComponentType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "equipment or piping component." - }, - "component_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "id used to unambiguously identify the component.", - "title": "Component Id" - }, - "component_class": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "class of the component.", - "title": "Component Class" - }, - "component_class_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "uri of the component.", - "title": "Component Class Uri" - }, - "component_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the component used to link between the abstract component and its shape.", - "title": "Component Name" - }, - "generic_attributes": { - "description": "a generic attribute as defined by DEXPI.", - "items": { - "$ref": "#/$defs/GenericAttibute" - }, - "multiple": true, - "title": "Generic Attributes", - "type": "array" - }, - "connections": { - "description": "component id of other component this component is connected to via pipes, wires or similar.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Connections", - "type": "array" - } - }, - "title": "Component", - "type": "object" - }, - "ComponentType": { - "enum": [ - "Equipment", - "Piping component" - ], - "title": "ComponentType", - "type": "string" - }, - "GenericAttibute": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Name" - }, - "attribute_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Attribute Uri" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Value" - }, - "format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Format" - }, - "units": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla.", - "title": "Units" - }, - "units_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "bla", - "title": "Units Uri" - } - }, - "title": "GenericAttibute", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "components": { - "description": "bla.", - "items": { - "$ref": "#/$defs/Component" - }, - "multiple": true, - "title": "Components", - "type": "array" - }, - "input": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Input", - "type": "array" - }, - "output": { - "description": "bla.", - "items": { - "type": "string" - }, - "multiple": true, - "title": "Output", - "type": "array" - } - }, - "title": "PlantSetup", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Potentiostat.json b/FAIRFlowChemistry/schemes/json/Potentiostat.json deleted file mode 100644 index 35d1bd4..0000000 --- a/FAIRFlowChemistry/schemes/json/Potentiostat.json +++ /dev/null @@ -1,419 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "DataType": { - "enum": [ - "string", - "float", - "date", - "time", - "datetime", - "Boolean", - "int", - "NONE", - "label" - ], - "title": "DataType", - "type": "string" - }, - "Measurement": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "measurement_type": { - "anyOf": [ - { - "$ref": "#/$defs/MeasurementType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of a measurement, e.g. potentiostatic or gas chromatography." - }, - "metadata": { - "description": "metadata of a measurement.", - "items": { - "$ref": "#/$defs/Metadata" - }, - "multiple": true, - "title": "Metadata", - "type": "array" - }, - "experimental_data": { - "description": "experimental data of a measurement.", - "items": { - "$ref": "#/$defs/Data" - }, - "multiple": true, - "title": "Experimental Data", - "type": "array" - } - }, - "title": "Measurement", - "type": "object" - }, - "MeasurementType": { - "enum": [ - "Potentiostatic measurement", - "Galvanostatic measurement", - "GC measurement", - "MFM measurement" - ], - "title": "MeasurementType", - "type": "string" - }, - "Metadata": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "parameter": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the parameter.", - "title": "Parameter" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "format": "date-time", - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "value of the parameter.", - "title": "Value" - }, - "abbreviation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "abbreviation for the parameter.", - "title": "Abbreviation" - }, - "data_type": { - "anyOf": [ - { - "$ref": "#/$defs/DataType" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the parameter.", - "title": "Data Type" - }, - "mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mode of the parameter. E.g., on and off.", - "title": "Mode" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the parameter." - }, - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "description of the parameter.", - "title": "Description" - } - }, - "title": "Metadata", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "manufacturer": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the manufacturer of the device.", - "title": "Manufacturer" - }, - "device_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type given by the manufacturer of the device.", - "title": "Device Type" - }, - "series": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "the series of the device.", - "title": "Series" - }, - "on_off": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "operational mode of the flow module. True is on and False is off.", - "title": "On Off" - }, - "measurement": { - "anyOf": [ - { - "$ref": "#/$defs/Measurement" - }, - { - "type": "null" - } - ], - "description": "Measuring Data." - }, - "metadata": { - "anyOf": [ - { - "$ref": "#/$defs/Metadata" - }, - { - "type": "null" - } - ], - "description": "Metadata of the Potentiostat." - } - }, - "title": "Potentiostat", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Pump.json b/FAIRFlowChemistry/schemes/json/Pump.json deleted file mode 100644 index cee7e5a..0000000 --- a/FAIRFlowChemistry/schemes/json/Pump.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "$defs": { - "PumpType": { - "enum": [ - "Tubing pump", - "Diaphragm pump" - ], - "title": "PumpType", - "type": "string" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "manufacturer": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the manufacturer of the device.", - "title": "Manufacturer" - }, - "device_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type given by the manufacturer of the device.", - "title": "Device Type" - }, - "series": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "the series of the device.", - "title": "Series" - }, - "on_off": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "operational mode of the flow module. True is on and False is off.", - "title": "On Off" - }, - "pump_type": { - "anyOf": [ - { - "$ref": "#/$defs/PumpType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of the pump." - } - }, - "title": "Pump", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/RelatedPublication.json b/FAIRFlowChemistry/schemes/json/RelatedPublication.json deleted file mode 100644 index db01068..0000000 --- a/FAIRFlowChemistry/schemes/json/RelatedPublication.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "citation": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The full bibliographic citation for this related publication.", - "title": "Citation" - }, - "id_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The type of digital identifier used for this publication (e.g., Digital Object Identifier (DOI)).", - "title": "Id Type" - }, - "id_number": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "'The identifier for the selected ID type.'", - "title": "Id Number" - }, - "url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "'Link to the publication web page (e.g., journal article page, archive record page, or other).", - "title": "Url" - } - }, - "title": "RelatedPublication", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/SpeciesData.json b/FAIRFlowChemistry/schemes/json/SpeciesData.json deleted file mode 100644 index 14c7f27..0000000 --- a/FAIRFlowChemistry/schemes/json/SpeciesData.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "$defs": { - "BaseUnit": { - "properties": { - "scale": { - "title": "Scale", - "type": "number" - }, - "kind": { - "title": "Kind", - "type": "string" - }, - "exponent": { - "title": "Exponent", - "type": "number" - } - }, - "required": [ - "scale", - "kind", - "exponent" - ], - "title": "BaseUnit", - "type": "object" - }, - "Calibration": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "peak_areas": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "recorded peak areas of the individual calibration solutions." - }, - "concentrations": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "concentrations of the individual calibration solutions." - }, - "regression_coefficients": { - "description": "regression coefficients in order of increasing degree.", - "items": { - "type": "number" - }, - "multiple": true, - "title": "Regression Coefficients", - "type": "array" - }, - "degree": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 1, - "description": "degree of regression model.", - "title": "Degree" - } - }, - "title": "Calibration", - "type": "object" - }, - "Data": { - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "quantity": { - "anyOf": [ - { - "$ref": "#/$defs/Quantity" - }, - { - "type": "null" - } - ], - "default": null, - "description": "quantity of a value." - }, - "values": { - "description": "values.", - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "format": "date-time", - "type": "string" - } - ] - }, - "multiple": true, - "title": "Values", - "type": "array" - }, - "unit": { - "anyOf": [ - { - "$ref": "#/$defs/Unit" - }, - { - "type": "null" - } - ], - "default": null, - "description": "unit of the values." - } - }, - "title": "Data", - "type": "object" - }, - "Quantity": { - "enum": [ - "Time", - "Voltage", - "Current", - "Electrode surface area", - "Concentration", - "Mass", - "Mass flow rate", - "Volumetric flow rate", - "Date time", - "Fraction", - "Retention time", - "Peak type", - "Peak area", - "Peak height", - "Peak area percentage", - "Peak assignment", - "Faraday efficiency" - ], - "title": "Quantity", - "type": "string" - }, - "Unit": { - "description": "Represents a unit type.\n\nAttributes:\n scale (float): The scale of the unit.\n bases (list[Union[str, UnitBase]]): The bases of the unit.\n powers (list[float]): The powers of the unit.\n _unit (Union[UnitBase, UnitBase]): The internal unit object.\n\nMethods:\n _serialize_bases: Serializes the bases of the unit.\n from_string: Creates a Unit object from a string representation.\n from_astropy_unit: Creates an instance of the class from an Astropy unit.\n to_unit_string: Returns a string representation of the unit.", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "name": { - "title": "Name", - "type": "string" - }, - "bases": { - "items": { - "$ref": "#/$defs/BaseUnit" - }, - "title": "Bases", - "type": "array" - } - }, - "required": [ - "name", - "bases" - ], - "title": "Unit", - "type": "object" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "species": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the species.", - "title": "Species" - }, - "chemical_formula": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "chemical formula of the species.", - "title": "Chemical Formula" - }, - "calibration": { - "anyOf": [ - { - "$ref": "#/$defs/Calibration" - }, - { - "type": "null" - } - ], - "description": "calibration measurement." - }, - "correction_factor": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "correction factors of the individual species.", - "title": "Correction Factor" - }, - "electron_transfer": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Number of transfered electrons of the individual species.", - "title": "Electron Transfer" - }, - "faraday_efficiency": { - "anyOf": [ - { - "$ref": "#/$defs/Data" - }, - { - "type": "null" - } - ], - "description": "Faraday efficiencies of the individual species." - } - }, - "title": "SpeciesData", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Stoichiometry.json b/FAIRFlowChemistry/schemes/json/Stoichiometry.json deleted file mode 100644 index dfcd18b..0000000 --- a/FAIRFlowChemistry/schemes/json/Stoichiometry.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "description": "Stoichiometric information about the compound.", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "equivalents": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "used equivalents in relation to the reference compound", - "title": "Equivalents" - }, - "amount_of_substance": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "amount of substance n in mmol", - "title": "Amount Of Substance" - }, - "mass": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "used mass of the compound in g", - "title": "Mass" - }, - "volume": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "volume of the compound", - "title": "Volume" - }, - "density": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "density of the compound at standard temperature and pressure.", - "title": "Density" - }, - "molar_mass": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "molar mass of the compound in g per mol", - "title": "Molar Mass" - }, - "mass_concentration": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "mass concentration in percent.", - "title": "Mass Concentration" - }, - "molar_concentration": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "molar concentration in mol per l.", - "title": "Molar Concentration" - } - }, - "title": "Stoichiometry", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Thermocouple.json b/FAIRFlowChemistry/schemes/json/Thermocouple.json deleted file mode 100644 index 9f69178..0000000 --- a/FAIRFlowChemistry/schemes/json/Thermocouple.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "$defs": { - "ThermocoupleType": { - "enum": [ - "Type J", - "Type K" - ], - "title": "ThermocoupleType", - "type": "string" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "manufacturer": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "name of the manufacturer of the device.", - "title": "Manufacturer" - }, - "device_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type given by the manufacturer of the device.", - "title": "Device Type" - }, - "series": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "the series of the device.", - "title": "Series" - }, - "on_off": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "description": "operational mode of the flow module. True is on and False is off.", - "title": "On Off" - }, - "thermocouple_type": { - "anyOf": [ - { - "$ref": "#/$defs/ThermocoupleType" - }, - { - "type": "null" - } - ], - "default": null, - "description": "type of thermocouple like J, K and so on." - } - }, - "title": "Thermocouple", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/TopicClassification.json b/FAIRFlowChemistry/schemes/json/TopicClassification.json deleted file mode 100644 index df54637..0000000 --- a/FAIRFlowChemistry/schemes/json/TopicClassification.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "value": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Topic or Subject term that is relevant to this Dataset.", - "title": "Value" - }, - "vocab": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Provided for specification of the controlled vocabulary in use, e.g., LCSH, MeSH, etc.", - "title": "Vocab" - }, - "vocab_uri": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Specifies the URI location for the full controlled vocabulary.", - "title": "Vocab Uri" - } - }, - "title": "TopicClassification", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/schemes/json/Tubing.json b/FAIRFlowChemistry/schemes/json/Tubing.json deleted file mode 100644 index 51b4d50..0000000 --- a/FAIRFlowChemistry/schemes/json/Tubing.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "$defs": { - "Insulation": { - "description": "Small type for attribute 'insulation'", - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "thickness": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Thickness" - }, - "material": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Material" - } - }, - "title": "Insulation", - "type": "object" - }, - "Material": { - "enum": [ - "Stainless Steel 1.4404", - "Stainless Steel 1.4571", - "Stainless Steel 1.4301", - "PTFE", - "PFA", - "Stone Wool", - "Glass Wool", - "Glass Fiber" - ], - "title": "Material", - "type": "string" - } - }, - "properties": { - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Unique identifier of the given object.", - "title": "Id" - }, - "material": { - "anyOf": [ - { - "$ref": "#/$defs/Material" - }, - { - "type": "null" - } - ], - "default": null, - "description": "material with which the fluid flowing through comes into contact." - }, - "inner_diameter": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "inner diameter of the tubing in mm.", - "title": "Inner Diameter" - }, - "outer_diameter": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "outer diameter of the tubing in mm.", - "title": "Outer Diameter" - }, - "length": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "length of the tubing in mm.", - "title": "Length" - }, - "insulation": { - "anyOf": [ - { - "$ref": "#/$defs/Insulation" - }, - { - "type": "null" - } - ], - "description": "insulation of the tubing." - } - }, - "title": "Tubing", - "type": "object" -} \ No newline at end of file diff --git a/FAIRFlowChemistry/tools/.ipynb_checkpoints/initialize-checkpoint.py b/FAIRFlowChemistry/tools/.ipynb_checkpoints/initialize-checkpoint.py deleted file mode 100644 index 8a11e0e..0000000 --- a/FAIRFlowChemistry/tools/.ipynb_checkpoints/initialize-checkpoint.py +++ /dev/null @@ -1,172 +0,0 @@ -#!~/miniconda3/bin/python - -import os -import ipywidgets as widgets -from typing import List -from pathlib import Path -from IPython.display import display, clear_output - -# Import Dataset -from FAIRFlowChemistry.core import Dataset - - -class initialize_dataset: - - def save_dataset(self,_): - - with self.button_output: - clear_output(wait=True) - - print("Saving dataset!") - - # Add title - self.dataset.general_information.title = self.title.value - - # Add description - self.dataset.general_information.description = self.description.value - - # Add project group - self.dataset.general_information.project = self.project.value - - # Add authors to the dataset - for aut,aff,ident in zip( self.authors.value.split(","), self.affiliations.value.split(","), self.identifier.value.split(",") ): - self.dataset.general_information.add_to_authors( name = aut.strip(), - affiliation = aff.strip(), - identifier_scheme = self.identifier_scheme.value, - identifier = ident.strip() ) - - # Add contact (search contact in provided authors) - affili = [ aff for aut,aff in zip(self.authors.value.split(","), self.affiliations.value.split(",")) if aut.strip() == self.contact_text.value.split(",")[0].strip() ] - affili = affili[0] if bool(affili) else None - - self.dataset.general_information.contact = dict( name = self.contact_text.value.split(",")[0].strip(), - email = self.contact_text.value.split(",")[1].strip(), - affiliation = affili ) - - # Add subject - self.dataset.general_information.subject = list( self.subject_selection.value ) - - # Add related publication - self.dataset.general_information.related_publication = dict( citation = self.related_publication.value.split(",")[0].strip(), - url = self.related_publication.value.split(",")[1].strip() ) - - # Add topic classifications - for i in range(0, len(self.topic_classification.value.split(",")), 2): - self.dataset.general_information.add_to_topic_classification( value = self.topic_classification.value.split(",")[i].strip() , - vocab_uri = self.topic_classification.value.split(",")[i + 1].strip() ) - - # Add keywords - for i in range(0, len(self.keywords.value.split(",")), 2): - self.dataset.general_information.add_to_keywords( value = self.keywords.value.split(",")[i].strip() , - vocabulary_uri = self.keywords.value.split(",")[i + 1].strip() ) - - # Write dataset # - os.makedirs( os.path.dirname(self.dataset_text.value), exist_ok=True ) - with open( "%s.json"%self.dataset_text.value, "w") as f: f.write(self.dataset.json()) - - def change_dataset(self,_): - self.button_save.description = 'Save dataset as: %s.json'%self.dataset_text.value - - def write_dataset(self, subjects: List=[] ) -> None: - - self.title = widgets.Text(description="Title of the project:", - placeholder="Type the title of the project", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.description = widgets.Text(description="Description of the project:", - placeholder="Describe the project", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.project = widgets.Text(description="Project:", - placeholder="Name of the project group (e.g.: Project B07)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.authors = widgets.Text(description="Author list:", - placeholder="Name the authors of the project (e.g.: author1, author2, ...)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.affiliations = widgets.Text(description="Affiliations:", - placeholder="Name the affiliation fo each author (e.g.: University of Stuttgart, TUM, ...)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - - self.identifier_scheme = widgets.Dropdown(options= ["ORCID"], - description="Choose unique identifier scheme:", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.identifier = widgets.Text(description="Unique identifier:", - placeholder="Provide identifier according to choosen identifier scheme (e.g. for ORCID: xxxx-xxxx-xxxx-xxxx) for every author", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.contact_text = widgets.Text(description="Contact:", - placeholder="Name the contact of the project (e.g.: Max Mustermann, max.mustermann@universityofstuttgart.de)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.subject_selection = widgets.SelectMultiple( options=subjects, - description="Choose subjects (press and hold 'strg' to select several):", - value=["Chemistry"], - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'} ) - - self.related_publication = widgets.Text (description="Related publication:", - placeholder="The full bibliographic citation for this related publication and link to the publication web page, separated by a comma (e.g.: M. Mustermann Publication: Test. J. Chem. Phys. xxx, xxx (xxx), https://doi.org/xxx )", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - - self.topic_classification = widgets.Text (description="Topic classification:", - placeholder="The classification and the url, seperated by a comma (e.g.: homogeneous catalysis (LCSH), https://xxx, polyethers (LCSH), https://xxx, ... )", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.keywords = widgets.Text (description="Keywords:", - placeholder="The keywords and the url, seperated by a comma (e.g.: polymer chemistry (Loterre Chemistry Vocabulary), https://xxx )", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - - self.dataset_text = widgets.Text(description="Dataset:", - placeholder="Name the dataset for this project (will be saved as json file)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.button_save = widgets.Button(description='Save dataset as: %s.json'%self.dataset_text.value, - layout=widgets.Layout(width="30%"), - style={"button_color": 'lightblue'}) - - # Initialize the datamodel - self.dataset = Dataset() - - # Handle on observing - self.dataset_text.observe(self.change_dataset,names="value") - - # Handle button - self.button_save.on_click(self.save_dataset) - - # Output spaces - self.button_output = widgets.Output() - - # Widgets - v_space = widgets.VBox([widgets.Label(value='')], layout=widgets.Layout(height='30px')) - - widgets0 = widgets.VBox([self.title, self.description, self.project,v_space]) - widgets1 = widgets.VBox([self.authors, self.affiliations, self.contact_text, v_space, self.identifier_scheme, self.identifier, v_space]) - widgets2 = widgets.VBox([self.subject_selection, self.related_publication, self.topic_classification, self.keywords, v_space]) - widgets3 = widgets.VBox([self.dataset_text, v_space]) - widgets4 = widgets.VBox([self.button_save, self.button_output], layout=widgets.Layout(align_items = 'center') ) - - # Combine the layout - full_layout = widgets.VBox([widgets0, widgets1, widgets2, widgets3, widgets4]) - - # Display the layout - display(full_layout) - - return diff --git a/FAIRFlowChemistry/tools/__init__.py b/FAIRFlowChemistry/tools/__init__.py deleted file mode 100644 index 5769f59..0000000 --- a/FAIRFlowChemistry/tools/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .initialize import initialize_dataset -from .acquisition import reading_raw_data_widget -from .analysis import analyzing_raw_data_widget - - diff --git a/FAIRFlowChemistry/tools/acquisition.py b/FAIRFlowChemistry/tools/acquisition.py deleted file mode 100644 index 771afd2..0000000 --- a/FAIRFlowChemistry/tools/acquisition.py +++ /dev/null @@ -1,485 +0,0 @@ -#!~/miniconda3/bin/python - -import ipywidgets as widgets - -from pathlib import Path -from typing import List -from IPython.display import display, clear_output - -# Import general tools and objects of this datamodel - -# Objects -from FAIRFlowChemistry.core import Dataset, Experiment, PlantSetup - -# Tools -from .auxiliary import Librarian, explorer -from .reader import gc_parser, gstatic_parser, mfm_parser, DEXPI2sdRDM - - -class measurement_object: - """ - Class that stores widgets for measurement files - """ - - def __init__(self, name: str, component_list: List[str]) -> None: - - # Safe name - self.name = name - - # Define portion of component dropdown to path tags - portion = 3 - - self.potentio_component = widgets.Dropdown( - options=[""] + component_list, - description="Corresponding plant component", - layout=widgets.Layout(flex=str(portion)), - style={"description_width": "auto"}, - ) - - self.gc_component = widgets.Dropdown( - options=[""] + component_list, - description="Corresponding plant component", - layout=widgets.Layout(flex=str(portion)), - style={"description_width": "auto"}, - ) - - self.mfm_component = widgets.Dropdown( - options=[""] + component_list, - description="Corresponding plant component", - layout=widgets.Layout(flex=str(portion)), - style={"description_width": "auto"}, - ) - - self.potentio_files = widgets.TagsInput( - allow_duplicates=False, layout=widgets.Layout(flex=str(10 - portion)) - ) - self.GC_files = widgets.TagsInput( - allow_duplicates=False, layout=widgets.Layout(flex=str(10 - portion)) - ) - self.MFM_files = widgets.TagsInput( - allow_duplicates=False, layout=widgets.Layout(flex=str(10 - portion)) - ) - - widgets0 = widgets.VBox( - [ - widgets.Label(value="Files for potentiostat:"), - widgets.HBox([self.potentio_files, self.potentio_component]), - ] - ) - widgets1 = widgets.VBox( - [ - widgets.Label(value="Files for gas chromatograph:"), - widgets.HBox([self.GC_files, self.gc_component]), - ] - ) - widgets2 = widgets.VBox( - [ - widgets.Label(value="Files for mass flow meter:"), - widgets.HBox([self.MFM_files, self.mfm_component]), - ] - ) - - # Combine the layout - self.full_layout = widgets.VBox([widgets0, widgets1, widgets2]) - - def update_component_list(self, component_list: List[str]): - self.potentio_component.options = [""] + component_list - self.gc_component.options = [""] + component_list - self.mfm_component.options = [""] + component_list - - -class reading_raw_data_widget: - - def dataset_input_handler(self, _): - try: - with open(self.dataset_dropdown.value) as f: - self.dataset = Dataset.from_json(f) - self.experiments.value = [exp.id for exp in self.dataset.experiments] - self.plant = ( - self.dataset.experiments[0].plant_setup - if self.dataset.experiments - else PlantSetup() - ) - - # Update component list - self.component_list = [pl.component_id for pl in self.plant.components] - - if self.component_list: - with self.pid_output: - clear_output(wait=False) - print("PID taken from first experiment of dataset!\n") - else: - with self.pid_output: - clear_output(wait=False) - print("") - - # Call measurement input handler to update - self.measurement_input_handler(None) - - # Update button description - self.button_save.description = f"Save dataset as: {self.dataset_dropdown.value.name}" - - except: - raise KeyError("\nChoosen dataset cannot be interpreted!\n") - - def add_file(self, category: str, file: str): - # Function that adds a file to a chosen category - # The file is added to the selected measurement tab to the selected children (potentiostat, gas chromatograph, etc.) - if category == "Potentiostat": - self.tabs.children[self.tabs.selected_index].children[0].children[ - 1 - ].value = self.tabs.children[self.tabs.selected_index].children[0].children[ - 1 - ].value + [ - file - ] - elif category == "Gas chromatograph": - self.tabs.children[self.tabs.selected_index].children[1].children[ - 1 - ].value = self.tabs.children[self.tabs.selected_index].children[1].children[ - 1 - ].value + [ - file - ] - elif category == "Mass flow meter": - self.tabs.children[self.tabs.selected_index].children[2].children[ - 1 - ].value = self.tabs.children[self.tabs.selected_index].children[2].children[ - 1 - ].value + [ - file - ] - elif category == "Species data": - self.species_file.value = file - - elif category == "P&ID": - self.pid_file.value = file - - def read_pid(self, _): - # Function that reads in DEXPI PID file and generates the PlantSetup - self.plant = DEXPI2sdRDM(self.pid_file.value) - - with self.pid_output: - self.pid_output.clear_output(wait=False) - print("PID sucessfully read out!\n") - - # Update component list - self.component_list = [pl.component_id for pl in self.plant.components] - - # Call tab widget - self.measurement_input_handler(None) - - def visualize_pid(self, _): - # Function that visualizes the PID as graph - # If plant is just initialized read in PID first - if not self.plant.components: - self.read_pid(None) - self.plant.visualize() - - def measurement_input_handler(self, _): - - # Delete measurement object that are not in the measurements widget anymore - del_idx = [ - i - for i, obj in enumerate(self.measurement_objects) - if not obj.name in self.measurements.value - ] - del_idx.sort(reverse=True) - - for idx in del_idx: - del self.measurement_objects[idx] - - # Get names of current experiments - measurement_names = [obj.name for obj in self.measurement_objects] - - # Add new measurement objects if they are not already there - for i, measurement in enumerate(self.measurements.value): - if not measurement in measurement_names: - self.measurement_objects.insert( - i, - measurement_object( - name=measurement, component_list=self.component_list - ), - ) - - # Update component list of all exisiting measurements - for obj in self.measurement_objects: - obj.update_component_list(self.component_list) - - # Call measurement tab widget - self.measurement_tabs() - - def measurement_tabs(self): - - # Define tab widget - self.tabs = widgets.Tab([obj.full_layout for obj in self.measurement_objects]) - - # Set title of the tabs - for i, title in enumerate([obj.name for obj in self.measurement_objects]): - self.tabs.set_title(i, title) - - heading = widgets.Label(value="Files for measurements:") - - with self.tab_output: - self.tab_output.clear_output(wait=False) - display(widgets.VBox([heading, self.tabs])) - - def add_experiment(self, _): - - ## Read in selected raw data and save it in Experiment class ## - if not self.experiment_name.value: - raise ValueError("Provide experiment name!\n") - - # Define experiment object - experiment = Experiment(id=self.experiment_name.value) - - # Add plant setup - experiment.plant_setup = self.plant - - # Get all measurements and add to experiment - for measurement in self.measurement_objects: - - pot_measurements = [ - gstatic_parser(metadata_path=potentiostat_file) - for potentiostat_file in measurement.potentio_files.value - ] - mfm_measurements = [ - mfm_parser(experimental_data_path=mfm_file) - for mfm_file in measurement.MFM_files.value - ] - gc_measurements = [ - gc_parser( - metadata_path=measurement.GC_files.value[i], - experimental_data_path=measurement.GC_files.value[i + 1], - ) - for i in range(0, len(measurement.GC_files.value), 2) - ] - - # Add corresponding DEXPI component for each measurement - for i, pm in enumerate(pot_measurements): - pm.id = f'{measurement.name.replace(" ", "")}_potentiostat_{i}' - - # Add defined source of measurement - if measurement.potentio_component.value in self.component_list: - pm.source = self.plant.components[ - self.component_list.index(measurement.potentio_component.value) - ] - - for i, mm in enumerate(mfm_measurements): - mm.id = f'{measurement.name.replace(" ", "")}_massflowmeter_{i}' - - # Add defined source of measurement - if measurement.mfm_component.value in self.component_list: - mm.source = self.plant.components[ - self.component_list.index(measurement.mfm_component.value) - ] - - for i, gm in enumerate(gc_measurements): - gm.id = f'{measurement.name.replace(" ", "")}_gaschromatograph{i}' - - # Add defined source of measurement - if measurement.gc_component.value in self.component_list: - gm.source = self.plant.components[ - self.component_list.index(measurement.gc_component.value) - ] - - for measurement in [*pot_measurements, *mfm_measurements, *gc_measurements]: - experiment.add_to_measurements(**measurement.model_dump()) - - # Initialize species data such as calibration, correction factors and transfering eletron number - experiment.initialize_species_from_yaml(self.species_file.value) - - # Append new experiment to current dataset - self.dataset.experiments.append(experiment) - - # Update experiment list - self.experiments.value = [exp.id for exp in self.dataset.experiments] - - # Empty files widget - self.measurements.value = [] - self.experiment_name.value = "" - - def experiment_input_handler(self, _): - - # Delete experiment objects that are not in the experiment widget anymore - del_idx = [ - i - for i, exp in enumerate(self.dataset.experiments) - if not exp.id in self.experiments.value - ] - del_idx.sort(reverse=True) - - for idx in del_idx: - del self.dataset.experiments[idx] - - def save_dataset(self, _): - # Function to save dataset - with open(self.dataset_dropdown.value, "w") as f: - f.write(self.dataset.json()) - print("Dataset saved.") - - def choose_data(self, root: Path, dataset_directory: str) -> None: - - self.librarian = Librarian(root_directory=root) - datasets = self.librarian.search_files_in_subdirectory( - root_directory=root, - directory_keys=[dataset_directory], - file_filter="json", - verbose=False, - ) - - # Define ouput for some widgets - self.pid_output = widgets.Output() - self.tab_output = widgets.Output() - - # Call explorer widget - self.explorer = explorer() - explorer_widget = self.explorer.main( - root=root, - file_categories=[ - "Potentiostat", - "Gas chromatograph", - "Mass flow meter", - "Species data", - "P&ID", - ], - add_file_callalbe=self.add_file, - ) - - # Define all widgets - self.dataset_dropdown = widgets.Dropdown( - options=[("", Path(""))] - + [(path.parts[-1], path) for _, path in datasets.items()], - description="Choose dataset", - layout=widgets.Layout(width="auto"), - style={"description_width": "auto"}, - ) - - self.experiment_name = widgets.Text( - description="Experiment name:", - placeholder="Provide a name for the experiment", - layout=widgets.Layout(width="auto"), - style={"description_width": "auto"}, - ) - - self.pid_file = widgets.Text( - description="P&ID file:", - placeholder="Provided as xml file using DEXPI standards", - layout=widgets.Layout(width="auto"), - style={"description_width": "auto"}, - ) - - self.species_file = widgets.Text( - description="Species file:", - placeholder="Provided as yaml file", - layout=widgets.Layout(width="auto"), - style={"description_width": "auto"}, - ) - - self.experiments = widgets.TagsInput(allow_duplicates=False) - - self.measurements = widgets.TagsInput(allow_duplicates=False) - - self.button_save = widgets.Button( - description=f"Save dataset as: {self.dataset_dropdown.value.name}", - layout=widgets.Layout(width="30%"), - style={"button_color": "lightblue"}, - ) - - self.button_add_exp = widgets.Button( - description="Add experiment", layout=widgets.Layout(width="auto") - ) - - self.button_read_pid = widgets.Button( - description="Read PID", layout=widgets.Layout(width="auto") - ) - - self.button_vis_pid = widgets.Button( - description="Visualize PID", layout=widgets.Layout(width="auto") - ) - - # Functions for the buttons - self.button_add_exp.on_click(self.add_experiment) - self.button_save.on_click(self.save_dataset) - self.button_read_pid.on_click(self.read_pid) - self.button_vis_pid.on_click(self.visualize_pid) - - # Attach the event handler to the 'value' property change of the file type widget - self.dataset_dropdown.observe(self.dataset_input_handler, names="value") - self.measurements.observe(self.measurement_input_handler, names="value") - self.experiments.observe(self.experiment_input_handler, names="value") - - # Initialize several objects - self.measurement_objects = [] - - # Display the widgets - - # Create the layout - v_space = widgets.VBox( - [widgets.Label(value="")], layout=widgets.Layout(height="30px") - ) - v_space_s = widgets.VBox( - [widgets.Label(value="")], layout=widgets.Layout(height="15px") - ) - v_space_ss = widgets.VBox( - [widgets.Label(value="")], layout=widgets.Layout(height="7.5px") - ) - - widgets0 = widgets.HBox([self.dataset_dropdown]) - widgets1 = widgets.VBox( - [ - widgets.Label(value="Manually add/remove Measurements:"), - self.measurements, - ] - ) - widgets2 = widgets.VBox([explorer_widget, v_space_s]) - widgets3 = widgets.VBox([self.tab_output, v_space_s]) - widgets4 = widgets.VBox( - [ - v_space_s, - self.pid_file, - v_space_ss, - widgets.HBox([self.button_read_pid, self.button_vis_pid]), - self.pid_output, - v_space_ss, - self.species_file, - v_space_s, - ] - ) - widgets5 = widgets.VBox( - [ - widgets.VBox( - [ - widgets.Label( - value="After selecting all necessary files for an experiment, add the experiment to the chosen dataset." - ), - self.experiment_name, - self.button_add_exp, - ] - ), - widgets.VBox([widgets.Label(value="Experiments:"), self.experiments]), - ] - ) - widgets6 = widgets.VBox( - [self.button_save], layout=widgets.Layout(align_items="center") - ) - - # Combine the layout - full_layout = widgets.VBox( - [ - widgets0, - v_space, - widgets1, - v_space_s, - widgets2, - widgets3, - widgets4, - v_space, - widgets5, - v_space, - widgets6, - ] - ) - - # Display the layout - display(full_layout) diff --git a/FAIRFlowChemistry/tools/analysis.py b/FAIRFlowChemistry/tools/analysis.py deleted file mode 100644 index e2ffbbe..0000000 --- a/FAIRFlowChemistry/tools/analysis.py +++ /dev/null @@ -1,158 +0,0 @@ -#!~/miniconda3/bin/python - -import pandas as pd -import logging -import ipywidgets as widgets -from IPython.display import display, clear_output - -# Import general tools and objects of this datamodel # - -# Objects -from FAIRFlowChemistry.core import Data -from FAIRFlowChemistry.core import Dataset -from FAIRFlowChemistry.core import Experiment -from FAIRFlowChemistry.core import MeasurementType -from FAIRFlowChemistry.core import Quantity - -# Tools # -from .auxiliary import PeakAssigner -from .calculator import FaradayEfficiencyCalculator - -logger = logging.getLogger("main") - -class analyzing_raw_data_widget: - - def save_dataset(self,_): - with open(self.dataset_path, "w") as f: f.write(self.dataset.json()) - print("Dataset saved.") - - def choose_experiment_input_handler(self,_): - """ - This function provides the peaks of the GC measurement inheritend in the choosen experiment - """ - - # Clear every widget output and make new ones - clear_output(wait=True) - - # Display the experiment widget - display(self.full_layout) - - # Also display the peak assignment again (input is the choosen experiment and the current species) - self.peak_assignment = PeakAssigner( experiment = Experiment( **self.dataset.experiments[self.experiments_dropdown.value].__dict__ ), - species = self.species_tags.value, - typical_retention_time = self.typical_retention_time ) - self.peak_assignment.assign_peaks() - - # Display the postprocessing - display(self.full_layout2) - - def species_tags_input_handler(self,_): - # If species are changed redo the ouput of widget one - self.peak_assignment.modify_dropdown_options( self.species_tags.value ) - - def do_postprocessing(self,_): - - # Clear existing output (in case several post processing are done, remove the print output ) - with self.postprocessing_output: - clear_output(wait=True) - - logger.info("\nStarting the postprocessing for experiment: %s\n"%(self.dataset.experiments[self.experiments_dropdown.value].id)) - - fe_calculator = FaradayEfficiencyCalculator(experiment = self.dataset.experiments[self.experiments_dropdown.value], - mean_radius = self.mean_radius.value) - - faraday_efficiencies = [] - - # Extract the GC measurements from the choosen experiment - gc_measurements = self.dataset.experiments[self.experiments_dropdown.value].get("measurements", "measurement_type", MeasurementType.GC.value)[0] - - for i, gc_measurement in enumerate( gc_measurements ): - tmp = fe_calculator.calculate_faraday_efficiencies( gc_measurement = gc_measurement ) - faraday_efficiencies.append( tmp ) - logger.info("Faraday effiencies of GC measurement n°%d"%(i+1)) - logger.info("%s\n"%tmp) - - mean_faraday_efficiency = pd.concat(faraday_efficiencies).groupby(level=0).mean() - - logger.info("\nMean Faraday efficency over all GC measurements: \n%s\n"%mean_faraday_efficiency) - - for species_data in self.dataset.experiments[self.experiments_dropdown.value].species_data: - if species_data.species in mean_faraday_efficiency.index: - faraday_efficiency = mean_faraday_efficiency.loc[species_data.species].values - species_data.faraday_efficiency = Data( quantity = Quantity.FARADAYEFFIECENCY.value, values = faraday_efficiency.tolist()) - - - def choose_experiment(self, dataset: Dataset, dataset_path: str, typical_retention_time: dict={}) -> None: - """ - Function that shows widgets to analyse faraday effiencies using GC measurements. - - Args: - dataset (Dataset): Dataset containing all the necessary information. - dataset_path (str): Path where the dataset should be saved to. - typical_retention_time (dict, optional): If wanted, a dictionary containing species and typical retention times to do the pre assigment of the GC measurement peaks. Defaults to {}. - - """ - - # Common variables - self.typical_retention_time = typical_retention_time - self.dataset_path = dataset_path - self.dataset = Dataset(**dataset.model_dump()) - - if not bool( self.dataset.experiments ): raise ValueError("Dataset contains no experiments!\n") - - self.experiments_dropdown = widgets.Dropdown(options=[(str(exp.id),idx) for idx,exp in enumerate( self.dataset.experiments ) ], - description="Choose experiment:", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.species_tags = widgets.TagsInput(allow_duplicates=False, - value=['Hydrogen', 'Carbon monoxide', 'Carbon dioxide', 'Methane', 'Ethene', 'Ethane']) - - self.mean_radius = widgets.IntSlider(value=10, # Initial value - min=0, # Minimum value - max=20, # Maximum value - step=1, # Step size - description='Mean radius:') - - self.display_button = widgets.Button(description="Start posprocessing", - layout=widgets.Layout(width="30%"), - style={"button_color": 'green'}) - - self.button_save = widgets.Button(description='Save dataset as: %s'%dataset_path.name, - layout=widgets.Layout(width="30%"), - style={"button_color": 'lightblue'}) - - self.explanation_label = widgets.HTML(value='The mass flow at the time of the gas chromatography measurement is determined by matching the time of the gas chromatography measurement\ - with the corresponding times of the mass flow measurements. Errors in the mass flow due to strong fluctuations\ - are minimized by calculating the mean by averaging over a certain number (=radius) of measuring points before and\ - after the time of the gas chromatography measurement. The radius has to be specified in accordance with the strength of fluctuations.') - - # Output areas - self.postprocessing_output = widgets.Output() - - # Handle switch of experiment - self.experiments_dropdown.observe(self.choose_experiment_input_handler,names="value") - self.species_tags.observe(self.species_tags_input_handler,names="value") - - # Handle buttons - self.display_button.on_click(self.do_postprocessing) - self.button_save.on_click(self.save_dataset) - - # Widgets - v_space = widgets.VBox([widgets.Label(value='')], layout=widgets.Layout(height='30px')) - - widgets0 = widgets.HBox([self.experiments_dropdown]) - widgets1 = widgets.VBox([widgets.Label(value='Species in gas chromatographic analysis:'), self.species_tags]) - widgets2 = widgets.VBox([self.explanation_label, v_space, self.mean_radius, v_space]) - widgets3 = widgets.VBox([self.display_button, v_space, self.postprocessing_output], layout=widgets.Layout(align_items = 'center')) - widgets4 = widgets.VBox([v_space,self.button_save], layout=widgets.Layout(align_items = 'center') ) - - - # Combine the experiment layout - self.full_layout = widgets.VBox([widgets0,widgets1]) - - # Do postprocessing and save dataset - self.full_layout2 = widgets.VBox([widgets2, widgets3, widgets4] ) - - # Execute the peak assignment for the initial experiment value and thus visualize the widgets - self.choose_experiment_input_handler(None) \ No newline at end of file diff --git a/FAIRFlowChemistry/tools/auxiliary.py b/FAIRFlowChemistry/tools/auxiliary.py deleted file mode 100644 index 5d669be..0000000 --- a/FAIRFlowChemistry/tools/auxiliary.py +++ /dev/null @@ -1,503 +0,0 @@ -import logging -import numpy as np -import ipywidgets as widgets - -from pathlib import Path -from typing import List, Dict, Callable -from pydantic import BaseModel -from IPython.display import display -from FAIRFlowChemistry.core import Experiment -from FAIRFlowChemistry.core import Quantity -from FAIRFlowChemistry.core import MeasurementType -from ipywidgets import ( - VBox, # Vertical container for widgets (called its children) - HBox, # Horizontal container for widgets - Output, # Widget for displaying output from other widgets - Label, # Simple string label widget, useful for displaying text - Dropdown, # Classic dropdown menu - Button, # Classic button - Layout, # Layout specification object - TagsInput -) - -logger = logging.getLogger("main") - -class Librarian(BaseModel): - """ - Class that manages directoy and file browsing - - Args: - BaseModel (_type_): _description_ - - Raises: - KeyError: _description_ - KeyError: _description_ - - Returns: - _type_: _description_ - """ - root_directory: Path - - def enumerate_subdirectories(self, directory: Path, verbose: bool = None): - dir_dict = { - index: dir - for index, dir in enumerate( - [x for x in directory.iterdir() if x.is_dir()] - ) - } - if verbose: - print(f"Parent directory: \n {directory} \nAvailable subdirectories:") - for index, dir in dir_dict.items(): - print(f"{index}: .../{dir.name}") - - return dir_dict - - def enumerate_files( - self, - directory: Path, - filter: str = None, - verbose: bool = None - ): - """ - Directory is set to the root directory. - If no value is passed for filter, all file types will be considered. - """ - - suffix = "*." + filter if filter != None else "*" - - file_dict = { index: file for index, file in enumerate(directory.glob(suffix)) if file.is_file() } - - if verbose: - print(f"Directory: \n {directory} \nAvailable files:") - for index, file in file_dict.items(): - print(f"{index}: {file.name}") - - return file_dict - - def search_files_in_subdirectory(self,root_directory: Path, directory_keys: list[str], file_filter: str, verbose: bool = None) -> Path: - """ - Function that loobs through Path objects containing a main directory. In this directory it is recoursevly searched for sub directories. - In the last sub directory files with the suffix 'file_filter' are searched and returned - - Args: - root_directory (Path): Root directory - directory_keys (list[str]): List of subdirectories that should be recoursevly searched - file_filter (str): Suffix of files that should be found in last given sub directory - verbose (bool, optional): Possiblity to printout all subdirectories in each directory listed. Defaults to None. - - Raises: - KeyError: If either the specified sub directory or file could not be found - - Returns: - subdirectory_files (Path): Path object containing all files found in the subdirectory - """ - - # First search for every nested sub directory in provided root directory # - - if len(directory_keys) == 1 and directory_keys[0] == ".": - subdirectory_files = self.enumerate_files(directory=root_directory, filter=file_filter, verbose=verbose) - - if not bool(subdirectory_files): - raise KeyError("No files with filter: '%s' found in the given directory: %s"%(file_filter,root_directory)) - - else: - root = self.enumerate_subdirectories(root_directory) - for j,directory_key in enumerate(directory_keys): - try: - idx_sub_directory = [i for i in range(len(root)) if root[i].parts[-1] == directory_key ][0] - if j < len(directory_keys)-1: - root = self.enumerate_subdirectories(directory=root[idx_sub_directory]) - except: - raise KeyError("Defined key: '%s' cannot be found in the given root directory: %s"%(directory_key,root[0].parent)) - - # Search for all files that match the given filter in the specified sub directory # - subdirectory_files = self.enumerate_files(directory=root[idx_sub_directory], filter=file_filter, verbose=verbose) - - if not bool(subdirectory_files): - raise KeyError("No files with filter: '%s' found in the given sub directory: %s"%(file_filter,root[idx_sub_directory])) - - return subdirectory_files - - - def visualize_directory_tree( - self, directory: Path, indent=0, skip_directories=None - ): - if skip_directories is None: - skip_directories = [] - - if directory.is_dir(): - if directory.name in skip_directories: - return - - print(" " * indent + f"[{directory.name}]") - - for item in directory.iterdir(): - if item.is_dir(): - self.visualize_directory_tree( - item, indent + 1, skip_directories - ) - else: - print(" " * (indent + 1) + item.name) - else: - print("Directory not found.") - - @property - def get_root_directory(self): - return self.root_directory - -class explorer: - """ - This class is a widget that allows to scroll through folders and select files - """ - # Function to navigate into the selected subfolder - def go_to_subfolder(self,_): - self.current_dir.value = str(self.folder_dropdown.value) - subroot = self.librarian.enumerate_subdirectories(directory=self.folder_dropdown.value) - self.folder_dropdown.options = [ (path.parts[-1],path) for _,path in subroot.items() ] if bool(subroot) else [ ("No subdirectories",self.folder_dropdown.value) ] - - # Function to navigate back from the selected subfolder - def go_to_parentfolder(self,_): - parentfolder = self.parent - self.current_dir.value = str(parentfolder) - parentroot = self.librarian.enumerate_subdirectories(directory=parentfolder) - self.folder_dropdown.options = [(path.parts[-1],path) for _,path in parentroot.items()] - - def folder_dropdown_option_handler(self,_): - # If no subdirectories exist, then the parent folder is simply the first parent, otherwise it is the 2nd parent - # (because the current dropdown value is already one deeper than the actual directory ) - if str(self.folder_dropdown.value.parent) == self.current_dir.value: - self.parent = self.folder_dropdown.value.parent.parent - self.file_folder = self.folder_dropdown.value.parent - else: - self.parent = self.folder_dropdown.value.parent - self.file_folder = self.folder_dropdown.value - - # Reset file type after chaning dropdown - - self.file_type_text.value = "" - self.file_dropdown.options = [] - - def file_type_input_handler(self,_): - if self.file_type_text.value: - file_filter = self.file_type_text.value - subdirectory_files = self.librarian.enumerate_files(directory=self.file_folder, filter=file_filter) - - # Show all available files and show the first initially that they know if file are available - try: - self.file_dropdown.options = [(file.parts[-1],file) for _,file in subdirectory_files.items()] - self.file_dropdown.value = subdirectory_files[0] - except: - self.file_dropdown.options = ["No files with specified suffix"] - self.file_dropdown.value = "No files with specified suffix" - - def file_category_input_handler(self,_): - self.button_select.description = 'Add file to %s'%(self.file_category.value) - - def add_file(self,_): - self.add_file_callalbe( self.file_category.value, str(self.file_dropdown.value) ) - - def main(self, root: str, file_categories: List[str], add_file_callalbe: Callable[[str,str], None]): - - self.librarian = Librarian(root_directory=root) - sub_directories = self.librarian.enumerate_subdirectories(directory=root) - self.file_folder = root - self.add_file_callalbe = add_file_callalbe - - - self.folder_dropdown = widgets.Dropdown(description='Select directory:', - options=[(path.parts[-1],path) for _,path in sub_directories.items()], - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.file_dropdown = widgets.Dropdown(description='Select file:', - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.file_category = widgets.Dropdown(options=file_categories, - value=file_categories[0], - description='for category:', - style={'description_width': 'auto'}) - - self.file_type_text = widgets.Text(description='File type:', - placeholder='Enter type here (e.g.: csv, json, ... or * for all files)', - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.current_dir = widgets.Text(description='Current directory:', - disabled=True, - value=str(root), - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.button_go_for = widgets.Button(description='Change into selected directory', - layout=widgets.Layout(width='auto')) - - self.button_go_back = widgets.Button(description='Change to parent diretory', - layout=widgets.Layout(width='auto')) - - self.button_select = widgets.Button(description='Add file to %s'%(self.file_category.value), - layout=widgets.Layout(width='auto')) - - - # Attach the event handler to the 'value' property change of the file type widget - self.file_type_text.observe(self.file_type_input_handler, names='value') - self.folder_dropdown.observe(self.folder_dropdown_option_handler, names='options') - self.file_category.observe(self.file_category_input_handler, names='value') - - # Functions for the buttons - self.button_go_for.on_click(self.go_to_subfolder) - self.button_go_back.on_click(self.go_to_parentfolder) - self.button_select.on_click(self.add_file) - - # Display the widgets - - # Create the layout - v_space_s = widgets.VBox([widgets.Label(value='')], layout=widgets.Layout(height='15px')) - - widgets0 = widgets.VBox([self.current_dir,v_space_s,self.folder_dropdown]) - widgets1 = widgets.HBox([self.button_go_for, self.button_go_back]) - widgets2 = widgets.VBox([v_space_s,self.file_type_text]) - widgets3 = widgets.HBox([self.file_dropdown,self.file_category]) - widgets4 = widgets.VBox([v_space_s,self.button_select]) - - # Combine the layout - full_layout = widgets.VBox([widgets0,widgets1,widgets2,widgets3,widgets4]) - - # Return the layout - return full_layout - -class PeakAssigner: - """ - Class that assign peaks of given GC measurements within a given experiment object - """ - - def __init__(self, experiment: Experiment, species: List[str], typical_retention_time: Dict = {}, lower_assignment_bound: float=0.1 ): - """ - Args: - experiment (Experiment): Experiment object contain the GC measurements - species (List): List with possible species that should be matched to the GC results - typical_retention_time (dict, optional): Dictionary with typical retenion times to pre assign peak values. Defaults to {}. - lower_assignment_bound (float, optional): Preassignment boundary for typical retention time dictionary and measured retetion time values. Defaults to 0.1. - """ - self.experiment = experiment - self.species = species - self.typical_retention_time = typical_retention_time - self.lower_assignment_bound = lower_assignment_bound - self._assignment_dicts = [] - self._selection_output = Output() - self._VBox_list = [] - self._full_layout = VBox([]) - self.signal_types = [] - - self.peak_areas_retention_time_dict = {} - - # Get the GC measurements and make a dictionary for each measurement - gc_measurements = self.experiment.get("measurements", "measurement_type", MeasurementType.GC.value) - - if len(gc_measurements) > 0: - - # Get signal types - self.signal_types = [ md.value for md in gc_measurements[0][0].metadata if "Signal" in md.parameter ] - - for i, gc_measurement in enumerate(gc_measurements[0]): - peak_areas = gc_measurement.get("experimental_data", "quantity", Quantity.PEAKAREA.value)[0][0].values - retention_time = gc_measurement.get("experimental_data", "quantity", Quantity.RETENTIONTIME.value)[0][0].values - signal_type = gc_measurement.get("experimental_data", "quantity", Quantity.SIGNAL.value)[0][0].values - - self.peak_areas_retention_time_dict[f"Measurement number {i}"] = { "peak_areas": peak_areas, - "retention_time": retention_time, - "signal_type": signal_type } - else: - logger.info("\n!!! Warning: Given experiment doesn't contain GC measurements !!!\n") - - - # Check if the GC measurement already has a assignment and use this instead of the typical retention time dictionary - try: - assigned_retention_time_dict = {} - - peak_assignments = gc_measurement.get("experimental_data","quantity",Quantity.PEAKASSIGNMENT.value)[0][0].values - retention_time = gc_measurement.get("experimental_data","quantity",Quantity.RETENTIONTIME.value)[0][0].values - - for species,ret_time in zip( peak_assignments, retention_time): - # Prevent that not assigned peak will be used for analysis - if species : - assigned_retention_time_dict[species] = ret_time - - self.typical_retention_time = assigned_retention_time_dict - logger.info("\nGC measurement already contains an assignment. Use this assignment rather than the default dictionary.\n") - except: - pass - - - def save_assignments(self, _): - """ - This functions create the assignment dict, after the button is clicked. - The dict contains a dict per measurement which contains per species a list of assigned peak areas. - """ - - self._assignment_dicts.clear() - - # Iterate through every GC measurement - for i,VBox in enumerate(self._VBox_list): - _assignment_dict = {} - - # Iterate through the dropdown menus and extract the species per peak area - # Start from index 2 and following, as the first two entries are labels - for widget in VBox.children[2:]: - - # Dropdown in the last entry in each children - species = widget.children[2].value - peak_area = float( widget.children[1].value.split("(")[0].strip() ) - - if species in _assignment_dict: - _assignment_dict[species].append( peak_area ) - else: - _assignment_dict[species] = [ peak_area ] - - ## Add the assigned peaks as experimental data to the GC measurement ## - - gc_measurement = self.experiment.get("measurements", "measurement_type", MeasurementType.GC.value)[0][i] - - # Add the species in the order the peak areas are saved - tmp2 = np.round( gc_measurement.get("experimental_data","quantity",Quantity.PEAKAREA.value)[0][0].values, 2 ).tolist() - - # Sort the tuples based on peak values - sorted_species_peak_tuples = sorted( [(key, value) for key, values in _assignment_dict.items() for value in values], key=lambda x: tmp2.index(x[1]) ) - - # check if there is already an exisiting entry, if yes overwrite - if all( gc_measurement.get("experimental_data","quantity",Quantity.PEAKASSIGNMENT.value) ): - - # Extract the species names in the sorted order --> if a peak has no species assignment its saved as: "" - gc_measurement.get("experimental_data","quantity",Quantity.PEAKASSIGNMENT.value)[0][0].values = [ item[0] for item in sorted_species_peak_tuples ] - - # if not then add - else: - gc_measurement.add_to_experimental_data( quantity = Quantity.PEAKASSIGNMENT.value, - values = [ item[0] for item in sorted_species_peak_tuples ], - unit = "" - ) - - self._assignment_dicts.append( _assignment_dict.copy() ) - - with self._selection_output: - self._selection_output.clear_output(wait=False) - print("Assignments saved.") - - def assign_peaks(self): - """ - Function that displays a widget with the GC measurements: Retention time, peak area, and one need to choose a corresponding species - """ - - # Set layout of widgets - layout_button = Layout( align_items="center", width="30%" ) - layout_hbox = Layout( align_items="stretch", width="100%", justify_content="center" ) - layout_vbox = Layout( width="100%" ) - - self._VBox_list.clear() - - for measurement_number, peak_areas_retention_time in self.peak_areas_retention_time_dict.items(): - - # For each measurement create a horizontal box containing the retention time, peak area and species - hbox_list = [ Label( value = measurement_number, - layout = Layout(width="60%", height="30px", justify_content="center") ), - - HBox( [ Label( value="Retention time", - layout=Layout(width="30%", height="30px")), - Label( value="Peak area", - layout=Layout(width="20%", height="30px")), - Label( value="Species", - layout=Layout(width="40%", height="30px")) ] ) ] - - for peak_area, retention_time, signal_type in zip( peak_areas_retention_time["peak_areas"], - peak_areas_retention_time["retention_time"], - peak_areas_retention_time["signal_type"]): - - try: - # Set default values with a given dict (search for the species with the closest retention time and pick it as standard value) - diff = [ abs( trt[1] - retention_time ) for trt in self.typical_retention_time.items() if trt[0] in self.species ] - if np.min(diff) < self.lower_assignment_bound: - idx = np.argmin( diff ) - default_value = list( self.typical_retention_time.items() )[idx][0] - else: - default_value = "" - except: - default_value = "" - - dropdown = Dropdown( options = [""] + self.species, - layout = Layout(width="40%", height="30px"), - style = {"description_width": "initial"}, - value = default_value) - - retention_time_label = Label( value = f"{retention_time:.2f} (Signal: {signal_type:.0f})", - layout = Layout(width="30%", height="30px")) - - peak_area_label = Label( value = f"{peak_area:.2f}", - layout = Layout(width="20%", height="30px")) - - hbox_list.append( HBox( [ retention_time_label, peak_area_label, dropdown ] ) ) - - # Append the vertical box for each measurement to the overall list with every vertical boxes - self._VBox_list.append( VBox( children = hbox_list, layout = layout_vbox ) ) - - # Create a button to save the assignments made - display_button = Button( description="Save Assignments", - layout=layout_button) - - # Handle button on click - display_button.on_click(self.save_assignments) - v_space = VBox([Label(value='')], layout=Layout(height='30px')) - - # Description of signals: - signal_descripton = TagsInput(allow_duplicates=False, - layout = Layout(width="30%", height="30px") - ) - - signal_descripton.value = [ f'{i}: {stype}' for i,stype in enumerate(self.signal_types) ] - - signal_widget = widgets.VBox( - [ - widgets.Label(value="GC Signal:"), - signal_descripton, - ] - ) - - - # Define the total layout - widget0 = [ HBox(children=self._VBox_list[i:i+3], layout=layout_hbox) for i in range( 0, len(self._VBox_list), 3 ) ] - widget1 = HBox(children=[display_button],layout=Layout(justify_content="center")) - widget2 = self._selection_output - - full_layout = VBox([signal_widget,v_space,*widget0,v_space,widget1,widget2]) - - display(full_layout) - - def modify_dropdown_options(self, new_options): - """ - Function that takes new list of species and update the widget dropdowns - - Args: - new_options (list): New species - """ - - for vbox in self._VBox_list: - for hbox in vbox.children[2:]: - # For each Hbox, the retention time is children 0, the peak area children 1 and the dropdown is the 2nd - - # Overwrite the dropdown the new options - hbox.children[2].options = [""]+new_options - - # Set default values with a given dict - retention_time = float( hbox.children[0].value ) - - try: - # Set default values with a given dict (search for the species with the closest retention time and pick it as standard value) - diff = [ abs( trt[1] - retention_time ) for trt in self.typical_retention_time.items() if trt[0] in self.species ] - if np.min(diff) < self.lower_assignment_bound: - idx = np.argmin( diff ) - default_value = list( self.typical_retention_time.items() )[idx][0] - else: - default_value = "" - except: - default_value = "" - - hbox.children[2].value = default_value \ No newline at end of file diff --git a/FAIRFlowChemistry/tools/calculator.py b/FAIRFlowChemistry/tools/calculator.py deleted file mode 100644 index d888268..0000000 --- a/FAIRFlowChemistry/tools/calculator.py +++ /dev/null @@ -1,184 +0,0 @@ -import pandas as pd -import numpy as np - -from datetime import datetime -from pydantic import BaseModel - -from FAIRFlowChemistry.core import Experiment -from FAIRFlowChemistry.core import Measurement -from FAIRFlowChemistry.core import Quantity - -import scipy.constants as const - -import logging - -logger = logging.getLogger("main") - -class FaradayEfficiencyCalculator(BaseModel): - experiment: Experiment - mean_radius: int = 10 - volumetric_flow_mean: float = None - volumetric_fractions_df: pd.DataFrame = None - conversion_factor: float = None - real_volumetric_flow: float = None - volumetric_flow_fractions_df: pd.DataFrame = None - material_flow_df: pd.DataFrame = None - theoretical_material_flow_df: pd.DataFrame = None - initial_current: float = None - - class Config: - # allow panda dataframe - arbitrary_types_allowed = True - - def _calculate_volumetric_flow_mean(self, inj_date_datetime: datetime) -> float: - """ - Function checks the GC injection time and search the corresponding time in the mass flow meter recordings. - The times are matched and the mean mass flow is computed as an average over the x steps bevore and after - the GC injection. - - Args: - Injection time of gc_measurement - - Returns: - float: Averaged volumetric flow [ml/s] - """ - - volumetric_flow_datetime_list, volumetric_flow_values_list = self.experiment.volumetric_flow_time_course - - index_match = np.argmin( [abs(dt - inj_date_datetime) for dt in volumetric_flow_datetime_list] ) - self.volumetric_flow_mean = np.mean( np.array( volumetric_flow_values_list )[ range(index_match - self.mean_radius, index_match + self.mean_radius + 1) ] ) - - logger.info("GC injection time %s"%str(inj_date_datetime)) - logger.info("Matching time of MFM: %s"%str(volumetric_flow_datetime_list[index_match])) - logger.info("Matching mean volumetric flow [ml/min]: %.3f"%(self.volumetric_flow_mean*60)) - - - def _calculate_volumetric_fractions(self, assigned_peak_areas_dict: dict): - """ - Function that uses the on calibration data fited linear regresion model to compute the volume fraction given the assigned peak area - If several peak areas are specified for a component, these are added together. - The GC measurement object inheritets the peak areas as well as the matched species - - Args: - assigned_peak_areas_dict (dict): Dictionary containing the species and the associated peak area. - """ - self.volumetric_fractions_df = pd.DataFrame( index=[species for species in assigned_peak_areas_dict.keys()], columns=["Volumetric_fraction [-]"] ) - - # peak areas are given as list, as it is possible for one component to have several assigned peaks - for species, peak_areas in assigned_peak_areas_dict.items(): - self.volumetric_fractions_df.loc[species] = self.experiment.get("species_data", "species", species)[0][0].calibration.predict( [ np.sum(peak_areas) ] ) / 100 - - if self.volumetric_fractions_df["Volumetric_fraction [-]"].sum() < 0.99: - print(f"\nWarning: Volume fractions doesn't add up to 1.0: {round(self.volumetric_fractions_df['Volumetric_fraction [-]'].sum(),2)}! Check if any component is missing in the analysis.\n") - - def _calculate_real_volumetric_flow(self): - """ - Function that computes the correction factor to account that the mass flow meter is only calibrated on CO2, thus correction of the volumetric flow needs to be done. - With the correction factor, the real mean voulmetric flow of the mixture is computed - """ - - correction_factor_H = self.experiment.get("species_data", "species", "Hydrogen")[0][0].correction_factor - correction_factor_CO = self.experiment.get("species_data", "species", "Carbon monoxide")[0][0].correction_factor - correction_factor_CO2 = self.experiment.get("species_data", "species", "Carbon dioxide")[0][0].correction_factor - - volumetric_fraction_H = self.volumetric_fractions_df.loc["Hydrogen"].values[0] - volumetric_fraction_CO = self.volumetric_fractions_df.loc["Carbon monoxide"].values[0] - - k1 = volumetric_fraction_H / correction_factor_H - k2 = ( 1 - volumetric_fraction_H + volumetric_fraction_CO ) / correction_factor_CO2 - k3 = volumetric_fraction_CO / correction_factor_CO - - self.conversion_factor = 1 / ( k1 + k2 + k3 ) * 1 / correction_factor_CO2 - - self.real_volumetric_flow = self.volumetric_flow_mean * self.conversion_factor - - def _calculate_material_flow(self): - """ - Function that computes the real material flow of every component [mol/s]. - Given the real volumetric flow and the volumetric fractions (computed from GC measurement and calibration data) - """ - ## molecular volume of ideal Gas at 1 atm and 273.15 K in ml^3/mol (m^3/mol = 10^-6*ml^3/mol) - molecular_volume = const.R * 273.15 / 101325 * 10**6 - rename = {"Volumetric_fraction [-]": "Material_flow [mol/s]"} - - # Material flow [mol/s] = vol_fraction [vol_% / vol_%] * real_vol_flow [ml/s] / mol_volume_id_gas [ml/mol] - self.material_flow_df = self.volumetric_fractions_df.rename ( columns = rename ) * self.real_volumetric_flow / molecular_volume - - def _calculate_theoretical_material_flow(self): - """ - Function that computes the theoretical material flow, using the given current as well as the Faraday constant - and a factor describing the electron transfer for each species - """ - faraday_constant = const.physical_constants["Faraday constant"][0] - factors = { esd.species: esd.electron_transfer for esd in self.experiment.species_data } - self.theoretical_material_flow_df = pd.DataFrame( index=[species for species in factors.keys()], columns = ["Theoretical_material_flow [mol/s]"] ) - - # Current_density i provided in mA/cm^2; Electrode surface A is given as cm^2 --> current I = i*A_surface * 1A / 1000mA [A] - self.initial_current = ( abs( self.experiment.get("measurements/metadata", "parameter", "Current")[0][0].value ) - * self.experiment.get("measurements/metadata", "parameter", "Electrode surface area")[0][0].value / 1000 ) - - # Faraday constant is C/mol, with C = A*s - # theoretical flow [mol/s]: A / ( C/mol ) = mol * A/C = mol * A/(A*s) = mol / s - for species, factor in factors.items(): - self.theoretical_material_flow_df.loc[species] = self.initial_current / ( factor * faraday_constant ) - - - def calculate_faraday_efficiencies(self, gc_measurement: Measurement): - """ - This function uses the injection time as well as the assinged peak areas of the given GC measurement to compute the Faraday effiency. - This is done by matching the injection to the provided mass flow meter measurements to obtain the mass flow. - This is further used to compute the measured material flow (mol/s) and compare it with the expected material flow - under ideal conditions. The ratio between the measured and the theoretical material flow is the Faraday efficency. - - Args: - gc_measurement (Measurement): GC measurement, containing the assigned peak areas and the injection time - - Returns: - DataFrame: Faraday effiency for each species - """ - - # Extract the injection time out of the given GC measurement - inj_date_datetime = gc_measurement.get("metadata", "parameter", "Injection Date")[0][0].value - - # In the case the dataset is read it from json, every typ is incorrect and needs to be transfered - if not type(inj_date_datetime) == datetime: inj_date_datetime = datetime.strptime( inj_date_datetime, "%Y-%m-%dT%H:%M:%S" ) - - # Extract the peak areas dict out of the given gc_measurement - assigned_peak_areas_dict = {} - - try: - peak_assignments = gc_measurement.get("experimental_data","quantity",Quantity.PEAKASSIGNMENT.value)[0][0].values - peak_areas = gc_measurement.get("experimental_data","quantity",Quantity.PEAKAREA.value)[0][0].values - except: - raise KeyError("No peak assignment found in the GC measurement !") - - for species,peak_area in zip( peak_assignments, peak_areas): - # Prevent that not assigned peak will be used for analysis - if species == "": continue - - if species in assigned_peak_areas_dict.keys(): - assigned_peak_areas_dict[species].append(peak_area) - else: - assigned_peak_areas_dict[species] = [peak_area] - - logger.info("\n\nProcessed data of GC measurement with id: %s\n"%gc_measurement.id) - - # Compute the theoretical material flow (several substeps are performed to do so) - self._calculate_volumetric_flow_mean( inj_date_datetime = inj_date_datetime ) - self._calculate_volumetric_fractions( assigned_peak_areas_dict = assigned_peak_areas_dict) - self._calculate_real_volumetric_flow() - self._calculate_material_flow() - self._calculate_theoretical_material_flow() - - rename = {"Material_flow [mol/s]": "Faraday_efficiency [%]"} - - # Compute the Faraday efficency by diving the real by the theoretical material flow - faraday_efficiency_df = self.material_flow_df.divide( self.theoretical_material_flow_df["Theoretical_material_flow [mol/s]"], axis="index", ).rename(columns=rename) * 100 - faraday_efficiency_df.dropna(inplace=True) - - # Write into logger - logger.info( "\n"+self.volumetric_fractions_df.to_string() + "\n" ) - logger.info( (self.material_flow_df*60*1000).rename( columns={"Material_flow [mol/s]":"Material_flow [mmol/min]"}).to_string() + "\n" ) - logger.info( (self.theoretical_material_flow_df*60*1000).rename( columns={"Theoretical_material_flow [mol/s]":"Theoretical_material_flow [mmol/min]"}).to_string() + "\n" ) - - return faraday_efficiency_df \ No newline at end of file diff --git a/FAIRFlowChemistry/tools/initialize.py b/FAIRFlowChemistry/tools/initialize.py deleted file mode 100644 index 8f535d9..0000000 --- a/FAIRFlowChemistry/tools/initialize.py +++ /dev/null @@ -1,94 +0,0 @@ -#!~/miniconda3/bin/python - -import os -import ipywidgets as widgets -from IPython.display import display, clear_output - -# Import Dataset -from FAIRFlowChemistry.core import Dataset - - -class initialize_dataset: - - def save_dataset(self,_): - - with self.button_output: - clear_output(wait=True) - - print("Saving dataset!") - - # Add title - self.dataset.general_information.title = self.title.value - - # Add description - self.dataset.general_information.description = self.description.value - - # Add project group - self.dataset.general_information.project = self.project.value - - # Add purpose - self.dataset.general_information.purpose = self.purpose.value - - # Write dataset - os.makedirs( f"{os.getcwd()}/{os.path.dirname(self.dataset_text.value)}", exist_ok=True ) - with open( f"{os.getcwd()}/{self.dataset_text.value}.json", "w") as f: f.write(self.dataset.json()) - - def change_dataset(self,_): - self.button_save.description = 'Save dataset as: %s.json'%self.dataset_text.value - - def write_dataset(self) -> None: - - self.title = widgets.Text(description="Title of the project:", - placeholder="Type the title of the project", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.description = widgets.Text(description="Description of the project:", - placeholder="Describe the project", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.project = widgets.Text(description="Project:", - placeholder="Name of the project group (e.g.: Project B07)", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.purpose = widgets.Text(description="Purpose:", - placeholder="Purpose of this dataset", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.dataset_text = widgets.Text(description="Dataset destination:", - placeholder="Provide a relative path to save the dataset (e.g. datasets/dummy will be saved as datasets/dummy.json).", - layout=widgets.Layout(width='auto'), - style={'description_width': 'auto'}) - - self.button_save = widgets.Button(description='Save dataset as: %s.json'%self.dataset_text.value, - layout=widgets.Layout(width="30%"), - style={"button_color": 'lightblue'}) - - # Initialize the datamodel - self.dataset = Dataset() - - # Handle on observing - self.dataset_text.observe(self.change_dataset,names="value") - - # Handle button - self.button_save.on_click(self.save_dataset) - - # Output spaces - self.button_output = widgets.Output() - - # Widgets - v_space = widgets.VBox([widgets.Label(value='')], layout=widgets.Layout(height='30px')) - - widgets0 = widgets.VBox([self.title, self.description, self.project, self.purpose, v_space, self.dataset_text, v_space]) - widgets1 = widgets.VBox([self.button_save, self.button_output], layout=widgets.Layout(align_items = 'center') ) - - # Combine the layout - full_layout = widgets.VBox([widgets0, widgets1]) - - # Display the layout - display(full_layout) - - return diff --git a/FAIRFlowChemistry/tools/logger_setup.py b/FAIRFlowChemistry/tools/logger_setup.py deleted file mode 100644 index 147d47c..0000000 --- a/FAIRFlowChemistry/tools/logger_setup.py +++ /dev/null @@ -1,35 +0,0 @@ -import os -import logging -from logging import FileHandler, StreamHandler - -def setup_logger( log_file: str="" ): - """ - Function that sets up a logger. - - Args: - log_file (str, optional): If wanted, add a log file. Defaults to "". - """ - # Create a logger - logger = logging.getLogger() - logger.setLevel(logging.DEBUG) - - # Create a file handler and set the level to INFO - if log_file: - # Setup a new logger file if already existing - if os.path.exists( log_file ): - os.remove( log_file ) - - file_handler = FileHandler( log_file ) - file_handler.setLevel(logging.INFO) - file_handler.setFormatter( logging.Formatter( "%(asctime)s - %(name)s - %(message)s", datefmt="%m-%d-%y %H:%M:%S" ) ) - logger.addHandler(file_handler) - - # Create a console handler and set the level to WARNING - console_handler = StreamHandler() - console_handler.setLevel(logging.INFO) - console_handler.setFormatter( logging.Formatter( "%(message)s" ) ) - logger.addHandler(console_handler) - - # Set the level of thid-party logger to avoid dumping too much information - for log_ in ['markdown_it', 'h5py', 'numexpr', 'git']: - logging.getLogger(log_).setLevel('WARNING') \ No newline at end of file diff --git a/FAIRFlowChemistry/tools/reader.py b/FAIRFlowChemistry/tools/reader.py deleted file mode 100644 index 49d0103..0000000 --- a/FAIRFlowChemistry/tools/reader.py +++ /dev/null @@ -1,289 +0,0 @@ -import pandas as pd -import numpy as np -import xml.etree.ElementTree as ET -import Levenshtein -import re -from typing import DefaultDict -from pathlib import Path -from datetime import datetime -from FAIRFlowChemistry.core import DataType -from FAIRFlowChemistry.core import Quantity -from FAIRFlowChemistry.core import Measurement -from FAIRFlowChemistry.core import PlantSetup -from FAIRFlowChemistry.core import Component -from FAIRFlowChemistry.core import ComponentType - - -def gc_parser(metadata_path: Path, experimental_data_path: Path): - """ - Function that reads in a file from a gas chromotography. Important information that is extracted is the - injection time, the retention times, as well as the peak areas. - - Args: - metadata_path (Path): Path to metadata csv file - experimental_data_path (Path): Path to measurement csv file - """ - - ## Read in the metadata file to correctly map measurement results ## - - # Extract important data - gc_measurement = Measurement(measurement_type="GC measurement") - key_list = ["Injection Date", "Signal 1", "Signal 2"] - - metadata_df = pd.read_csv( - metadata_path, - sep=",", - names=[ - "Parameter", - "Value", - "Description", - ], - engine="python", - encoding="utf-16_le", - ) - - # Add important metadata to the measurement - - for key in key_list: - - gc_measurement.add_to_metadata( - parameter=key, - value=( - datetime.strptime( - metadata_df.loc[metadata_df["Parameter"] == key, "Value"].values[0], - "%d-%b-%y, %H:%M:%S", - ) - if key == "Injection Date" - else metadata_df.loc[metadata_df["Parameter"] == key, "Value"].values[0] - ), - data_type=( - DataType.DATETIME.value - if key == "Injection Date" - else DataType.STRING.value - ), - description=( - "Injection date of the GC measurement" - if key == "Injection Date" - else None - ), - ) - - # Filter out the header description of the measurement csv file (contaning description and units) - filtered_columns = metadata_df[metadata_df["Parameter"].str.match(r"^Column \d+$")] - quantity_unit_dict = { - row["Value"].strip(): ( - row["Description"] - if not pd.isna(row["Description"]) and bool(row["Description"].split()) - else "" - ) - for _, row in filtered_columns.iterrows() - } - - ## Read in the measurement file ## - - experimental_data_df = pd.read_csv( - experimental_data_path, - sep=",", - names=list(quantity_unit_dict.keys()), - engine="python", - encoding="utf-16_le", - ) - - key_list = ["Retention Time", "Signal", "Peak Type", "Area", "Area %"] - - for key in key_list: - - quantity = list(Quantity)[ - np.argmax( - [ - Levenshtein.ratio( - quantity_type.value, - key.replace("%", "percentage") if "%" in key else key, - ) - for quantity_type in Quantity - ] - ) - ].value - values = ( - np.round(experimental_data_df[key], 4).to_list() - if key != "Peak Type" - else experimental_data_df[key].to_list() - ) - - gc_measurement.add_to_experimental_data( - quantity=quantity, values=values, unit=quantity_unit_dict[key] - ) - - return gc_measurement - - -def gstatic_parser(metadata_path: Path): - """ - Function that reads in a file from a potentiostat/galvanostat. Important information that is extracted is the - inital current and time, as well as the electrode surface area - - Args: - metadata_path (Path): Path to metadata path of potentiostat/galvanostat - - Returns: - Measurement: Measurement data object, containing the important meta data (in this case the electrode surface area and the initial current.) - """ - - metadata_df = pd.read_csv( - metadata_path, - sep="\t", - names=[ - "Parameter", - "Type", - "Value", - "Description", - ], - engine="python", - encoding="utf-8", - skiprows=range(0, 7), - nrows=(54 - 8 + 1), - ) - - # Extract important meta data - echem_measurement = Measurement(measurement_type="Potentiostatic measurement") - key_list = ["IINIT", "AREA"] - Quantity_list = { - "IINIT": Quantity.CURRENT.value, - "AREA": Quantity.SURFACEAREA.value, - } - - for key in key_list: - - quantity = Quantity_list[key] - value = float( - metadata_df.loc[metadata_df["Parameter"] == key, "Value"].values[0] - ) - - echem_measurement.add_to_metadata( - parameter=quantity, - value=value, - data_type=DataType.FLOAT.value, - unit=re.search( - r"\((.*?)\)", - metadata_df.loc[metadata_df["Parameter"] == key, "Description"].values[ - 0 - ], - ).group(1), - description=re.match( - r"(.*?)\(", - metadata_df.loc[metadata_df["Parameter"] == key, "Description"].values[ - 0 - ], - ) - .group(1) - .strip(), - ) - - return echem_measurement - - -def mfm_parser(experimental_data_path: Path): - """ - Function that reads in a file from a mass flow meter. Important information that is extracted is measurement time and the flowrate - - Args: - experimental_data_path (Path): Path to csv output of mass flow meter - """ - - quantity_unit_dict = { - "Date time": "", - "Time": "s", - "Signal": "", - "Volumetric flow rate": "ml / s", - } - - experimental_data_df = pd.read_csv( - experimental_data_path, - sep=",", - names=[name for name in quantity_unit_dict.keys()], - engine="python", - encoding="utf-8", - skiprows=1, - ) - experimental_data_df = experimental_data_df.dropna() - - # Extract important data - mfm_measurement = Measurement(measurement_type="MFM measurement") - key_list = ["Date time", "Volumetric flow rate"] - - for key in key_list: - - quantity = list(Quantity)[ - np.argmax( - [ - Levenshtein.ratio( - quantity_type.value, - key.replace("%", "percentage") if "%" in key else key, - ) - for quantity_type in Quantity - ] - ) - ].value - - values = ( - [ - pd.to_datetime(timestamp, format="%d.%m.%Y ; %H:%M:%S").to_pydatetime() - for timestamp in experimental_data_df[key] - ] - if key == "Date time" - else np.round(experimental_data_df[key] / 60, 6).to_list() - ) - - mfm_measurement.add_to_experimental_data( - quantity=quantity, values=values, unit=quantity_unit_dict[key] - ) - - return mfm_measurement - -def build_component(component, component_type: ComponentType): - return Component( - component_type=component_type, - component_id=component.get("ID"), - component_class=component.get("ComponentClass"), - component_class_uri=component.get("ComponentClassURI"), - ) - -def DEXPI2sdRDM(filepath: Path|str ): - tree = ET.parse(filepath) - root = tree.getroot() - - components = [] - nozzles = DefaultDict(list) - for eq in root.findall("Equipment"): - components.append(build_component(eq, ComponentType.EQUIPMENT)) - for nozzle in eq.findall("Nozzle"): - nozzles[eq.get("ID")].append(nozzle.get("ID")) - - connections = [] - piping_network_system = root.findall("PipingNetworkSystem") - for pns in piping_network_system: - for piping_network_segment in pns.findall("PipingNetworkSegment"): - connection = [ - piping_network_segment.find("Connection").get("FromID"), - piping_network_segment.find("Connection").get("ToID"), - ] - connections.append(connection) - for piping_component in piping_network_segment.findall("PipingComponent"): - components.append( - build_component(piping_component, ComponentType.PIPINGCOMPONENT) - ) - - for connection in connections: - for connection_point in connection: - if "Nozzle" in connection_point: - for eq, nozzle in nozzles.items(): - for n in nozzle: - if n in connection_point: - connection[connection.index(connection_point)] = eq - for component in components: - for connection in connections: - if component.component_id in connection: - component.connections.extend(connection) - component.connections.remove(component.component_id) - - return PlantSetup(components=components)