Skip to content

Commit

Permalink
formatted with isort
Browse files Browse the repository at this point in the history
  • Loading branch information
haeussma committed Apr 21, 2024
1 parent eef110c commit fffef6f
Show file tree
Hide file tree
Showing 25 changed files with 4,572 additions and 129 deletions.
20 changes: 10 additions & 10 deletions chromatopy/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from .chromhandler import ChromHandler
from .analyte import Analyte
from .measurement import Measurement
from .chromatogram import Chromatogram
from .peak import Peak
from .standard import Standard
from .chromhandler import ChromHandler
from .column import Column
from .detector import Detector
from .fiddetector import FIDDetector
from .inlet import Inlet
from .measurement import Measurement
from .method import Method
from .oven import Oven
from .peak import Peak
from .ramp import Ramp
from .inlet import Inlet
from .column import Column
from .detector import Detector
from .role import Role
from .signaltype import SignalType
from .standard import Standard
from .tcddetector import TCDDetector
from .fiddetector import FIDDetector
from .valve import Valve
from .signaltype import SignalType
from .role import Role

__doc__ = ""
__all__ = [
Expand Down
15 changes: 8 additions & 7 deletions chromatopy/core/analyte.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import sdRDM

from datetime import datetime as Datetime
from typing import Dict, List, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .standard import Standard

from .peak import Peak
from .role import Role
from .standard import Standard


@forge_signature
Expand Down
13 changes: 7 additions & 6 deletions chromatopy/core/chromatogram.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import sdRDM
from typing import Dict, List, Optional
from uuid import uuid4

import numpy as np
import pandas as pd
import plotly.graph_objects as go
from typing import Dict, List, Optional
import sdRDM
from hplc.quant import Chromatogram as hplcChromatogram
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element
from lxml.etree import _Element
from sdRDM.base.datatypes import Unit
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 hplc.quant import Chromatogram as hplcChromatogram

from .peak import Peak
from .signaltype import SignalType

Expand Down
44 changes: 21 additions & 23 deletions chromatopy/core/chromhandler.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import numpy as np
import sdRDM

import warnings
from datetime import datetime as Datetime
from typing import Dict, List, Optional, Tuple
from uuid import uuid4

import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
from typing import Dict, List, Optional, Tuple
import plotly.graph_objects as go
import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element
from lxml.etree import _Element
from sdRDM.base.datatypes import Unit
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 .signaltype import SignalType
from calipytion

from ..readers.abstractreader import AbstractReader
from .analyte import Analyte
from .standard import Standard
from .peak import Peak
from .chromatogram import Chromatogram
from .measurement import Measurement
from .peak import Peak
from .role import Role
from .chromatogram import Chromatogram
from ..readers.abstractreader import AbstractReader
from .signaltype import SignalType
from .standard import Standard


@forge_signature
Expand Down Expand Up @@ -217,12 +218,11 @@ def _set_analyte(
retention_time: float,
role: Role,
detector: SignalType,
tolerance: float,
molecular_weight: float = None,
inchi: str = None,
tolerance: float = 0.1,
calibration_factor: float = None,
):

times, peaks = self._get_peaks_by_retention_time(
retention_time=retention_time, tolerance=tolerance, detector=detector
)
Expand Down Expand Up @@ -280,7 +280,6 @@ def _get_peaks_by_retention_time(
sorted_measurements = sorted(self.measurements, key=lambda x: x.timestamp)

for measurement in sorted_measurements:

time = measurement.timestamp

chromatogram = measurement.get_detector(detector)
Expand Down Expand Up @@ -338,13 +337,11 @@ def read(cls, path: str, reader: AbstractReader):
return instance

def visualize_chromatograms(self, color_scale: str = "Turbo"):

fig = go.Figure()

colors = self._sample_colorscale(len(self.measurements), color_scale)
for color, measurement in zip(colors, self.measurements):
for chromatogram in measurement.chromatograms:

fig.add_trace(
go.Scatter(
x=chromatogram.retention_times,
Expand All @@ -367,7 +364,6 @@ def visualize_chromatograms(self, color_scale: str = "Turbo"):
return fig

def visualize_peaks(self, detector: SignalType = None, color_scale: str = "Turbo"):

detector = self._handel_detector(detector)

df = pd.DataFrame(self._get_peak_records())
Expand Down Expand Up @@ -410,7 +406,6 @@ def add_internal_standard(
inchi: str = None,
tolerance: float = 0.1,
) -> Analyte:

internal_standard = self._set_analyte(
name=name,
retention_time=retention_time,
Expand Down Expand Up @@ -519,7 +514,6 @@ def injection_times(self):
return relative_times

def visualize_concentrations(self, analytes: List[Analyte] = None):

if analytes is None:
analytes = [
analyte
Expand Down Expand Up @@ -550,6 +544,10 @@ def visualize_concentrations(self, analytes: List[Analyte] = None):

return fig

def calibrate(peaks: List[Peak], concentrations: List[float]):



def concentration_to_df(self, analytes: List[Analyte] = None):
if analytes is None:
analytes = [
Expand Down Expand Up @@ -595,7 +593,7 @@ def concentration_to_df(self, analytes: List[Analyte] = None):
df.set_index("relative_time", inplace=True)
df.columns.name = None
df.rename_axis("relative time [s]", inplace=True)
df.columns = [col + f" [mmol/l]" for col in df.columns]
df.columns = [col + " [mmol/l]" for col in df.columns]

# Your pivoted DataFrame now has a 'relative_time' column
return df
Expand Down
13 changes: 7 additions & 6 deletions chromatopy/core/column.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import sdRDM

from typing import Dict, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .inlet import Inlet

from .detector import Detector
from .inlet import Inlet


@forge_signature
Expand Down
10 changes: 5 additions & 5 deletions chromatopy/core/detector.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sdRDM

from typing import Dict, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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


Expand Down
6 changes: 4 additions & 2 deletions chromatopy/core/fiddetector.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

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 pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature
from sdRDM.tools.utils import elem2dict

from .detector import Detector


Expand Down
10 changes: 5 additions & 5 deletions chromatopy/core/inlet.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sdRDM

from typing import Dict, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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


Expand Down
13 changes: 7 additions & 6 deletions chromatopy/core/measurement.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import sdRDM

from datetime import datetime as Datetime
from typing import Dict, List, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .chromatogram import Chromatogram
from .peak import Peak
from .signaltype import SignalType
Expand Down
17 changes: 9 additions & 8 deletions chromatopy/core/method.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import sdRDM

from typing import Dict, List, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .inlet import Inlet

from .column import Column
from .valve import Valve
from .oven import Oven
from .detector import Detector
from .inlet import Inlet
from .oven import Oven
from .valve import Valve


@forge_signature
Expand Down
13 changes: 7 additions & 6 deletions chromatopy/core/molecule.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import sdRDM

from typing import Dict, List, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .role import Role

from .peak import Peak
from .role import Role
from .standard import Standard


Expand Down
11 changes: 6 additions & 5 deletions chromatopy/core/oven.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import sdRDM

from typing import Dict, List, Optional
from pydantic import PrivateAttr, model_validator
from uuid import uuid4
from pydantic_xml import attr, element

import sdRDM
from lxml.etree import _Element
from pydantic import PrivateAttr, model_validator
from pydantic_xml import attr, element
from sdRDM.base.datatypes import Unit
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 .ramp import Ramp


Expand Down
Loading

0 comments on commit fffef6f

Please sign in to comment.