pychemstation 0.6.3__tar.gz → 0.6.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pychemstation-0.6.3 → pychemstation-0.6.6}/PKG-INFO +1 -1
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/analysis/process_report.py +2 -2
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/sequence.py +2 -1
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/table.py +5 -5
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/hplc.py +7 -2
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/method_types.py +3 -3
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/sequence_types.py +1 -1
- pychemstation-0.6.6/pychemstation/utils/tray_types.py +163 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation.egg-info/PKG-INFO +1 -1
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation.egg-info/SOURCES.txt +3 -6
- {pychemstation-0.6.3 → pychemstation-0.6.6}/setup.py +1 -1
- {pychemstation-0.6.3 → pychemstation-0.6.6}/tests/constants.py +19 -0
- pychemstation-0.6.3/tests/test_inj.py → pychemstation-0.6.6/tests/test_nightly.py +44 -3
- pychemstation-0.6.6/tests/test_runs_stable.py +88 -0
- pychemstation-0.6.6/tests/test_stable.py +268 -0
- pychemstation-0.6.3/pychemstation/utils/tray_types.py +0 -60
- pychemstation-0.6.3/tests/test_comb.py +0 -136
- pychemstation-0.6.3/tests/test_comm.py +0 -65
- pychemstation-0.6.3/tests/test_method.py +0 -99
- pychemstation-0.6.3/tests/test_proc_rep.py +0 -52
- pychemstation-0.6.3/tests/test_sequence.py +0 -125
- {pychemstation-0.6.3 → pychemstation-0.6.6}/LICENSE +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/README.md +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/analysis/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/analysis/base_spectrum.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/analysis/spec_utils.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/analysis/utils.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/comm.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/column.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/dad.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/device.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/injector.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/devices/pump.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/method.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/ms.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/generated/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/generated/dad_method.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/generated/pump_method.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/__init__.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/chromatogram.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/injector_types.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/macro.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/parsing.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/pump_types.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/utils/table_types.py +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation.egg-info/dependency_links.txt +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation.egg-info/requires.txt +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation.egg-info/top_level.txt +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/pyproject.toml +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/setup.cfg +0 -0
- {pychemstation-0.6.3 → pychemstation-0.6.6}/tests/__init__.py +0 -0
@@ -8,7 +8,7 @@ from aghplctools.ingestion.text import _no_peaks_re, _area_report_re, _header_bl
|
|
8
8
|
_signal_table_re, chunk_string
|
9
9
|
from result import Result, Err, Ok
|
10
10
|
|
11
|
-
from pychemstation.utils.tray_types import
|
11
|
+
from pychemstation.utils.tray_types import Tray, FiftyFourVialPlate
|
12
12
|
|
13
13
|
|
14
14
|
@dataclass
|
@@ -239,7 +239,7 @@ def process_csv_report(folder_path: str) -> Result[AgilentReport, AnyStr]:
|
|
239
239
|
|
240
240
|
return Ok(AgilentReport(
|
241
241
|
signals=signals,
|
242
|
-
vial_location=
|
242
|
+
vial_location=FiftyFourVialPlate.from_int(vial_location),
|
243
243
|
solvents=solvents
|
244
244
|
))
|
245
245
|
|
{pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/sequence.py
RENAMED
@@ -41,8 +41,9 @@ class SequenceController(TableController):
|
|
41
41
|
inj_vol = int(self.get_text(row, RegisterFlag.INJ_VOL))
|
42
42
|
inj_source = InjectionSource(self.get_text(row, RegisterFlag.INJ_SOR))
|
43
43
|
sample_type = SampleType(self.get_num(row, RegisterFlag.SAMPLE_TYPE))
|
44
|
+
vial_enum = TenVialColumn(vial_location) if vial_location <= 10 else FiftyFourVialPlate.from_int(num=vial_location)
|
44
45
|
return SequenceEntry(sample_name=sample_name,
|
45
|
-
vial_location=
|
46
|
+
vial_location=vial_enum,
|
46
47
|
method=None if len(method) == 0 else method,
|
47
48
|
num_inj=num_inj,
|
48
49
|
inj_vol=inj_vol,
|
{pychemstation-0.6.3 → pychemstation-0.6.6}/pychemstation/control/controllers/tables/table.py
RENAMED
@@ -8,7 +8,7 @@ import abc
|
|
8
8
|
import os
|
9
9
|
import warnings
|
10
10
|
from dataclasses import dataclass
|
11
|
-
from typing import Union, Optional
|
11
|
+
from typing import Union, Optional, AnyStr
|
12
12
|
|
13
13
|
import numpy as np
|
14
14
|
import polling
|
@@ -48,13 +48,13 @@ class TableController(abc.ABC):
|
|
48
48
|
|
49
49
|
if src and os.path.isdir(src):
|
50
50
|
self.src: str = src
|
51
|
-
|
52
|
-
|
51
|
+
elif isinstance(src, str):
|
52
|
+
raise FileNotFoundError(f"dir: {src} not found.")
|
53
53
|
|
54
54
|
if data_dir and os.path.isdir(data_dir):
|
55
55
|
self.data_dir: str = data_dir
|
56
|
-
|
57
|
-
|
56
|
+
elif isinstance(data_dir, str):
|
57
|
+
raise FileNotFoundError(f"dir: {data_dir} not found.")
|
58
58
|
|
59
59
|
if hasattr(self, "data_dir"):
|
60
60
|
self.spectra: dict[str, Optional[AgilentHPLCChromatogram]] = {
|
@@ -43,12 +43,17 @@ class HPLCController:
|
|
43
43
|
data_dir: str,
|
44
44
|
method_dir: str,
|
45
45
|
sequence_dir: str,
|
46
|
+
sequence_data_dir: Optional[str] = None,
|
46
47
|
offline: bool = False):
|
47
48
|
"""Initialize HPLC controller. The `hplc_talk.mac` macro file must be loaded in the Chemstation software.
|
48
49
|
`comm_dir` must match the file path in the macro file.
|
49
50
|
|
50
51
|
:param comm_dir: Name of directory for communication, where ChemStation will read and write from. Can be any existing directory.
|
51
|
-
:
|
52
|
+
:param data_dir: Name of directory for storing data after method or sequence runs.
|
53
|
+
:param method_dir: Name of directory where method files are stored.
|
54
|
+
:param sequence_dir: Name of directory where sequence files are stored.
|
55
|
+
:param sequence_data_dir: Name of directory for storing sequence data, if different from method
|
56
|
+
:raises FileNotFoundError: If either `data_dir`, `method_dir`, `sequence_dir`, `sequence_data_dir`or `comm_dir` is not a valid directory.
|
52
57
|
"""
|
53
58
|
self.comm = CommunicationController(comm_dir=comm_dir) if not offline else None
|
54
59
|
self.method_controller = MethodController(controller=self.comm,
|
@@ -61,7 +66,7 @@ class HPLCController:
|
|
61
66
|
offline=offline))
|
62
67
|
self.sequence_controller = SequenceController(controller=self.comm,
|
63
68
|
src=sequence_dir,
|
64
|
-
data_dir=data_dir,
|
69
|
+
data_dir=data_dir if not sequence_data_dir else sequence_data_dir,
|
65
70
|
table=self.SEQUENCE_TABLE,
|
66
71
|
method_dir=method_dir,
|
67
72
|
offline=offline)
|
@@ -23,7 +23,7 @@ class Param:
|
|
23
23
|
|
24
24
|
@dataclass
|
25
25
|
class HPLCMethodParams:
|
26
|
-
organic_modifier:
|
26
|
+
organic_modifier: float
|
27
27
|
flow: float
|
28
28
|
pressure: Optional[float] = None # TODO: find this
|
29
29
|
|
@@ -51,6 +51,6 @@ class MethodDetails:
|
|
51
51
|
params: HPLCMethodParams
|
52
52
|
timetable: list[TimeTableEntry]
|
53
53
|
injector_program: Optional[InjectorTable] = None
|
54
|
-
stop_time: Optional[
|
55
|
-
post_time: Optional[
|
54
|
+
stop_time: Optional[float] = None
|
55
|
+
post_time: Optional[float] = None
|
56
56
|
dad_wavelengthes: Optional[list[Signal]] = None
|
@@ -43,7 +43,7 @@ class SequenceEntry:
|
|
43
43
|
data_file: Optional[str] = None
|
44
44
|
method: Optional[str] = None
|
45
45
|
num_inj: Optional[int] = 1
|
46
|
-
inj_vol: Optional[
|
46
|
+
inj_vol: Optional[float] = 2
|
47
47
|
inj_source: Optional[InjectionSource] = InjectionSource.HIP_ALS
|
48
48
|
sample_type: Optional[SampleType] = SampleType.SAMPLE
|
49
49
|
|
@@ -0,0 +1,163 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import math
|
4
|
+
from dataclasses import dataclass
|
5
|
+
from enum import Enum
|
6
|
+
from typing import Union
|
7
|
+
|
8
|
+
|
9
|
+
class Num(Enum):
|
10
|
+
ONE = 1
|
11
|
+
TWO = 2
|
12
|
+
THREE = 3
|
13
|
+
FOUR = 4
|
14
|
+
FIVE = 5
|
15
|
+
SIX = 6
|
16
|
+
SEVEN = 7
|
17
|
+
EIGHT = 8
|
18
|
+
NINE = 9
|
19
|
+
|
20
|
+
@classmethod
|
21
|
+
def from_num(cls, num: int) -> Num:
|
22
|
+
match num:
|
23
|
+
case 1:
|
24
|
+
return Num.ONE
|
25
|
+
case 2:
|
26
|
+
return Num.TWO
|
27
|
+
case 3:
|
28
|
+
return Num.THREE
|
29
|
+
case 4:
|
30
|
+
return Num.FOUR
|
31
|
+
case 5:
|
32
|
+
return Num.FIVE
|
33
|
+
case 6:
|
34
|
+
return Num.SIX
|
35
|
+
case 7:
|
36
|
+
return Num.SEVEN
|
37
|
+
case 8:
|
38
|
+
return Num.EIGHT
|
39
|
+
case 9:
|
40
|
+
return Num.NINE
|
41
|
+
case _:
|
42
|
+
raise ValueError("Num is one of 1 to 9")
|
43
|
+
|
44
|
+
|
45
|
+
class Plate(Enum):
|
46
|
+
ONE = -96
|
47
|
+
TWO = 4000
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_num(cls, plate: int) -> Plate:
|
51
|
+
if 1 <= plate <= 2:
|
52
|
+
return Plate.ONE if plate == 1 else Plate.TWO
|
53
|
+
raise ValueError("Plate is one or 1 or 2")
|
54
|
+
|
55
|
+
|
56
|
+
class Letter(Enum):
|
57
|
+
A = 4191
|
58
|
+
B = 4255
|
59
|
+
C = 4319
|
60
|
+
D = 4383
|
61
|
+
E = 4447
|
62
|
+
F = 4511
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_str(cls, let: str) -> Letter:
|
66
|
+
match let:
|
67
|
+
case "A":
|
68
|
+
return Letter.A
|
69
|
+
case "B":
|
70
|
+
return Letter.B
|
71
|
+
case "C":
|
72
|
+
return Letter.C
|
73
|
+
case "D":
|
74
|
+
return Letter.D
|
75
|
+
case "E":
|
76
|
+
return Letter.E
|
77
|
+
case "F":
|
78
|
+
return Letter.F
|
79
|
+
case _:
|
80
|
+
raise ValueError("Letter is one of A to F")
|
81
|
+
|
82
|
+
|
83
|
+
@dataclass
|
84
|
+
class FiftyFourVialPlate:
|
85
|
+
plate: Plate
|
86
|
+
letter: Letter
|
87
|
+
num: Num
|
88
|
+
|
89
|
+
def value(self) -> int:
|
90
|
+
return self.plate.value + self.letter.value + self.num.value
|
91
|
+
|
92
|
+
@classmethod
|
93
|
+
def from_str(cls, loc: str):
|
94
|
+
if len(loc) != 5:
|
95
|
+
raise ValueError("Plate locations must be PX-LY, where X is either 1 or 2 and Y is 1 to 9")
|
96
|
+
try:
|
97
|
+
plate = int(loc[1])
|
98
|
+
letter = loc[3]
|
99
|
+
num = int(loc[4])
|
100
|
+
return FiftyFourVialPlate(plate=Plate.from_num(plate),
|
101
|
+
letter=Letter.from_str(letter),
|
102
|
+
num=Num.from_num(num))
|
103
|
+
except Exception as e:
|
104
|
+
raise ValueError("Plate locations must be PX-LY, where X is either 1 or 2 and Y is 1 to 9")
|
105
|
+
|
106
|
+
@classmethod
|
107
|
+
def from_int(cls, num: int) -> FiftyFourVialPlate:
|
108
|
+
row_starts = [
|
109
|
+
# plate 1
|
110
|
+
FiftyFourVialPlate.from_str('P1-F1'),
|
111
|
+
FiftyFourVialPlate.from_str('P1-E1'),
|
112
|
+
FiftyFourVialPlate.from_str('P1-D1'),
|
113
|
+
FiftyFourVialPlate.from_str('P1-C1'),
|
114
|
+
FiftyFourVialPlate.from_str('P1-B1'),
|
115
|
+
FiftyFourVialPlate.from_str('P1-A1'),
|
116
|
+
# plate 2
|
117
|
+
FiftyFourVialPlate.from_str('P2-F1'),
|
118
|
+
FiftyFourVialPlate.from_str('P2-E1'),
|
119
|
+
FiftyFourVialPlate.from_str('P2-D1'),
|
120
|
+
FiftyFourVialPlate.from_str('P2-C1'),
|
121
|
+
FiftyFourVialPlate.from_str('P2-B1'),
|
122
|
+
FiftyFourVialPlate.from_str('P2-A1'),
|
123
|
+
]
|
124
|
+
|
125
|
+
# find which row
|
126
|
+
possible_row = None
|
127
|
+
for i in range(0, 6):
|
128
|
+
p1_val = row_starts[i].value()
|
129
|
+
p2_val = row_starts[6 + i].value()
|
130
|
+
if num >= p2_val:
|
131
|
+
possible_row = row_starts[6 + i]
|
132
|
+
elif p1_val <= num < row_starts[-1].value():
|
133
|
+
possible_row = row_starts[i]
|
134
|
+
if possible_row:
|
135
|
+
break
|
136
|
+
|
137
|
+
# determine which num
|
138
|
+
if possible_row:
|
139
|
+
starting_loc = possible_row
|
140
|
+
base_val = starting_loc.plate.value + starting_loc.letter.value
|
141
|
+
for i in range(1, 10):
|
142
|
+
if num - i == base_val:
|
143
|
+
return FiftyFourVialPlate(
|
144
|
+
plate=starting_loc.plate,
|
145
|
+
letter=starting_loc.letter,
|
146
|
+
num=Num.from_num(i))
|
147
|
+
raise ValueError("Number didn't match any location. " + str(num))
|
148
|
+
|
149
|
+
|
150
|
+
class TenVialColumn(Enum):
|
151
|
+
ONE = 1
|
152
|
+
TWO = 2
|
153
|
+
THREE = 3
|
154
|
+
FOUR = 4
|
155
|
+
FIVE = 5
|
156
|
+
SIX = 6
|
157
|
+
SEVEN = 7
|
158
|
+
EIGHT = 8
|
159
|
+
NINE = 9
|
160
|
+
TEN = 10
|
161
|
+
|
162
|
+
|
163
|
+
Tray = Union[FiftyFourVialPlate, TenVialColumn]
|
@@ -43,9 +43,6 @@ pychemstation/utils/table_types.py
|
|
43
43
|
pychemstation/utils/tray_types.py
|
44
44
|
tests/__init__.py
|
45
45
|
tests/constants.py
|
46
|
-
tests/
|
47
|
-
tests/
|
48
|
-
tests/
|
49
|
-
tests/test_method.py
|
50
|
-
tests/test_proc_rep.py
|
51
|
-
tests/test_sequence.py
|
46
|
+
tests/test_nightly.py
|
47
|
+
tests/test_runs_stable.py
|
48
|
+
tests/test_stable.py
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="pychemstation",
|
8
|
-
version="0.6.
|
8
|
+
version="0.6.6",
|
9
9
|
author="Lucy Hao",
|
10
10
|
author_email="lhao03@student.ubc.ca",
|
11
11
|
description="Library to interact with Chemstation software, primarily used in Hein lab",
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import os
|
1
2
|
import random
|
2
3
|
|
4
|
+
from pychemstation.control import HPLCController
|
5
|
+
from pychemstation.utils.macro import Command
|
3
6
|
from pychemstation.utils.method_types import *
|
4
7
|
from pychemstation.utils.sequence_types import *
|
5
8
|
|
@@ -63,3 +66,19 @@ seq_entry = SequenceEntry(
|
|
63
66
|
sample_name="Test",
|
64
67
|
sample_type=SampleType(int(random.random() * 3)),
|
65
68
|
)
|
69
|
+
|
70
|
+
|
71
|
+
def set_up_utils(num: int) -> HPLCController:
|
72
|
+
path_constants = room(num)
|
73
|
+
for path in path_constants:
|
74
|
+
if not os.path.exists(path):
|
75
|
+
raise FileNotFoundError(
|
76
|
+
f"{path} does not exist on your system. If you would like to run tests, please change this path.")
|
77
|
+
|
78
|
+
controller = HPLCController(comm_dir=path_constants[0],
|
79
|
+
method_dir=path_constants[1],
|
80
|
+
data_dir=path_constants[2],
|
81
|
+
sequence_dir=path_constants[3])
|
82
|
+
controller.send(Command.SAVE_METHOD_CMD.value.format(commit_msg="method saved by pychemstation"))
|
83
|
+
controller.send(Command.SAVE_SEQUENCE_CMD)
|
84
|
+
return controller
|
@@ -1,14 +1,15 @@
|
|
1
|
-
import os
|
2
1
|
import unittest
|
3
2
|
|
4
|
-
from
|
3
|
+
from pluggy import Result
|
4
|
+
|
5
|
+
from pychemstation.analysis.process_report import process_csv_report
|
5
6
|
from pychemstation.utils.tray_types import FiftyFourVialPlate, Letter, Plate, Num
|
6
7
|
from tests.constants import *
|
7
8
|
|
8
9
|
offline = True
|
9
10
|
|
10
11
|
|
11
|
-
class
|
12
|
+
class TestNightly(unittest.TestCase):
|
12
13
|
def setUp(self):
|
13
14
|
path_constants = room(254)
|
14
15
|
for path in path_constants:
|
@@ -34,6 +35,46 @@ class TestInj(unittest.TestCase):
|
|
34
35
|
def test_plate_number(self):
|
35
36
|
self.assertEqual(4096, FiftyFourVialPlate(plate=Plate.ONE, letter=Letter.A, num=Num.FOUR).value())
|
36
37
|
|
38
|
+
def test_build_peak_regex(self):
|
39
|
+
try:
|
40
|
+
# TODO
|
41
|
+
print('yes')
|
42
|
+
except Exception as e:
|
43
|
+
self.fail(f"Should have not failed, {e}")
|
44
|
+
|
45
|
+
def test_parse_area_report(self):
|
46
|
+
try:
|
47
|
+
# TODO
|
48
|
+
print('yes')
|
49
|
+
except Exception as e:
|
50
|
+
self.fail(f"Should have not failed, {e}")
|
51
|
+
|
52
|
+
def test_process_export_report(self):
|
53
|
+
try:
|
54
|
+
import pandas as pd
|
55
|
+
|
56
|
+
file_path = "/Users/lucyhao/Codes/pychemstation/tests/0_2025-03-15 19-14-35.D/Report00.CSV"
|
57
|
+
df = pd.read_csv(file_path, encoding="utf-16")
|
58
|
+
|
59
|
+
# Print the first column
|
60
|
+
print(df)
|
61
|
+
except Exception as e:
|
62
|
+
self.fail(f"Should have not failed, {e}")
|
63
|
+
|
64
|
+
def test_process_folder(self):
|
65
|
+
try:
|
66
|
+
# TODO
|
67
|
+
print('yes')
|
68
|
+
except Exception as e:
|
69
|
+
self.fail(f"Should have not failed, {e}")
|
70
|
+
|
71
|
+
def test_report_csv(self):
|
72
|
+
try:
|
73
|
+
report: Result = process_csv_report(folder_path="0_2025-03-15 19-14-35.D")
|
74
|
+
print(report)
|
75
|
+
except Exception as e:
|
76
|
+
self.fail(f"Should have not failed: {e}")
|
77
|
+
|
37
78
|
|
38
79
|
if __name__ == '__main__':
|
39
80
|
unittest.main()
|
@@ -0,0 +1,88 @@
|
|
1
|
+
|
2
|
+
import unittest
|
3
|
+
|
4
|
+
from pychemstation.utils.tray_types import FiftyFourVialPlate, Plate, Letter, Num
|
5
|
+
from tests.constants import *
|
6
|
+
|
7
|
+
run_too = True
|
8
|
+
|
9
|
+
|
10
|
+
class TestRunsStable(unittest.TestCase):
|
11
|
+
def setUp(self):
|
12
|
+
self.hplc_controller = set_up_utils(254)
|
13
|
+
|
14
|
+
def test_run_method(self):
|
15
|
+
try:
|
16
|
+
self.hplc_controller.run_method(experiment_name="test_experiment")
|
17
|
+
chrom = self.hplc_controller.get_last_run_method_data()
|
18
|
+
except Exception as e:
|
19
|
+
self.fail(f"Should have not failed: {e}")
|
20
|
+
|
21
|
+
def test_run_10_times(self):
|
22
|
+
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
23
|
+
rand_method = MethodDetails(
|
24
|
+
name=DEFAULT_METHOD,
|
25
|
+
params=HPLCMethodParams(
|
26
|
+
organic_modifier=5,
|
27
|
+
flow=0.65),
|
28
|
+
timetable=[TimeTableEntry(
|
29
|
+
start_time=0.50,
|
30
|
+
organic_modifer=99,
|
31
|
+
flow=0.65)],
|
32
|
+
stop_time=1,
|
33
|
+
post_time=0)
|
34
|
+
self.hplc_controller.edit_method(rand_method, save=True)
|
35
|
+
try:
|
36
|
+
for _ in range(10):
|
37
|
+
self.hplc_controller.run_method(experiment_name="limiting_testing")
|
38
|
+
except Exception as e:
|
39
|
+
self.fail(f"Should have not failed: {e}")
|
40
|
+
|
41
|
+
def test_update_method_update_seq_table_run(self):
|
42
|
+
try:
|
43
|
+
loc = FiftyFourVialPlate(plate=Plate.ONE, letter=Letter.F, num=Num.TWO)
|
44
|
+
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
45
|
+
seq_table = SequenceTable(
|
46
|
+
name=DEFAULT_SEQUENCE,
|
47
|
+
rows=[SequenceEntry(
|
48
|
+
vial_location=loc,
|
49
|
+
sample_name="run seq with new method",
|
50
|
+
method=DEFAULT_METHOD,
|
51
|
+
inj_source=InjectionSource.HIP_ALS,
|
52
|
+
inj_vol=0.5,
|
53
|
+
num_inj=1,
|
54
|
+
sample_type=SampleType.SAMPLE
|
55
|
+
)])
|
56
|
+
self.hplc_controller.edit_sequence(seq_table) # bug didnt delete all the rows, left an extra
|
57
|
+
|
58
|
+
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
59
|
+
rand_method = MethodDetails(
|
60
|
+
name=DEFAULT_METHOD,
|
61
|
+
params=HPLCMethodParams(
|
62
|
+
organic_modifier=5,
|
63
|
+
flow=0.65),
|
64
|
+
timetable=[TimeTableEntry(
|
65
|
+
start_time=random.randint(1, 3) + 0.50,
|
66
|
+
organic_modifer=100,
|
67
|
+
flow=0.65)],
|
68
|
+
stop_time=random.randint(4, 6),
|
69
|
+
post_time=1)
|
70
|
+
self.hplc_controller.edit_method(rand_method, save=True)
|
71
|
+
if run_too:
|
72
|
+
self.hplc_controller.preprun()
|
73
|
+
self.hplc_controller.run_sequence()
|
74
|
+
chrom = self.hplc_controller.get_last_run_sequence_data()
|
75
|
+
# report = process_csv_report(self.hplc_controller.sequence_controller.data_files[-1].child_dirs[-1])
|
76
|
+
# self.assertEqual(loc, report.ok_value.vial_location)
|
77
|
+
except Exception:
|
78
|
+
self.fail("Failed")
|
79
|
+
|
80
|
+
def test_run_sequence(self):
|
81
|
+
try:
|
82
|
+
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
83
|
+
self.hplc_controller.preprun()
|
84
|
+
self.hplc_controller.run_sequence()
|
85
|
+
chrom = self.hplc_controller.get_last_run_sequence_data()
|
86
|
+
self.assertTrue(len(chrom) == 1)
|
87
|
+
except Exception:
|
88
|
+
self.fail("Failed")
|