pychemstation 0.10.9__py3-none-any.whl → 0.10.11__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/controllers/data_aq/method.py +16 -75
- pychemstation/control/controllers/data_aq/sequence.py +29 -29
- pychemstation/control/controllers/devices/injector.py +2 -12
- pychemstation/utils/abc_tables/table.py +20 -12
- {pychemstation-0.10.9.dist-info → pychemstation-0.10.11.dist-info}/METADATA +1 -1
- {pychemstation-0.10.9.dist-info → pychemstation-0.10.11.dist-info}/RECORD +8 -8
- {pychemstation-0.10.9.dist-info → pychemstation-0.10.11.dist-info}/WHEEL +0 -0
- {pychemstation-0.10.9.dist-info → pychemstation-0.10.11.dist-info}/licenses/LICENSE +0 -0
@@ -114,23 +114,20 @@ class MethodController(RunController):
|
|
114
114
|
return entries
|
115
115
|
|
116
116
|
def load(self) -> MethodDetails:
|
117
|
-
rows = self.
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
return self.table_state
|
132
|
-
else:
|
133
|
-
raise RuntimeError(rows.err_value)
|
117
|
+
rows = self.get_row_count_safely()
|
118
|
+
method_name = self.get_method_name()
|
119
|
+
timetable_rows = self.get_timetable(rows)
|
120
|
+
params = self.get_method_params()
|
121
|
+
stop_time = self.get_stop_time()
|
122
|
+
post_time = self.get_post_time()
|
123
|
+
self.table_state = MethodDetails(
|
124
|
+
name=method_name,
|
125
|
+
timetable=timetable_rows,
|
126
|
+
stop_time=stop_time,
|
127
|
+
post_time=post_time,
|
128
|
+
params=params,
|
129
|
+
)
|
130
|
+
return self.table_state
|
134
131
|
|
135
132
|
def get_method_name(self):
|
136
133
|
self.send(Command.GET_METHOD_CMD)
|
@@ -443,62 +440,6 @@ class MethodController(RunController):
|
|
443
440
|
self.download()
|
444
441
|
return time_added, flow_added, om_added, function_added
|
445
442
|
|
446
|
-
# if first_row:
|
447
|
-
# time_added = False
|
448
|
-
# flow_row_method: Callable = (
|
449
|
-
# self.add_new_col_text
|
450
|
-
# if row.flow and not row.organic_modifer
|
451
|
-
# else self._edit_row_text
|
452
|
-
# )
|
453
|
-
# if row.organic_modifer:
|
454
|
-
# self.add_row()
|
455
|
-
# self.add_new_col_text(
|
456
|
-
# col_name=RegisterFlag.FUNCTION,
|
457
|
-
# val=RegisterFlag.SOLVENT_COMPOSITION.value,
|
458
|
-
# )
|
459
|
-
# if not time_added:
|
460
|
-
# time_added = True
|
461
|
-
# self.add_new_col_num(col_name=RegisterFlag.TIME, val=row.start_time)
|
462
|
-
# self.add_new_col_num(
|
463
|
-
# col_name=RegisterFlag.TIMETABLE_SOLVENT_B_COMPOSITION,
|
464
|
-
# val=row.organic_modifer,
|
465
|
-
# )
|
466
|
-
# if row.flow:
|
467
|
-
# self.add_row()
|
468
|
-
# self.get_num_rows()
|
469
|
-
# flow_row_method(
|
470
|
-
# col_name=RegisterFlag.FUNCTION, val=RegisterFlag.FLOW.value
|
471
|
-
# )
|
472
|
-
# if not time_added:
|
473
|
-
# time_added = True
|
474
|
-
# self.add_new_col_num(col_name=RegisterFlag.TIME, val=row.start_time)
|
475
|
-
# self.add_new_col_num(col_name=RegisterFlag.TIMETABLE_FLOW, val=row.flow)
|
476
|
-
# self._edit_row_num(col_name=RegisterFlag.TIMETABLE_FLOW, val=row.flow)
|
477
|
-
# self.download()
|
478
|
-
# else:
|
479
|
-
# if row.organic_modifer:
|
480
|
-
# self.add_row()
|
481
|
-
# self.get_num_rows()
|
482
|
-
# self._edit_row_text(
|
483
|
-
# col_name=RegisterFlag.FUNCTION,
|
484
|
-
# val=RegisterFlag.SOLVENT_COMPOSITION.value,
|
485
|
-
# )
|
486
|
-
# self._edit_row_num(col_name=RegisterFlag.TIME, val=row.start_time)
|
487
|
-
# self._edit_row_num(
|
488
|
-
# col_name=RegisterFlag.TIMETABLE_SOLVENT_B_COMPOSITION,
|
489
|
-
# val=row.organic_modifer,
|
490
|
-
# )
|
491
|
-
# self.download()
|
492
|
-
# if row.flow:
|
493
|
-
# self.add_row()
|
494
|
-
# self.get_num_rows()
|
495
|
-
# self._edit_row_text(
|
496
|
-
# col_name=RegisterFlag.FUNCTION, val=RegisterFlag.FLOW.value
|
497
|
-
# )
|
498
|
-
# self._edit_row_num(col_name=RegisterFlag.TIMETABLE_FLOW, val=row.flow)
|
499
|
-
# self._edit_row_num(col_name=RegisterFlag.TIME, val=row.start_time)
|
500
|
-
# self.download()
|
501
|
-
|
502
443
|
def edit_method_timetable(self, timetable_rows: List[TimeTableEntry]):
|
503
444
|
self.get_num_rows()
|
504
445
|
self.delete_table()
|
@@ -508,8 +449,8 @@ class MethodController(RunController):
|
|
508
449
|
res = self.get_num_rows()
|
509
450
|
|
510
451
|
self.new_table()
|
511
|
-
num_rows = self.
|
512
|
-
if num_rows
|
452
|
+
num_rows = self.get_row_count_safely()
|
453
|
+
if num_rows != 0:
|
513
454
|
raise ValueError("Should be zero rows!")
|
514
455
|
|
515
456
|
time_added = False
|
@@ -55,19 +55,20 @@ class SequenceController(RunController):
|
|
55
55
|
)
|
56
56
|
|
57
57
|
def load(self) -> SequenceTable:
|
58
|
-
rows = self.
|
58
|
+
rows = self.get_row_count_safely()
|
59
59
|
self.send(Command.GET_SEQUENCE_CMD)
|
60
60
|
seq_name = self.receive()
|
61
61
|
|
62
|
-
if
|
62
|
+
if seq_name.is_ok():
|
63
63
|
self.table_state: SequenceTable = SequenceTable(
|
64
64
|
name=seq_name.ok_value.string_response.partition(".S")[0],
|
65
|
-
rows=[
|
66
|
-
self.get_row(r + 1) for r in range(int(rows.ok_value.num_response))
|
67
|
-
],
|
65
|
+
rows=[self.get_row(r + 1) for r in range(int(rows))],
|
68
66
|
)
|
69
67
|
return self.table_state
|
70
|
-
|
68
|
+
else:
|
69
|
+
raise RuntimeError(
|
70
|
+
f"couldn't read rows or sequence name: {seq_name.err_value}"
|
71
|
+
)
|
71
72
|
|
72
73
|
def try_int(self, val: Any) -> Optional[int]:
|
73
74
|
try:
|
@@ -136,23 +137,21 @@ class SequenceController(RunController):
|
|
136
137
|
:param sequence_table:
|
137
138
|
"""
|
138
139
|
self.table_state = sequence_table
|
139
|
-
rows = self.
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
self.add_row()
|
148
|
-
self.save()
|
149
|
-
self.send(Command.SWITCH_SEQUENCE_CMD)
|
150
|
-
|
151
|
-
for i, row in enumerate(sequence_table.rows):
|
152
|
-
self._edit_row(row=row, row_num=i + 1)
|
153
|
-
self.sleep(1)
|
140
|
+
rows = self.get_row_count_safely()
|
141
|
+
existing_row_num = rows
|
142
|
+
wanted_row_num = len(sequence_table.rows)
|
143
|
+
for i in range(int(existing_row_num)):
|
144
|
+
self.delete_row(int(existing_row_num - i))
|
145
|
+
self.send(Command.SAVE_SEQUENCE_CMD)
|
146
|
+
for i in range(int(wanted_row_num)):
|
147
|
+
self.add_row()
|
154
148
|
self.save()
|
155
|
-
|
149
|
+
self.send(Command.SWITCH_SEQUENCE_CMD)
|
150
|
+
for i, row in enumerate(sequence_table.rows):
|
151
|
+
self._edit_row(row=row, row_num=i + 1)
|
152
|
+
self.sleep(1)
|
153
|
+
self.save()
|
154
|
+
self.send(Command.SWITCH_SEQUENCE_CMD)
|
156
155
|
|
157
156
|
def _edit_row(self, row: SequenceEntry, row_num: int):
|
158
157
|
"""
|
@@ -161,12 +160,11 @@ class SequenceController(RunController):
|
|
161
160
|
:param row: sequence row entry with updated information
|
162
161
|
:param row_num: the row to edit, based on 1-based indexing
|
163
162
|
"""
|
164
|
-
num_rows = self.
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
num_rows = self.get_num_rows()
|
163
|
+
num_rows = self.get_row_count_safely()
|
164
|
+
while num_rows < row_num:
|
165
|
+
self.add_row()
|
166
|
+
self.save()
|
167
|
+
num_rows = self.get_row_count_safely()
|
170
168
|
if row.vial_location:
|
171
169
|
self.edit_vial_location(row.vial_location, row_num, save=False)
|
172
170
|
if row.method:
|
@@ -268,7 +266,7 @@ class SequenceController(RunController):
|
|
268
266
|
elif isinstance(loc, VialBar) or isinstance(loc, FiftyFourVialPlate):
|
269
267
|
self.add_row()
|
270
268
|
previous_contents.vial_location = loc
|
271
|
-
num_rows = self.
|
269
|
+
num_rows = self.get_row_count_safely()
|
272
270
|
self._edit_row(previous_contents, num_rows)
|
273
271
|
self.move_row(int(num_rows), row_num)
|
274
272
|
self.delete_row(row_num + 1)
|
@@ -339,6 +337,8 @@ class SequenceController(RunController):
|
|
339
337
|
hplc_running = self.check_hplc_is_running()
|
340
338
|
if hplc_running:
|
341
339
|
break
|
340
|
+
else:
|
341
|
+
self.send(Command.RUN_SEQUENCE_CMD.value)
|
342
342
|
|
343
343
|
if hplc_running:
|
344
344
|
full_path_name, current_sample_file = self.try_getting_run_info(folder_name)
|
@@ -15,7 +15,6 @@ from ....utils.injector_types import (
|
|
15
15
|
DrawDefaultVolume,
|
16
16
|
DrawDefaultLocation,
|
17
17
|
)
|
18
|
-
from ....utils.macro import Response
|
19
18
|
from ....utils.table_types import RegisterFlag, Table
|
20
19
|
from ....utils.tray_types import Tray, FiftyFourVialPlate, VialBar, LocationPlus
|
21
20
|
|
@@ -93,14 +92,5 @@ class InjectorController(DeviceController):
|
|
93
92
|
raise ValueError("No valid function found.")
|
94
93
|
|
95
94
|
def load(self) -> InjectorTable | None:
|
96
|
-
rows = self.
|
97
|
-
|
98
|
-
row_response = rows.value
|
99
|
-
if isinstance(row_response, Response):
|
100
|
-
return InjectorTable(
|
101
|
-
functions=[
|
102
|
-
self.get_row(i + 1)
|
103
|
-
for i in range(int(row_response.num_response))
|
104
|
-
]
|
105
|
-
)
|
106
|
-
raise ValueError("Couldn't read injector table rows.")
|
95
|
+
rows = self.get_row_count_safely()
|
96
|
+
return InjectorTable(functions=[self.get_row(i + 1) for i in range(rows)])
|
@@ -126,11 +126,9 @@ class ABCTableController(abc.ABC):
|
|
126
126
|
):
|
127
127
|
if not (isinstance(val, int) or isinstance(val, float)):
|
128
128
|
raise ValueError(f"{val} must be an int or float.")
|
129
|
-
num_rows = self.
|
130
|
-
if row:
|
131
|
-
|
132
|
-
if num_rows.ok_value.num_response < row:
|
133
|
-
raise ValueError("Not enough rows to edit!")
|
129
|
+
num_rows = self.get_row_count_safely()
|
130
|
+
if row and num_rows < row:
|
131
|
+
raise ValueError("Not enough rows to edit!")
|
134
132
|
|
135
133
|
self.sleepy_send(
|
136
134
|
TableOperation.EDIT_ROW_VAL.value.format(
|
@@ -147,11 +145,9 @@ class ABCTableController(abc.ABC):
|
|
147
145
|
):
|
148
146
|
if not isinstance(val, str):
|
149
147
|
raise ValueError(f"{val} must be a str.")
|
150
|
-
num_rows = self.
|
151
|
-
if row:
|
152
|
-
|
153
|
-
if num_rows.ok_value.num_response < row:
|
154
|
-
raise ValueError("Not enough rows to edit!")
|
148
|
+
num_rows = self.get_row_count_safely()
|
149
|
+
if row and num_rows < row:
|
150
|
+
raise ValueError("Not enough rows to edit!")
|
155
151
|
|
156
152
|
self.sleepy_send(
|
157
153
|
TableOperation.EDIT_ROW_TEXT.value.format(
|
@@ -176,15 +172,27 @@ class ABCTableController(abc.ABC):
|
|
176
172
|
)
|
177
173
|
)
|
178
174
|
|
175
|
+
def get_row_count_safely(self) -> int:
|
176
|
+
row_count = self.get_num_rows()
|
177
|
+
tries = 10
|
178
|
+
i = 0
|
179
|
+
while row_count.is_err() and i < tries:
|
180
|
+
row_count = self.get_num_rows()
|
181
|
+
i += 1
|
182
|
+
if row_count.is_ok():
|
183
|
+
return int(row_count.ok_value.num_response)
|
184
|
+
else:
|
185
|
+
raise ValueError("couldn't read row count, table might not exist")
|
186
|
+
|
179
187
|
def add_row(self):
|
180
188
|
"""Adds a row to the provided table for currently loaded method or sequence."""
|
181
|
-
previous_row_count = self.
|
189
|
+
previous_row_count = self.get_row_count_safely()
|
182
190
|
self.sleepy_send(
|
183
191
|
TableOperation.NEW_ROW.value.format(
|
184
192
|
register=self.table_locator.register, table_name=self.table_locator.name
|
185
193
|
)
|
186
194
|
)
|
187
|
-
new_row_count = self.
|
195
|
+
new_row_count = self.get_row_count_safely()
|
188
196
|
if previous_row_count + 1 != new_row_count:
|
189
197
|
raise ValueError("Row could not be added.")
|
190
198
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pychemstation
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.11
|
4
4
|
Summary: Library to interact with Chemstation software, primarily used in Hein lab
|
5
5
|
Project-URL: Documentation, https://pychemstation-e5a086.gitlab.io/pychemstation.html
|
6
6
|
Project-URL: Repository, https://gitlab.com/heingroup/device-api/pychemstation
|
@@ -10,10 +10,10 @@ pychemstation/control/controllers/README.md,sha256=S5cd4NJmPjs6TUH98BtPJJhiS1Lu-
|
|
10
10
|
pychemstation/control/controllers/__init__.py,sha256=q2TUEie3J-OLlxcGLkG7vIy8fazCEhHm61OGzJPbhD0,179
|
11
11
|
pychemstation/control/controllers/comm.py,sha256=ySjgMBIfJ11sygXiZSPp9Rf6ABM4t6JhZRONRj1u2Cc,6652
|
12
12
|
pychemstation/control/controllers/data_aq/__init__.py,sha256=w-Zgbit10niOQfz780ZmRHjUFxV1hMkdui7fOMPqeLA,132
|
13
|
-
pychemstation/control/controllers/data_aq/method.py,sha256=
|
14
|
-
pychemstation/control/controllers/data_aq/sequence.py,sha256
|
13
|
+
pychemstation/control/controllers/data_aq/method.py,sha256=3aKgmTPsbiCl0TVQDCzfT4aqfCH1dx92IdizqsGqHkw,22088
|
14
|
+
pychemstation/control/controllers/data_aq/sequence.py,sha256=--ivgmj2LX9TFIf0qZQTbnMgkYskAw_09xctdUUfzRE,18563
|
15
15
|
pychemstation/control/controllers/devices/__init__.py,sha256=QpgGnLXyWiB96KIB98wMccEi8oOUUaLxvBCyevJzcOg,75
|
16
|
-
pychemstation/control/controllers/devices/injector.py,sha256=
|
16
|
+
pychemstation/control/controllers/devices/injector.py,sha256=p2hUT_Rw0S88d9D8ePnk99MpzUJiEbqbnyz5J0m7l9Q,3681
|
17
17
|
pychemstation/generated/__init__.py,sha256=xnEs0QTjeuGYO3tVUIy8GDo95GqTV1peEjosGckpOu0,977
|
18
18
|
pychemstation/generated/dad_method.py,sha256=xTUiSCvkXcxBUhjVm1YZKu-tHs16k23pF-0xYrQSwWA,8408
|
19
19
|
pychemstation/generated/pump_method.py,sha256=s3MckKDw2-nZUC5lHrJVvXYdneWP8-9UvblNuGryPHY,12092
|
@@ -32,11 +32,11 @@ pychemstation/utils/abc_tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
32
32
|
pychemstation/utils/abc_tables/abc_comm.py,sha256=7ywcufQZ7UWfNQdEEsfHqkA2CpRkt6ZlKYuLt9MXjvs,5656
|
33
33
|
pychemstation/utils/abc_tables/device.py,sha256=v8MNFvymbKe4hWsqzO6Z_qsVvju_rISYtnPgaftecyE,919
|
34
34
|
pychemstation/utils/abc_tables/run.py,sha256=uURDl66Mga8NAMffOUsG6prKhjpLo1-p2Y2PUTY1hY0,10052
|
35
|
-
pychemstation/utils/abc_tables/table.py,sha256=
|
35
|
+
pychemstation/utils/abc_tables/table.py,sha256=Ssr0pp2oEfeN2lHDZCJsiiTTS4O3DR_D5yaxqmcAhdI,8229
|
36
36
|
pychemstation/utils/mocking/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
pychemstation/utils/mocking/mock_comm.py,sha256=vZeYBXaKBZOlJmhn4TSbkov62gqlkfztqf3MSFU9kLE,800
|
38
38
|
pychemstation/utils/mocking/mock_hplc.py,sha256=esVIlU4oqEsYLPOQs0AeVnKv9l52xBGT6UY862l9RQE,1163
|
39
|
-
pychemstation-0.10.
|
40
|
-
pychemstation-0.10.
|
41
|
-
pychemstation-0.10.
|
42
|
-
pychemstation-0.10.
|
39
|
+
pychemstation-0.10.11.dist-info/METADATA,sha256=wVB3sCmpwgR-WpWZKS7A_T5DLs6zTu5o0brEafeHnbU,5849
|
40
|
+
pychemstation-0.10.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
41
|
+
pychemstation-0.10.11.dist-info/licenses/LICENSE,sha256=9bdF75gIf1MecZ7oymqWgJREVz7McXPG-mjqrTmzzD8,18658
|
42
|
+
pychemstation-0.10.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|