pychemstation 0.5.3.dev1__py3-none-any.whl → 0.5.4__py3-none-any.whl
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/control/comm.py +9 -5
- pychemstation/control/hplc.py +4 -4
- pychemstation/control/table/sequence.py +32 -39
- pychemstation/control/table/table_controller.py +33 -9
- pychemstation/utils/table_types.py +1 -0
- {pychemstation-0.5.3.dev1.dist-info → pychemstation-0.5.4.dist-info}/METADATA +3 -2
- {pychemstation-0.5.3.dev1.dist-info → pychemstation-0.5.4.dist-info}/RECORD +13 -13
- tests/constants.py +4 -4
- tests/test_comb.py +74 -60
- tests/test_sequence.py +48 -0
- {pychemstation-0.5.3.dev1.dist-info → pychemstation-0.5.4.dist-info}/LICENSE +0 -0
- {pychemstation-0.5.3.dev1.dist-info → pychemstation-0.5.4.dist-info}/WHEEL +0 -0
- {pychemstation-0.5.3.dev1.dist-info → pychemstation-0.5.4.dist-info}/top_level.txt +0 -0
pychemstation/control/comm.py
CHANGED
@@ -86,17 +86,18 @@ class CommunicationController:
|
|
86
86
|
|
87
87
|
def set_status(self):
|
88
88
|
"""Updates current status of HPLC machine"""
|
89
|
-
self._most_recent_hplc_status = self.get_status()
|
89
|
+
self._most_recent_hplc_status = self.get_status()
|
90
90
|
|
91
|
-
def check_if_running(self
|
91
|
+
def check_if_running(self) -> bool:
|
92
92
|
"""Checks if HPLC machine is in an available state, meaning a state that data is not being written.
|
93
93
|
|
94
94
|
:return: whether the HPLC machine is in a safe state to retrieve data back."""
|
95
95
|
self.set_status()
|
96
|
-
file_exists = os.path.exists(data_path)
|
97
96
|
hplc_avail = isinstance(self._most_recent_hplc_status, HPLCAvailStatus)
|
98
|
-
|
99
|
-
|
97
|
+
time.sleep(30)
|
98
|
+
self.set_status()
|
99
|
+
hplc_actually_avail = isinstance(self._most_recent_hplc_status, HPLCAvailStatus)
|
100
|
+
return hplc_avail and hplc_actually_avail
|
100
101
|
|
101
102
|
def _send(self, cmd: str, cmd_no: int, num_attempts=5) -> None:
|
102
103
|
"""Low-level execution primitive. Sends a command string to HPLC.
|
@@ -170,6 +171,9 @@ class CommunicationController:
|
|
170
171
|
cmd_to_send: str = cmd.value if isinstance(cmd, Command) else cmd
|
171
172
|
self.cmd_no += 1
|
172
173
|
self._send(cmd_to_send, self.cmd_no)
|
174
|
+
f = open("out.txt", "a")
|
175
|
+
f.write(cmd_to_send + "\n")
|
176
|
+
f.close()
|
173
177
|
|
174
178
|
def receive(self) -> Result[Response, str]:
|
175
179
|
"""Returns messages received in reply file.
|
pychemstation/control/hplc.py
CHANGED
@@ -91,15 +91,15 @@ class HPLCController:
|
|
91
91
|
"""
|
92
92
|
self.method_controller.run(experiment_name)
|
93
93
|
|
94
|
-
def run_sequence(self
|
94
|
+
def run_sequence(self):
|
95
95
|
"""
|
96
96
|
Starts the currently loaded sequence, storing data
|
97
97
|
under the <data_dir>/<sequence table name> folder.
|
98
98
|
Device must be ready.
|
99
99
|
|
100
|
-
:param
|
100
|
+
:param sequence_name:
|
101
101
|
"""
|
102
|
-
self.sequence_controller.run(
|
102
|
+
self.sequence_controller.run()
|
103
103
|
|
104
104
|
def edit_method(self, updated_method: MethodTimetable, save: bool = False):
|
105
105
|
"""Updated the currently loaded method in ChemStation with provided values.
|
@@ -114,7 +114,7 @@ class HPLCController:
|
|
114
114
|
Updates the currently loaded sequence table with the provided table. This method will delete the existing sequence table and remake it.
|
115
115
|
If you would only like to edit a single row of a sequence table, use `edit_sequence_row` instead.
|
116
116
|
|
117
|
-
:param
|
117
|
+
:param updated_sequence:
|
118
118
|
"""
|
119
119
|
self.sequence_controller.edit(updated_sequence)
|
120
120
|
|
@@ -30,7 +30,7 @@ class SequenceController(TableController):
|
|
30
30
|
|
31
31
|
if rows.is_ok() and seq_name.is_ok():
|
32
32
|
return SequenceTable(
|
33
|
-
name=seq_name.ok_value.
|
33
|
+
name=seq_name.ok_value.string_response.partition(".S")[0],
|
34
34
|
rows=[self.get_row(r + 1) for r in range(int(rows.ok_value.num_response))])
|
35
35
|
raise RuntimeError(rows.err_value)
|
36
36
|
|
@@ -73,34 +73,25 @@ class SequenceController(TableController):
|
|
73
73
|
|
74
74
|
:param sequence_table:
|
75
75
|
"""
|
76
|
-
|
77
|
-
self.
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
self.add_row()
|
87
|
-
self.sleep(1)
|
76
|
+
|
77
|
+
rows = self.get_num_rows()
|
78
|
+
if rows.is_ok():
|
79
|
+
existing_row_num = rows.value.num_response
|
80
|
+
wanted_row_num = len(sequence_table.rows)
|
81
|
+
while existing_row_num != wanted_row_num:
|
82
|
+
if wanted_row_num > existing_row_num:
|
83
|
+
self.add_row()
|
84
|
+
elif wanted_row_num < existing_row_num:
|
85
|
+
self.delete_row(int(existing_row_num))
|
88
86
|
self.send(Command.SAVE_SEQUENCE_CMD)
|
89
|
-
|
90
|
-
self.send(Command.
|
87
|
+
existing_row_num = self.get_num_rows().ok_value.num_response
|
88
|
+
self.send(Command.SWITCH_SEQUENCE_CMD)
|
89
|
+
|
91
90
|
for i, row in enumerate(sequence_table.rows):
|
92
91
|
self.edit_row(row=row, row_num=i + 1)
|
93
92
|
self.sleep(1)
|
94
93
|
self.send(Command.SAVE_SEQUENCE_CMD)
|
95
|
-
|
96
|
-
for i, row in enumerate(sequence_table.rows):
|
97
|
-
self.add_row()
|
98
|
-
self.sleep(0.1)
|
99
|
-
self.edit_row(row=row, row_num=i + 1)
|
100
|
-
self.sleep(0.1)
|
101
|
-
rows = self.get_num_rows()
|
102
|
-
self.send(Command.SAVE_SEQUENCE_CMD)
|
103
|
-
self.send(Command.SWITCH_SEQUENCE_CMD)
|
94
|
+
self.send(Command.SWITCH_SEQUENCE_CMD)
|
104
95
|
|
105
96
|
def edit_row(self, row: SequenceEntry, row_num: int):
|
106
97
|
"""
|
@@ -120,13 +111,16 @@ class SequenceController(TableController):
|
|
120
111
|
table_name = self.table.name
|
121
112
|
|
122
113
|
if row.vial_location:
|
114
|
+
loc = row.vial_location
|
115
|
+
if isinstance(row.vial_location, InjectionSource):
|
116
|
+
loc = row.vial_location.value
|
123
117
|
self.sleepy_send(TableOperation.EDIT_ROW_VAL.value.format(register=table_register,
|
124
118
|
table_name=table_name,
|
125
119
|
row=row_num,
|
126
120
|
col_name=RegisterFlag.VIAL_LOCATION,
|
127
|
-
val=
|
121
|
+
val=loc))
|
128
122
|
if row.method:
|
129
|
-
possible_path = os.path.join(self.method_dir, row.method)
|
123
|
+
possible_path = os.path.join(self.method_dir, row.method) + ".M\\"
|
130
124
|
method = row.method
|
131
125
|
if os.path.exists(possible_path):
|
132
126
|
method = os.path.join(self.method_dir, row.method)
|
@@ -177,23 +171,22 @@ class SequenceController(TableController):
|
|
177
171
|
|
178
172
|
self.send(Command.SAVE_SEQUENCE_CMD)
|
179
173
|
|
180
|
-
def run(self
|
174
|
+
def run(self):
|
181
175
|
"""
|
182
176
|
Starts the currently loaded sequence, storing data
|
183
177
|
under the <data_dir>/<sequence table name> folder.
|
184
178
|
Device must be ready.
|
185
|
-
|
186
|
-
:param sequence_table:
|
187
179
|
"""
|
188
180
|
timestamp = time.strftime(SEQUENCE_TIME_FORMAT)
|
181
|
+
seq_table = self.load()
|
189
182
|
self.send(Command.RUN_SEQUENCE_CMD.value)
|
190
183
|
|
191
184
|
if self.check_hplc_is_running():
|
192
|
-
folder_name = f"{
|
185
|
+
folder_name = f"{seq_table.name} {timestamp}"
|
193
186
|
self.data_files.append(SequenceDataFiles(dir=folder_name,
|
194
|
-
sequence_name=
|
187
|
+
sequence_name=seq_table.name))
|
195
188
|
|
196
|
-
run_completed = self.check_hplc_done_running()
|
189
|
+
run_completed = self.check_hplc_done_running(sequence=seq_table)
|
197
190
|
|
198
191
|
if run_completed.is_ok():
|
199
192
|
self.data_files[-1].dir = run_completed.value
|
@@ -202,16 +195,16 @@ class SequenceController(TableController):
|
|
202
195
|
|
203
196
|
def retrieve_recent_data_files(self):
|
204
197
|
sequence_data_files: SequenceDataFiles = self.data_files[-1]
|
205
|
-
return
|
198
|
+
return sequence_data_files.dir
|
206
199
|
|
207
200
|
def get_data(self) -> list[dict[str, AgilentHPLCChromatogram]]:
|
208
|
-
|
201
|
+
parent_dir = self.data_files[-1].dir
|
209
202
|
subdirs = [x[0] for x in os.walk(self.data_dir)]
|
210
|
-
potential_folders = sorted(list(filter(lambda d:
|
211
|
-
self.data_files[-1].child_dirs = potential_folders
|
203
|
+
potential_folders = sorted(list(filter(lambda d: parent_dir in d, subdirs)))
|
204
|
+
self.data_files[-1].child_dirs = [f for f in potential_folders if parent_dir in f and ".M" not in f and ".D" in f]
|
205
|
+
|
212
206
|
spectra: list[dict[str, AgilentHPLCChromatogram]] = []
|
213
|
-
for row in
|
214
|
-
|
215
|
-
self.get_spectrum(data_path)
|
207
|
+
for row in self.data_files[-1].child_dirs:
|
208
|
+
self.get_spectrum(row)
|
216
209
|
spectra.append(deepcopy(self.spectra))
|
217
210
|
return spectra
|
@@ -6,6 +6,7 @@ Authors: Lucy Hao
|
|
6
6
|
|
7
7
|
import abc
|
8
8
|
import os
|
9
|
+
import time
|
9
10
|
from typing import Union, Optional
|
10
11
|
|
11
12
|
import polling
|
@@ -15,7 +16,7 @@ from ...control import CommunicationController
|
|
15
16
|
from ...utils.chromatogram import AgilentHPLCChromatogram
|
16
17
|
from ...utils.macro import Command, HPLCRunningStatus, Response
|
17
18
|
from ...utils.method_types import MethodTimetable
|
18
|
-
from ...utils.sequence_types import SequenceDataFiles
|
19
|
+
from ...utils.sequence_types import SequenceDataFiles, SequenceTable
|
19
20
|
from ...utils.table_types import Table, TableOperation, RegisterFlag
|
20
21
|
|
21
22
|
|
@@ -82,6 +83,11 @@ class TableController(abc.ABC):
|
|
82
83
|
def get_row(self, row: int):
|
83
84
|
pass
|
84
85
|
|
86
|
+
def delete_row(self, row: int):
|
87
|
+
self.sleepy_send(TableOperation.DELETE_ROW.value.format(register=self.table.register,
|
88
|
+
table_name=self.table.name,
|
89
|
+
row=row))
|
90
|
+
|
85
91
|
def add_row(self):
|
86
92
|
"""
|
87
93
|
Adds a row to the provided table for currently loaded method or sequence.
|
@@ -124,7 +130,7 @@ class TableController(abc.ABC):
|
|
124
130
|
res = self.controller.receive()
|
125
131
|
|
126
132
|
if res.is_ok():
|
127
|
-
self.send("Sleep 1")
|
133
|
+
self.send("Sleep 0.1")
|
128
134
|
self.send('Print Rows')
|
129
135
|
return res
|
130
136
|
else:
|
@@ -137,24 +143,42 @@ class TableController(abc.ABC):
|
|
137
143
|
max_tries=10)
|
138
144
|
return started_running
|
139
145
|
|
140
|
-
def check_hplc_done_running(self,
|
146
|
+
def check_hplc_done_running(self,
|
147
|
+
method: Optional[MethodTimetable] = None,
|
148
|
+
sequence: Optional[SequenceTable] = None) -> Result[str, str]:
|
141
149
|
"""
|
142
150
|
Checks if ChemStation has finished running and can read data back
|
143
151
|
|
144
152
|
:param method: if you are running a method and want to read back data, the timeout period will be adjusted to be longer than the method's runtime
|
145
153
|
:return: Return True if data can be read back, else False.
|
146
154
|
"""
|
147
|
-
timeout = 10 * 60
|
155
|
+
timeout = 10 * 60
|
156
|
+
if method:
|
157
|
+
timeout = ((method.first_row.maximum_run_time + 2) * 60)
|
158
|
+
if sequence:
|
159
|
+
timeout *= len(sequence.rows)
|
160
|
+
|
148
161
|
most_recent_folder = self.retrieve_recent_data_files()
|
149
162
|
finished_run = polling.poll(
|
150
|
-
lambda: self.controller.check_if_running(
|
163
|
+
lambda: self.controller.check_if_running(),
|
151
164
|
timeout=timeout,
|
152
|
-
step=
|
165
|
+
step=60
|
153
166
|
)
|
167
|
+
|
154
168
|
if finished_run:
|
155
|
-
|
156
|
-
|
157
|
-
|
169
|
+
if os.path.exists(most_recent_folder):
|
170
|
+
return Ok(most_recent_folder)
|
171
|
+
else:
|
172
|
+
subdirs = [x[0] for x in os.walk(self.data_dir)]
|
173
|
+
potential_folders = sorted(list(filter(lambda d: most_recent_folder in d, subdirs)))
|
174
|
+
parent_dirs = []
|
175
|
+
for folder in potential_folders:
|
176
|
+
path = os.path.normpath(folder)
|
177
|
+
split_folder = path.split(os.sep)
|
178
|
+
if most_recent_folder in split_folder[-1]:
|
179
|
+
parent_dirs.append(folder)
|
180
|
+
parent_dir = sorted(parent_dirs, reverse=True)[0]
|
181
|
+
return Ok(parent_dir)
|
158
182
|
else:
|
159
183
|
return Err("Run did not complete as expected")
|
160
184
|
|
@@ -9,6 +9,7 @@ class TableOperation(Enum):
|
|
9
9
|
DELETE_TABLE = 'DelTab {register}, "{table_name}"'
|
10
10
|
CREATE_TABLE = 'NewTab {register}, "{table_name}"'
|
11
11
|
NEW_ROW = 'InsTabRow {register}, "{table_name}"'
|
12
|
+
DELETE_ROW = 'DelTabRow {register}, "{table_name}", {row}'
|
12
13
|
EDIT_ROW_VAL = 'SetTabVal "{register}", "{table_name}", {row}, "{col_name}", {val}'
|
13
14
|
EDIT_ROW_TEXT = 'SetTabText "{register}", "{table_name}", {row}, "{col_name}", "{val}"'
|
14
15
|
GET_ROW_VAL = 'TabVal("{register}", "{table_name}", {row}, "{col_name}")'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pychemstation
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.4
|
4
4
|
Summary: Library to interact with Chemstation software, primarily used in Hein lab
|
5
|
-
Home-page: https://gitlab.com/heingroup/pychemstation
|
5
|
+
Home-page: https://gitlab.com/heingroup/device-api/pychemstation
|
6
6
|
Author: Lucy Hao
|
7
7
|
Author-email: lhao03@student.ubc.ca
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
@@ -12,6 +12,7 @@ Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
13
13
|
Requires-Dist: polling
|
14
14
|
Requires-Dist: seabreeze
|
15
|
+
Requires-Dist: xsdata
|
15
16
|
|
16
17
|
# Agilent HPLC Macro Control
|
17
18
|
|
@@ -4,12 +4,12 @@ pychemstation/analysis/base_spectrum.py,sha256=FBvwzLtF9mdqW7f8ETY9G4cpfJ-SzbiSk
|
|
4
4
|
pychemstation/analysis/spec_utils.py,sha256=8NZMV0dtfxZLARjWzM5ks0tgEYQv_SKUiZzba2IoKgw,10505
|
5
5
|
pychemstation/analysis/utils.py,sha256=ISupAOb_yqA4_DZRK9v18UL-XjUQccAicIJKb1VMnGg,2055
|
6
6
|
pychemstation/control/__init__.py,sha256=aH9cPf-ljrVeVhN0K3cyEcAavmPXCjhhOnpLNf8qLqE,106
|
7
|
-
pychemstation/control/comm.py,sha256=
|
8
|
-
pychemstation/control/hplc.py,sha256=
|
7
|
+
pychemstation/control/comm.py,sha256=u44g1hTluQ0yUG93Un-QAshScoDpgYRrZfFTgweP5tY,7386
|
8
|
+
pychemstation/control/hplc.py,sha256=huEUl90Ylvzvy2TXWUjhyDU4PazrK7Z51M8spquHvVg,6719
|
9
9
|
pychemstation/control/table/__init__.py,sha256=RgMN4uIWHdNUHpGRBWdzmzAbk7XEKl6Y-qtqWCxzSZU,124
|
10
10
|
pychemstation/control/table/method.py,sha256=THVoGomSXff_CTU3eAYme0BYwkPzab5UgZKsiZ29QSk,12196
|
11
|
-
pychemstation/control/table/sequence.py,sha256=
|
12
|
-
pychemstation/control/table/table_controller.py,sha256=
|
11
|
+
pychemstation/control/table/sequence.py,sha256=Eri52AnbE3BGthfrRSvYKYciquUzvHKo0lYUTySYYE8,10542
|
12
|
+
pychemstation/control/table/table_controller.py,sha256=F5lv1DlPkEDcFmtwVT-E9Kq075jnWIN-iZIM3_mTt5E,8115
|
13
13
|
pychemstation/generated/__init__.py,sha256=GAoZFAYbPVEJDkcOw3e1rgOqd7TCW0HyKNPM8OMehMg,1005
|
14
14
|
pychemstation/generated/dad_method.py,sha256=0W8Z5WDtF5jpIcudMqb7XrkTnR2EGg_QOCsHRFQ0rmM,8402
|
15
15
|
pychemstation/generated/pump_method.py,sha256=sUhE2Oo00nzVcoONtq3EMWsN4wLSryXbG8f3EeViWKg,12174
|
@@ -19,16 +19,16 @@ pychemstation/utils/macro.py,sha256=BAIcE_dppNffwrSqGq8gh0ccE9YAJfQFQZHXJgA1WtA,
|
|
19
19
|
pychemstation/utils/method_types.py,sha256=YngbyHg96JSFnvhm5Zd7wJvLTQPPQsLbvbyz3HlGLYY,862
|
20
20
|
pychemstation/utils/parsing.py,sha256=bnFIsZZwFy9NKzVUf517yN-ogzQbm0hp_aho3KUD6Is,9317
|
21
21
|
pychemstation/utils/sequence_types.py,sha256=3VqiUHsfFEdynAxfR-z8JIWBCo7PdnGwTvsk7sm7Ij8,1055
|
22
|
-
pychemstation/utils/table_types.py,sha256=
|
22
|
+
pychemstation/utils/table_types.py,sha256=cN51Ry2pammDdk85cabVH3qkchjKKIzZfAH87Poty80,2350
|
23
23
|
pychemstation/utils/tray_types.py,sha256=UUDED-IAf-8FmPVZezuWSiIQE_HgiZQMV2sTqu4oZw8,177
|
24
24
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
tests/constants.py,sha256=
|
26
|
-
tests/test_comb.py,sha256=
|
25
|
+
tests/constants.py,sha256=lLwT_QaVriivL5llkul6RxXxPriwUp1E-Y3G9fejvbo,2092
|
26
|
+
tests/test_comb.py,sha256=faF4764oJEZ2vhG9-zLmQxjATseipRKXrStehuDCXOI,5638
|
27
27
|
tests/test_comm.py,sha256=1ZZd0UrIBOKe91wzA-XI-gSRgXmId9mLWYSMeche82Y,2973
|
28
28
|
tests/test_method.py,sha256=uCPpZVYKPz1CNWwhmBo_8TH0ku2V0ZpDZJj3f8iINB4,2440
|
29
|
-
tests/test_sequence.py,sha256=
|
30
|
-
pychemstation-0.5.
|
31
|
-
pychemstation-0.5.
|
32
|
-
pychemstation-0.5.
|
33
|
-
pychemstation-0.5.
|
34
|
-
pychemstation-0.5.
|
29
|
+
tests/test_sequence.py,sha256=yIQGhUTehtHz6D1ai5W6AlP0zes2icF0VdQ0IGJ2CbQ,4901
|
30
|
+
pychemstation-0.5.4.dist-info/LICENSE,sha256=9bdF75gIf1MecZ7oymqWgJREVz7McXPG-mjqrTmzzD8,18658
|
31
|
+
pychemstation-0.5.4.dist-info/METADATA,sha256=TN5NWM9_QmES6TmIm_pXGvQxlNTQsHJDiP1wd1dRktA,3992
|
32
|
+
pychemstation-0.5.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
33
|
+
pychemstation-0.5.4.dist-info/top_level.txt,sha256=zXfKu_4nYWwPHo3OsuhshMNC3SPkcoTGCyODjURaghY,20
|
34
|
+
pychemstation-0.5.4.dist-info/RECORD,,
|
tests/constants.py
CHANGED
@@ -4,7 +4,7 @@ from pychemstation.utils.method_types import *
|
|
4
4
|
from pychemstation.utils.sequence_types import *
|
5
5
|
|
6
6
|
DEFAULT_METHOD = "GENERAL-POROSHELL-OPT"
|
7
|
-
DEFAULT_SEQUENCE = "
|
7
|
+
DEFAULT_SEQUENCE = "LLETest"
|
8
8
|
|
9
9
|
# CONSTANTS: paths only work in Hein group HPLC machine in room 242
|
10
10
|
DEFAULT_COMMAND_PATH = "C:\\Users\\User\\Desktop\\Lucy\\"
|
@@ -20,8 +20,8 @@ HEIN_LAB_CONSTANTS = [DEFAULT_COMMAND_PATH,
|
|
20
20
|
# these CONSTANTS work in rm 254
|
21
21
|
DEFAULT_COMMAND_PATH_254 = "D:\\\git_repositories\\\hplc_comm\\"
|
22
22
|
DEFAULT_METHOD_DIR_254 = "D:\\Chemstation\\1\\Methods\\"
|
23
|
-
DATA_DIR_254 = "D:\\Chemstation\\1\\Data"
|
24
|
-
SEQUENCE_DIR_254 = "C:\\1\\Sequence"
|
23
|
+
DATA_DIR_254 = "D:\\Chemstation\\1\\Data\\2024-12\\"
|
24
|
+
SEQUENCE_DIR_254 = "C:\\1\\Sequence\\"
|
25
25
|
|
26
26
|
HEIN_LAB_CONSTANTS_254 = [DEFAULT_COMMAND_PATH_254,
|
27
27
|
DEFAULT_METHOD_DIR_254,
|
@@ -42,7 +42,7 @@ def gen_rand_method():
|
|
42
42
|
return MethodTimetable(
|
43
43
|
first_row=HPLCMethodParams(
|
44
44
|
organic_modifier=org_modifier,
|
45
|
-
flow=random.random(),
|
45
|
+
flow=round(random.random(), 2),
|
46
46
|
maximum_run_time=max_run_time),
|
47
47
|
subsequent_rows=[
|
48
48
|
TimeTableEntry(
|
tests/test_comb.py
CHANGED
@@ -5,9 +5,7 @@ import unittest
|
|
5
5
|
from pychemstation.control import HPLCController
|
6
6
|
from tests.constants import *
|
7
7
|
|
8
|
-
run_too =
|
9
|
-
|
10
|
-
|
8
|
+
run_too = True
|
11
9
|
|
12
10
|
|
13
11
|
class TestCombinations(unittest.TestCase):
|
@@ -24,11 +22,23 @@ class TestCombinations(unittest.TestCase):
|
|
24
22
|
sequence_dir=path_constants[3])
|
25
23
|
|
26
24
|
def test_run_method_after_update(self):
|
27
|
-
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
28
|
-
|
29
25
|
try:
|
30
|
-
|
31
|
-
|
26
|
+
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
27
|
+
rand_method = MethodTimetable(
|
28
|
+
first_row=HPLCMethodParams(
|
29
|
+
organic_modifier=5,
|
30
|
+
flow=0.65,
|
31
|
+
maximum_run_time=2),
|
32
|
+
subsequent_rows=[
|
33
|
+
TimeTableEntry(
|
34
|
+
start_time=0.10,
|
35
|
+
organic_modifer=5,
|
36
|
+
flow=0.34),
|
37
|
+
TimeTableEntry(
|
38
|
+
start_time=1,
|
39
|
+
organic_modifer=98,
|
40
|
+
flow=0.55)])
|
41
|
+
self.hplc_controller.edit_method(rand_method, save=True)
|
32
42
|
if run_too:
|
33
43
|
self.hplc_controller.run_method(experiment_name="changed_method")
|
34
44
|
except Exception as e:
|
@@ -38,13 +48,24 @@ class TestCombinations(unittest.TestCase):
|
|
38
48
|
try:
|
39
49
|
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
40
50
|
seq_table = self.hplc_controller.load_sequence()
|
41
|
-
seq_table.rows
|
42
|
-
|
43
|
-
|
44
|
-
|
51
|
+
seq_table.rows.append(SequenceEntry(
|
52
|
+
vial_location=TenColumn.ONE,
|
53
|
+
method=DEFAULT_METHOD,
|
54
|
+
num_inj=3,
|
55
|
+
inj_vol=4,
|
56
|
+
sample_name="Sampel1",
|
57
|
+
sample_type=SampleType.SAMPLE,
|
58
|
+
))
|
59
|
+
seq_table.rows[0] = SequenceEntry(
|
60
|
+
vial_location=TenColumn.ONE,
|
61
|
+
method=DEFAULT_METHOD,
|
62
|
+
num_inj=3,
|
63
|
+
inj_vol=4,
|
64
|
+
sample_name="Sampel2",
|
65
|
+
sample_type=SampleType.SAMPLE)
|
45
66
|
self.hplc_controller.edit_sequence(seq_table)
|
46
67
|
if run_too:
|
47
|
-
self.hplc_controller.run_sequence(
|
68
|
+
self.hplc_controller.run_sequence()
|
48
69
|
chrom = self.hplc_controller.get_last_run_sequence_data()
|
49
70
|
self.assertTrue(len(chrom) == 2)
|
50
71
|
except Exception as e:
|
@@ -56,7 +77,7 @@ class TestCombinations(unittest.TestCase):
|
|
56
77
|
seq_table = self.hplc_controller.load_sequence()
|
57
78
|
self.hplc_controller.edit_sequence_row(seq_entry, 1)
|
58
79
|
if run_too:
|
59
|
-
self.hplc_controller.run_sequence(
|
80
|
+
self.hplc_controller.run_sequence()
|
60
81
|
chrom = self.hplc_controller.get_last_run_sequence_data()
|
61
82
|
self.assertTrue(len(chrom) == 2)
|
62
83
|
except Exception:
|
@@ -65,65 +86,58 @@ class TestCombinations(unittest.TestCase):
|
|
65
86
|
def test_update_method_update_seq_table_run(self):
|
66
87
|
try:
|
67
88
|
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
68
|
-
rand_method =
|
89
|
+
rand_method = MethodTimetable(
|
90
|
+
first_row=HPLCMethodParams(
|
91
|
+
organic_modifier=5,
|
92
|
+
flow=0.65,
|
93
|
+
maximum_run_time=2),
|
94
|
+
subsequent_rows=[
|
95
|
+
TimeTableEntry(
|
96
|
+
start_time=0.50,
|
97
|
+
organic_modifer=99,
|
98
|
+
flow=0.34)])
|
69
99
|
self.hplc_controller.edit_method(rand_method, save=True)
|
70
100
|
|
71
101
|
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
72
|
-
seq_table =
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
seq_table.rows[0].inj_source = InjectionSource.HIP_ALS
|
96
|
-
seq_table.rows[0].method = DEFAULT_METHOD
|
97
|
-
seq_table.rows[1].vial_location = TenColumn.TWO
|
98
|
-
seq_table.rows[1].inj_source = InjectionSource.HIP_ALS
|
99
|
-
seq_table.rows[1].method = DEFAULT_METHOD
|
102
|
+
seq_table = SequenceTable(
|
103
|
+
name=DEFAULT_SEQUENCE,
|
104
|
+
rows=[
|
105
|
+
SequenceEntry(
|
106
|
+
vial_location=8320,
|
107
|
+
sample_name="WM-01-001_Cr-Org",
|
108
|
+
method=DEFAULT_METHOD,
|
109
|
+
inj_source=InjectionSource.HIP_ALS,
|
110
|
+
inj_vol=2,
|
111
|
+
num_inj=1,
|
112
|
+
sample_type=SampleType.SAMPLE
|
113
|
+
),
|
114
|
+
SequenceEntry(
|
115
|
+
vial_location=8448,
|
116
|
+
sample_name="WM-01-001_Cr-Aq",
|
117
|
+
method=DEFAULT_METHOD,
|
118
|
+
inj_source=InjectionSource.HIP_ALS,
|
119
|
+
inj_vol=2,
|
120
|
+
num_inj=1,
|
121
|
+
sample_type=SampleType.SAMPLE
|
122
|
+
),
|
123
|
+
]
|
124
|
+
)
|
100
125
|
|
101
126
|
self.hplc_controller.edit_sequence(seq_table)
|
102
|
-
self.hplc_controller.edit_sequence_row(
|
103
|
-
SequenceEntry(
|
104
|
-
vial_location=TenColumn.ONE,
|
105
|
-
method=DEFAULT_METHOD,
|
106
|
-
num_inj=3,
|
107
|
-
inj_vol=4,
|
108
|
-
sample_name="Blank",
|
109
|
-
sample_type=SampleType.BLANK,
|
110
|
-
)
|
111
|
-
)
|
112
127
|
if run_too:
|
113
|
-
self.hplc_controller.
|
128
|
+
self.hplc_controller.preprun()
|
129
|
+
self.hplc_controller.run_sequence()
|
114
130
|
chrom = self.hplc_controller.get_last_run_sequence_data()
|
115
131
|
self.assertTrue(len(chrom) == 2)
|
116
132
|
except Exception:
|
117
133
|
self.fail("Failed")
|
118
134
|
|
119
|
-
def
|
135
|
+
def test_run_sequence(self):
|
120
136
|
try:
|
121
137
|
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
122
|
-
|
123
|
-
self.hplc_controller.
|
124
|
-
|
125
|
-
|
126
|
-
chrom = self.hplc_controller.get_last_run_sequence_data()
|
127
|
-
self.assertTrue(len(chrom) == 2)
|
138
|
+
self.hplc_controller.preprun()
|
139
|
+
self.hplc_controller.run_sequence()
|
140
|
+
chrom = self.hplc_controller.get_last_run_sequence_data()
|
141
|
+
self.assertTrue(len(chrom) == 2)
|
128
142
|
except Exception:
|
129
143
|
self.fail("Failed")
|
tests/test_sequence.py
CHANGED
@@ -63,6 +63,54 @@ class TestSequence(unittest.TestCase):
|
|
63
63
|
sample_name="Sampel2",
|
64
64
|
sample_type=SampleType.SAMPLE,
|
65
65
|
inj_source=InjectionSource.HIP_ALS
|
66
|
+
),
|
67
|
+
SequenceEntry(
|
68
|
+
vial_location=TenColumn.TEN,
|
69
|
+
method=DEFAULT_METHOD,
|
70
|
+
num_inj=3,
|
71
|
+
inj_vol=4,
|
72
|
+
sample_name="Sampel2",
|
73
|
+
sample_type=SampleType.SAMPLE,
|
74
|
+
inj_source=InjectionSource.HIP_ALS
|
75
|
+
),
|
76
|
+
SequenceEntry(
|
77
|
+
vial_location=TenColumn.THREE,
|
78
|
+
method=DEFAULT_METHOD,
|
79
|
+
num_inj=3,
|
80
|
+
inj_vol=4,
|
81
|
+
sample_name="Sampel2",
|
82
|
+
sample_type=SampleType.SAMPLE,
|
83
|
+
inj_source=InjectionSource.HIP_ALS
|
84
|
+
)
|
85
|
+
]
|
86
|
+
)
|
87
|
+
self.hplc_controller.edit_sequence(seq_table)
|
88
|
+
except Exception:
|
89
|
+
self.fail("Should have not occured")
|
90
|
+
|
91
|
+
def test_edit_entire_table_less_rows(self):
|
92
|
+
self.hplc_controller.switch_sequence(sequence_name=DEFAULT_SEQUENCE)
|
93
|
+
try:
|
94
|
+
seq_table = SequenceTable(
|
95
|
+
name=DEFAULT_SEQUENCE,
|
96
|
+
rows=[
|
97
|
+
SequenceEntry(
|
98
|
+
vial_location=TenColumn.TEN,
|
99
|
+
method=DEFAULT_METHOD,
|
100
|
+
num_inj=3,
|
101
|
+
inj_vol=4,
|
102
|
+
sample_name="Sampel2",
|
103
|
+
sample_type=SampleType.SAMPLE,
|
104
|
+
inj_source=InjectionSource.HIP_ALS
|
105
|
+
),
|
106
|
+
SequenceEntry(
|
107
|
+
vial_location=TenColumn.THREE,
|
108
|
+
method=DEFAULT_METHOD,
|
109
|
+
num_inj=3,
|
110
|
+
inj_vol=4,
|
111
|
+
sample_name="Sampel2",
|
112
|
+
sample_type=SampleType.SAMPLE,
|
113
|
+
inj_source=InjectionSource.HIP_ALS
|
66
114
|
)
|
67
115
|
]
|
68
116
|
)
|
File without changes
|
File without changes
|
File without changes
|