pychemstation 0.7.0.dev2__py3-none-any.whl → 0.8.1__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/analysis/base_spectrum.py +3 -6
- pychemstation/analysis/process_report.py +248 -225
- pychemstation/analysis/utils.py +3 -1
- pychemstation/control/README.md +124 -0
- pychemstation/control/controllers/README.md +1 -0
- pychemstation/control/controllers/__init__.py +0 -2
- pychemstation/control/controllers/comm.py +27 -20
- pychemstation/control/controllers/devices/device.py +17 -4
- pychemstation/control/controllers/tables/method.py +57 -39
- pychemstation/control/controllers/tables/sequence.py +98 -28
- pychemstation/control/controllers/tables/table.py +124 -127
- pychemstation/control/hplc.py +82 -37
- pychemstation/generated/dad_method.py +3 -3
- pychemstation/generated/pump_method.py +7 -7
- pychemstation/out.txt +145 -0
- pychemstation/tests.ipynb +310 -0
- pychemstation/utils/chromatogram.py +5 -1
- pychemstation/utils/injector_types.py +2 -2
- pychemstation/utils/macro.py +1 -1
- pychemstation/utils/table_types.py +3 -0
- pychemstation/utils/tray_types.py +59 -39
- {pychemstation-0.7.0.dev2.dist-info → pychemstation-0.8.1.dist-info}/METADATA +25 -21
- pychemstation-0.8.1.dist-info/RECORD +39 -0
- {pychemstation-0.7.0.dev2.dist-info → pychemstation-0.8.1.dist-info}/WHEEL +1 -2
- pychemstation/control/comm.py +0 -206
- pychemstation/control/controllers/devices/column.py +0 -12
- pychemstation/control/controllers/devices/dad.py +0 -0
- pychemstation/control/controllers/devices/pump.py +0 -43
- pychemstation/control/controllers/method.py +0 -338
- pychemstation/control/controllers/sequence.py +0 -190
- pychemstation/control/controllers/table_controller.py +0 -266
- pychemstation/control/table/__init__.py +0 -3
- pychemstation/control/table/method.py +0 -274
- pychemstation/control/table/sequence.py +0 -210
- pychemstation/control/table/table_controller.py +0 -201
- pychemstation-0.7.0.dev2.dist-info/RECORD +0 -58
- pychemstation-0.7.0.dev2.dist-info/top_level.txt +0 -2
- tests/__init__.py +0 -0
- tests/constants.py +0 -88
- tests/test_comb.py +0 -136
- tests/test_comm.py +0 -65
- tests/test_inj.py +0 -39
- tests/test_method.py +0 -99
- tests/test_nightly.py +0 -80
- tests/test_proc_rep.py +0 -52
- tests/test_runs_stable.py +0 -125
- tests/test_sequence.py +0 -125
- tests/test_stable.py +0 -276
- {pychemstation-0.7.0.dev2.dist-info → pychemstation-0.8.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,210 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from copy import deepcopy
|
4
|
-
|
5
|
-
import os
|
6
|
-
import time
|
7
|
-
|
8
|
-
from .table_controller import TableController
|
9
|
-
from ...control import CommunicationController
|
10
|
-
from ...utils.chromatogram import SEQUENCE_TIME_FORMAT, AgilentHPLCChromatogram
|
11
|
-
from ...utils.macro import Command
|
12
|
-
from ...utils.sequence_types import SequenceTable, SequenceEntry, SequenceDataFiles, InjectionSource, SampleType
|
13
|
-
from ...utils.table_types import TableOperation, RegisterFlag, Table
|
14
|
-
from ...utils.tray_types import TenColumn
|
15
|
-
|
16
|
-
|
17
|
-
class SequenceController(TableController):
|
18
|
-
"""
|
19
|
-
Class containing sequence related logic
|
20
|
-
"""
|
21
|
-
|
22
|
-
def __init__(self, controller: CommunicationController, src: str, data_dir: str, table: Table, method_dir: str):
|
23
|
-
self.method_dir = method_dir
|
24
|
-
super().__init__(controller, src, data_dir, table)
|
25
|
-
|
26
|
-
def load(self) -> SequenceTable:
|
27
|
-
rows = self.get_num_rows()
|
28
|
-
self.send(Command.GET_SEQUENCE_CMD)
|
29
|
-
seq_name = self.receive()
|
30
|
-
|
31
|
-
if rows.is_ok() and seq_name.is_ok():
|
32
|
-
return SequenceTable(
|
33
|
-
name=seq_name.ok_value.string_response.partition(".S")[0],
|
34
|
-
rows=[self.get_row(r + 1) for r in range(int(rows.ok_value.num_response))])
|
35
|
-
raise RuntimeError(rows.err_value)
|
36
|
-
|
37
|
-
def get_row(self, row: int) -> SequenceEntry:
|
38
|
-
sample_name = self.get_text(row, RegisterFlag.NAME)
|
39
|
-
vial_location = int(self.get_num(row, RegisterFlag.VIAL_LOCATION))
|
40
|
-
method = self.get_text(row, RegisterFlag.METHOD)
|
41
|
-
num_inj = int(self.get_num(row, RegisterFlag.NUM_INJ))
|
42
|
-
inj_vol = int(self.get_text(row, RegisterFlag.INJ_VOL))
|
43
|
-
inj_source = InjectionSource(self.get_text(row, RegisterFlag.INJ_SOR))
|
44
|
-
sample_type = SampleType(self.get_num(row, RegisterFlag.SAMPLE_TYPE))
|
45
|
-
return SequenceEntry(sample_name=sample_name,
|
46
|
-
vial_location=vial_location,
|
47
|
-
method=None if len(method) == 0 else method,
|
48
|
-
num_inj=num_inj,
|
49
|
-
inj_vol=inj_vol,
|
50
|
-
inj_source=inj_source,
|
51
|
-
sample_type=sample_type, )
|
52
|
-
|
53
|
-
def switch(self, seq_name: str):
|
54
|
-
"""
|
55
|
-
Switch to the specified sequence. The sequence name does not need the '.S' extension.
|
56
|
-
|
57
|
-
:param seq_name: The name of the sequence file
|
58
|
-
"""
|
59
|
-
self.send(f'_SeqFile$ = "{seq_name}.S"')
|
60
|
-
self.send(f'_SeqPath$ = "{self.src}"')
|
61
|
-
self.send(Command.SWITCH_SEQUENCE_CMD)
|
62
|
-
time.sleep(2)
|
63
|
-
self.send(Command.GET_SEQUENCE_CMD)
|
64
|
-
time.sleep(2)
|
65
|
-
parsed_response = self.receive().value.string_response
|
66
|
-
|
67
|
-
assert parsed_response == f"{seq_name}.S", "Switching sequence failed."
|
68
|
-
|
69
|
-
def edit(self, sequence_table: SequenceTable):
|
70
|
-
"""
|
71
|
-
Updates the currently loaded sequence table with the provided table. This method will delete the existing sequence table and remake it.
|
72
|
-
If you would only like to edit a single row of a sequence table, use `edit_sequence_table_row` instead.
|
73
|
-
|
74
|
-
:param sequence_table:
|
75
|
-
"""
|
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))
|
86
|
-
self.send(Command.SAVE_SEQUENCE_CMD)
|
87
|
-
existing_row_num = self.get_num_rows().ok_value.num_response
|
88
|
-
self.send(Command.SWITCH_SEQUENCE_CMD)
|
89
|
-
|
90
|
-
for i, row in enumerate(sequence_table.rows):
|
91
|
-
self.edit_row(row=row, row_num=i + 1)
|
92
|
-
self.sleep(1)
|
93
|
-
self.send(Command.SAVE_SEQUENCE_CMD)
|
94
|
-
self.send(Command.SWITCH_SEQUENCE_CMD)
|
95
|
-
|
96
|
-
def edit_row(self, row: SequenceEntry, row_num: int):
|
97
|
-
"""
|
98
|
-
Edits a row in the sequence table. If a row does NOT exist, a new one will be created.
|
99
|
-
|
100
|
-
:param row: sequence row entry with updated information
|
101
|
-
:param row_num: the row to edit, based on 1-based indexing
|
102
|
-
"""
|
103
|
-
num_rows = self.get_num_rows()
|
104
|
-
if num_rows.is_ok():
|
105
|
-
while num_rows.ok_value.num_response < row_num:
|
106
|
-
self.add_row()
|
107
|
-
self.send(Command.SAVE_SEQUENCE_CMD)
|
108
|
-
num_rows = self.get_num_rows()
|
109
|
-
|
110
|
-
table_register = self.table.register
|
111
|
-
table_name = self.table.name
|
112
|
-
|
113
|
-
if row.vial_location:
|
114
|
-
loc = row.vial_location
|
115
|
-
if isinstance(row.vial_location, InjectionSource):
|
116
|
-
loc = row.vial_location.value
|
117
|
-
self.sleepy_send(TableOperation.EDIT_ROW_VAL.value.format(register=table_register,
|
118
|
-
table_name=table_name,
|
119
|
-
row=row_num,
|
120
|
-
col_name=RegisterFlag.VIAL_LOCATION,
|
121
|
-
val=loc))
|
122
|
-
if row.method:
|
123
|
-
possible_path = os.path.join(self.method_dir, row.method) + ".M\\"
|
124
|
-
method = row.method
|
125
|
-
if os.path.exists(possible_path):
|
126
|
-
method = os.path.join(self.method_dir, row.method)
|
127
|
-
self.sleepy_send(TableOperation.EDIT_ROW_TEXT.value.format(register=table_register,
|
128
|
-
table_name=table_name,
|
129
|
-
row=row_num,
|
130
|
-
col_name=RegisterFlag.METHOD,
|
131
|
-
val=method))
|
132
|
-
|
133
|
-
if row.num_inj:
|
134
|
-
self.sleepy_send(TableOperation.EDIT_ROW_VAL.value.format(register=table_register,
|
135
|
-
table_name=table_name,
|
136
|
-
row=row_num,
|
137
|
-
col_name=RegisterFlag.NUM_INJ,
|
138
|
-
val=row.num_inj))
|
139
|
-
|
140
|
-
if row.inj_vol:
|
141
|
-
self.sleepy_send(TableOperation.EDIT_ROW_TEXT.value.format(register=table_register,
|
142
|
-
table_name=table_name,
|
143
|
-
row=row_num,
|
144
|
-
col_name=RegisterFlag.INJ_VOL,
|
145
|
-
val=row.inj_vol))
|
146
|
-
|
147
|
-
if row.inj_source:
|
148
|
-
self.sleepy_send(TableOperation.EDIT_ROW_TEXT.value.format(register=table_register,
|
149
|
-
table_name=table_name,
|
150
|
-
row=row_num,
|
151
|
-
col_name=RegisterFlag.INJ_SOR,
|
152
|
-
val=row.inj_source.value))
|
153
|
-
|
154
|
-
if row.sample_name:
|
155
|
-
self.sleepy_send(TableOperation.EDIT_ROW_TEXT.value.format(register=table_register,
|
156
|
-
table_name=table_name,
|
157
|
-
row=row_num,
|
158
|
-
col_name=RegisterFlag.NAME,
|
159
|
-
val=row.sample_name))
|
160
|
-
self.sleepy_send(TableOperation.EDIT_ROW_TEXT.value.format(register=table_register,
|
161
|
-
table_name=table_name,
|
162
|
-
row=row_num,
|
163
|
-
col_name=RegisterFlag.DATA_FILE,
|
164
|
-
val=row.sample_name))
|
165
|
-
if row.sample_type:
|
166
|
-
self.sleepy_send(TableOperation.EDIT_ROW_VAL.value.format(register=table_register,
|
167
|
-
table_name=table_name,
|
168
|
-
row=row_num,
|
169
|
-
col_name=RegisterFlag.SAMPLE_TYPE,
|
170
|
-
val=row.sample_type.value))
|
171
|
-
|
172
|
-
self.send(Command.SAVE_SEQUENCE_CMD)
|
173
|
-
|
174
|
-
def run(self):
|
175
|
-
"""
|
176
|
-
Starts the currently loaded sequence, storing data
|
177
|
-
under the <data_dir>/<sequence table name> folder.
|
178
|
-
Device must be ready.
|
179
|
-
"""
|
180
|
-
timestamp = time.strftime(SEQUENCE_TIME_FORMAT)
|
181
|
-
seq_table = self.load()
|
182
|
-
self.send(Command.RUN_SEQUENCE_CMD.value)
|
183
|
-
|
184
|
-
if self.check_hplc_is_running():
|
185
|
-
folder_name = f"{seq_table.name} {timestamp}"
|
186
|
-
self.data_files.append(SequenceDataFiles(dir=folder_name,
|
187
|
-
sequence_name=seq_table.name))
|
188
|
-
|
189
|
-
run_completed = self.check_hplc_done_running(sequence=seq_table)
|
190
|
-
|
191
|
-
if run_completed.is_ok():
|
192
|
-
self.data_files[-1].dir = run_completed.value
|
193
|
-
else:
|
194
|
-
raise RuntimeError("Run error has occured.")
|
195
|
-
|
196
|
-
def retrieve_recent_data_files(self):
|
197
|
-
sequence_data_files: SequenceDataFiles = self.data_files[-1]
|
198
|
-
return sequence_data_files.dir
|
199
|
-
|
200
|
-
def get_data(self) -> list[dict[str, AgilentHPLCChromatogram]]:
|
201
|
-
parent_dir = self.data_files[-1].dir
|
202
|
-
subdirs = [x[0] for x in os.walk(self.data_dir)]
|
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
|
-
|
206
|
-
spectra: list[dict[str, AgilentHPLCChromatogram]] = []
|
207
|
-
for row in self.data_files[-1].child_dirs:
|
208
|
-
self.get_spectrum(row)
|
209
|
-
spectra.append(deepcopy(self.spectra))
|
210
|
-
return spectra
|
@@ -1,201 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Abstract module containing shared logic for Method and Sequence tables.
|
3
|
-
|
4
|
-
Authors: Lucy Hao
|
5
|
-
"""
|
6
|
-
|
7
|
-
import abc
|
8
|
-
import os
|
9
|
-
import time
|
10
|
-
from typing import Union, Optional
|
11
|
-
|
12
|
-
import polling
|
13
|
-
from result import Result, Ok, Err
|
14
|
-
|
15
|
-
from ...control.controllers.comm import CommunicationController
|
16
|
-
from ...utils.chromatogram import AgilentHPLCChromatogram, AgilentChannelChromatogramData
|
17
|
-
from ...utils.macro import Command, HPLCRunningStatus, Response
|
18
|
-
from ...utils.method_types import MethodTimetable
|
19
|
-
from ...utils.sequence_types import SequenceDataFiles, SequenceTable
|
20
|
-
from ...utils.table_types import Table, TableOperation, RegisterFlag
|
21
|
-
|
22
|
-
|
23
|
-
class TableController(abc.ABC):
|
24
|
-
|
25
|
-
def __init__(self, controller: CommunicationController, src: str, data_dir: str, table: Table):
|
26
|
-
self.controller = controller
|
27
|
-
self.table = table
|
28
|
-
|
29
|
-
if os.path.isdir(src):
|
30
|
-
self.src: str = src
|
31
|
-
else:
|
32
|
-
raise FileNotFoundError(f"dir: {src} not found.")
|
33
|
-
|
34
|
-
if os.path.isdir(data_dir):
|
35
|
-
self.data_dir: str = data_dir
|
36
|
-
else:
|
37
|
-
raise FileNotFoundError(f"dir: {data_dir} not found.")
|
38
|
-
|
39
|
-
self.spectra: dict[str, AgilentHPLCChromatogram] = {
|
40
|
-
"A": AgilentHPLCChromatogram(self.data_dir),
|
41
|
-
"B": AgilentHPLCChromatogram(self.data_dir),
|
42
|
-
"C": AgilentHPLCChromatogram(self.data_dir),
|
43
|
-
"D": AgilentHPLCChromatogram(self.data_dir),
|
44
|
-
}
|
45
|
-
|
46
|
-
self.data_files: Union[list[SequenceDataFiles], list[str]] = []
|
47
|
-
|
48
|
-
def receive(self) -> Result[Response, str]:
|
49
|
-
for _ in range(10):
|
50
|
-
try:
|
51
|
-
return self.controller.receive()
|
52
|
-
except IndexError:
|
53
|
-
continue
|
54
|
-
return Err("Could not parse response")
|
55
|
-
|
56
|
-
def send(self, cmd: Union[Command, str]):
|
57
|
-
self.controller.send(cmd)
|
58
|
-
|
59
|
-
def sleepy_send(self, cmd: Union[Command, str]):
|
60
|
-
self.controller.sleepy_send(cmd)
|
61
|
-
|
62
|
-
def sleep(self, seconds: int):
|
63
|
-
"""
|
64
|
-
Tells the HPLC to wait for a specified number of seconds.
|
65
|
-
|
66
|
-
:param seconds: number of seconds to wait
|
67
|
-
"""
|
68
|
-
self.send(Command.SLEEP_CMD.value.format(seconds=seconds))
|
69
|
-
|
70
|
-
def get_num(self, row: int, col_name: RegisterFlag) -> float:
|
71
|
-
return self.controller.get_num_val(TableOperation.GET_ROW_VAL.value.format(register=self.table.register,
|
72
|
-
table_name=self.table.name,
|
73
|
-
row=row,
|
74
|
-
col_name=col_name.value))
|
75
|
-
|
76
|
-
def get_text(self, row: int, col_name: RegisterFlag) -> str:
|
77
|
-
return self.controller.get_text_val(TableOperation.GET_ROW_TEXT.value.format(register=self.table.register,
|
78
|
-
table_name=self.table.name,
|
79
|
-
row=row,
|
80
|
-
col_name=col_name.value))
|
81
|
-
|
82
|
-
@abc.abstractmethod
|
83
|
-
def get_row(self, row: int):
|
84
|
-
pass
|
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
|
-
|
91
|
-
def add_row(self):
|
92
|
-
"""
|
93
|
-
Adds a row to the provided table for currently loaded method or sequence.
|
94
|
-
Import either the SEQUENCE_TABLE or METHOD_TIMETABLE from hein_analytical_control.constants.
|
95
|
-
You can also provide your own table.
|
96
|
-
|
97
|
-
:param table: the table to add a new row to
|
98
|
-
"""
|
99
|
-
self.sleepy_send(TableOperation.NEW_ROW.value.format(register=self.table.register,
|
100
|
-
table_name=self.table.name))
|
101
|
-
|
102
|
-
def delete_table(self):
|
103
|
-
"""
|
104
|
-
Deletes the table for the current loaded method or sequence.
|
105
|
-
Import either the SEQUENCE_TABLE or METHOD_TIMETABLE from hein_analytical_control.constants.
|
106
|
-
You can also provide your own table.
|
107
|
-
|
108
|
-
:param table: the table to delete
|
109
|
-
"""
|
110
|
-
self.sleepy_send(TableOperation.DELETE_TABLE.value.format(register=self.table.register,
|
111
|
-
table_name=self.table.name))
|
112
|
-
|
113
|
-
def new_table(self):
|
114
|
-
"""
|
115
|
-
Creates the table for the currently loaded method or sequence. Import either the SEQUENCE_TABLE or
|
116
|
-
METHOD_TIMETABLE from hein_analytical_control.constants. You can also provide your own table.
|
117
|
-
|
118
|
-
:param table: the table to create
|
119
|
-
"""
|
120
|
-
self.send(TableOperation.CREATE_TABLE.value.format(register=self.table.register,
|
121
|
-
table_name=self.table.name))
|
122
|
-
|
123
|
-
def get_num_rows(self) -> Result[int, str]:
|
124
|
-
self.send(TableOperation.GET_NUM_ROWS.value.format(register=self.table.register,
|
125
|
-
table_name=self.table.name,
|
126
|
-
col_name=RegisterFlag.NUM_ROWS))
|
127
|
-
self.send(Command.GET_ROWS_CMD.value.format(register=self.table.register,
|
128
|
-
table_name=self.table.name,
|
129
|
-
col_name=RegisterFlag.NUM_ROWS))
|
130
|
-
res = self.controller.receive()
|
131
|
-
|
132
|
-
if res.is_ok():
|
133
|
-
self.send("Sleep 0.1")
|
134
|
-
self.send('Print Rows')
|
135
|
-
return res
|
136
|
-
else:
|
137
|
-
return Err("No rows could be read.")
|
138
|
-
|
139
|
-
def check_hplc_is_running(self) -> bool:
|
140
|
-
started_running = polling.poll(
|
141
|
-
lambda: isinstance(self.controller.get_status(), HPLCRunningStatus),
|
142
|
-
step=5,
|
143
|
-
max_tries=100)
|
144
|
-
return started_running
|
145
|
-
|
146
|
-
def check_hplc_done_running(self,
|
147
|
-
method: Optional[MethodTimetable] = None,
|
148
|
-
sequence: Optional[SequenceTable] = None) -> Result[str, str]:
|
149
|
-
"""
|
150
|
-
Checks if ChemStation has finished running and can read data back
|
151
|
-
|
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
|
153
|
-
:return: Return True if data can be read back, else False.
|
154
|
-
"""
|
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
|
-
|
161
|
-
most_recent_folder = self.retrieve_recent_data_files()
|
162
|
-
finished_run = polling.poll(
|
163
|
-
lambda: self.controller.check_if_running(),
|
164
|
-
timeout=timeout,
|
165
|
-
step=12
|
166
|
-
)
|
167
|
-
|
168
|
-
if finished_run:
|
169
|
-
if os.path.exists(most_recent_folder):
|
170
|
-
return Ok(most_recent_folder)
|
171
|
-
else:
|
172
|
-
return self.fuzzy_match_most_recent_folder(most_recent_folder)
|
173
|
-
else:
|
174
|
-
return Err("Run did not complete as expected")
|
175
|
-
|
176
|
-
def fuzzy_match_most_recent_folder(self, most_recent_folder) -> Result[str, str]:
|
177
|
-
subdirs = [x[0] for x in os.walk(self.data_dir)]
|
178
|
-
potential_folders = sorted(list(filter(lambda d: most_recent_folder in d, subdirs)))
|
179
|
-
parent_dirs = []
|
180
|
-
for folder in potential_folders:
|
181
|
-
path = os.path.normpath(folder)
|
182
|
-
split_folder = path.split(os.sep)
|
183
|
-
if most_recent_folder in split_folder[-1]:
|
184
|
-
parent_dirs.append(folder)
|
185
|
-
parent_dir = sorted(parent_dirs, reverse=True)[0]
|
186
|
-
return Ok(parent_dir)
|
187
|
-
|
188
|
-
@abc.abstractmethod
|
189
|
-
def retrieve_recent_data_files(self):
|
190
|
-
pass
|
191
|
-
|
192
|
-
@abc.abstractmethod
|
193
|
-
def get_data(self) -> Union[list[AgilentChannelChromatogramData], AgilentChannelChromatogramData]:
|
194
|
-
pass
|
195
|
-
|
196
|
-
def get_spectrum(self, data_file: str):
|
197
|
-
"""
|
198
|
-
Load chromatogram for any channel in spectra dictionary.
|
199
|
-
"""
|
200
|
-
for channel, spec in self.spectra.items():
|
201
|
-
spec.load_spectrum(data_path=data_file, channel=channel)
|
@@ -1,58 +0,0 @@
|
|
1
|
-
pychemstation/__init__.py,sha256=SpTl-Tg1B1HTyjNOE-8ue-N2wGnXN_2zl7RFUSxlkiM,33
|
2
|
-
pychemstation/analysis/__init__.py,sha256=EWoU47iyn9xGS-b44zK9eq50bSjOV4AC5dvt420YMI4,44
|
3
|
-
pychemstation/analysis/base_spectrum.py,sha256=XPf9eJ72uz0CnxCY5uFOyu1MbVX-OTTXeN1tLzIMok4,16536
|
4
|
-
pychemstation/analysis/process_report.py,sha256=3NWBK1g9fwjmdHoIlMxlXBlbyU5oXyK-_roEE7ZcPXM,10412
|
5
|
-
pychemstation/analysis/spec_utils.py,sha256=UOo9hJR3evJfmaohEEsyb7aq6X996ofuUfu-GKjiDi8,10201
|
6
|
-
pychemstation/analysis/utils.py,sha256=ISupAOb_yqA4_DZRK9v18UL-XjUQccAicIJKb1VMnGg,2055
|
7
|
-
pychemstation/control/__init__.py,sha256=4xTy8X-mkn_PPZKr7w9rnj1wZhtmTesbQptPhpYmKXs,64
|
8
|
-
pychemstation/control/comm.py,sha256=u44g1hTluQ0yUG93Un-QAshScoDpgYRrZfFTgweP5tY,7386
|
9
|
-
pychemstation/control/hplc.py,sha256=XhZgJEU-dHHYu2GUFGlxystlLpZ6rxRzpmBVhJ3hixc,10256
|
10
|
-
pychemstation/control/controllers/__init__.py,sha256=EM6LBNSTJqYVatmnvPq0P-S3q0POA88c-y64zL79I_I,252
|
11
|
-
pychemstation/control/controllers/comm.py,sha256=IU4I_Q42VNCNUlVi93MxCmw2EBY9hiBDkU9FxubKg3c,7441
|
12
|
-
pychemstation/control/controllers/method.py,sha256=XUclB7lQ_SIkquR58MBmmi9drHIPEq9AR8VprTLenvI,15503
|
13
|
-
pychemstation/control/controllers/sequence.py,sha256=kYNxxck2I-q9mZDEZwG8bJ_99FfLmunS13EAHOS65wU,8288
|
14
|
-
pychemstation/control/controllers/table_controller.py,sha256=70ovnIjLKkJborS1ztk445Mv42TtUM9jUniaQmZuyWQ,11031
|
15
|
-
pychemstation/control/controllers/devices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
pychemstation/control/controllers/devices/column.py,sha256=SCpCnVFZFUM9LM51MbWkVcBRayN3WFxy7lz9gs2PYeY,348
|
17
|
-
pychemstation/control/controllers/devices/dad.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
pychemstation/control/controllers/devices/device.py,sha256=QUFpUwmGxMzmG1CiRhNauV5cVZEJyRXyQDNQuW8Qfxk,762
|
19
|
-
pychemstation/control/controllers/devices/injector.py,sha256=ynPQtvMFt1iK0LQBf4ZEYdxJCyavmashXwyCQbmRjuw,5542
|
20
|
-
pychemstation/control/controllers/devices/pump.py,sha256=DJQh4lNXEraeC1CWrsKmsITOjuYlRI3tih_XRB3F1hg,1404
|
21
|
-
pychemstation/control/controllers/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
pychemstation/control/controllers/tables/method.py,sha256=CVyln3TI-lWuaYiSINDJWGdvXSVa7o-yVEyy4TNNhG8,16492
|
23
|
-
pychemstation/control/controllers/tables/ms.py,sha256=JFD-tOhu8uRyKdl-E3-neRssii8MNqVRIlsrnFhNY_M,682
|
24
|
-
pychemstation/control/controllers/tables/sequence.py,sha256=svDHwIWsElXveJ-I4odtf_hP5MLmv_7TKJrCdoki4Yk,9236
|
25
|
-
pychemstation/control/controllers/tables/table.py,sha256=tVcvb2119t2NOGxOJvSqy432yR1rAvfj-Vr1CTnG1DY,12205
|
26
|
-
pychemstation/control/table/__init__.py,sha256=RgMN4uIWHdNUHpGRBWdzmzAbk7XEKl6Y-qtqWCxzSZU,124
|
27
|
-
pychemstation/control/table/method.py,sha256=THVoGomSXff_CTU3eAYme0BYwkPzab5UgZKsiZ29QSk,12196
|
28
|
-
pychemstation/control/table/sequence.py,sha256=Eri52AnbE3BGthfrRSvYKYciquUzvHKo0lYUTySYYE8,10542
|
29
|
-
pychemstation/control/table/table_controller.py,sha256=HVNYUXqtyFTAvb67fa3RO5RHgmBTFMsYRHKpiXdYcfs,8313
|
30
|
-
pychemstation/generated/__init__.py,sha256=GAoZFAYbPVEJDkcOw3e1rgOqd7TCW0HyKNPM8OMehMg,1005
|
31
|
-
pychemstation/generated/dad_method.py,sha256=0W8Z5WDtF5jpIcudMqb7XrkTnR2EGg_QOCsHRFQ0rmM,8402
|
32
|
-
pychemstation/generated/pump_method.py,sha256=sUhE2Oo00nzVcoONtq3EMWsN4wLSryXbG8f3EeViWKg,12174
|
33
|
-
pychemstation/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
|
-
pychemstation/utils/chromatogram.py,sha256=-q3_hL9GTyi4C95os7IwAiOrkTM4EXIiigm-nW9pFmM,3221
|
35
|
-
pychemstation/utils/injector_types.py,sha256=SD452SwEHNx4Xs2p-mhg6X0pd99XewQ1Zbu-r9kPOJs,817
|
36
|
-
pychemstation/utils/macro.py,sha256=PZ916baFfqCkPaSqpdjm2N5mhfg4V4H8KQl7N5l3rUw,2916
|
37
|
-
pychemstation/utils/method_types.py,sha256=5FK7RThLhaQcLrzRi_qLnlPqZuGPtwwipP6eMoq0kpE,1638
|
38
|
-
pychemstation/utils/parsing.py,sha256=bnFIsZZwFy9NKzVUf517yN-ogzQbm0hp_aho3KUD6Is,9317
|
39
|
-
pychemstation/utils/pump_types.py,sha256=HWQHxscGn19NTrfYBwQRCO2VcYfwyko7YfBO5uDhEm4,93
|
40
|
-
pychemstation/utils/sequence_types.py,sha256=x2EClcq6ROdzeLZg63XcXXTknwl2aZ48Vuyru0xZjgA,1086
|
41
|
-
pychemstation/utils/table_types.py,sha256=0kg7gZXFk7O5l0K1BEBaF4OFFdja3-hFUG9UbN5PBcs,3173
|
42
|
-
pychemstation/utils/tray_types.py,sha256=3W0IE20SEqnRRa6pZ4Jv94Cn4-3-LGoP-hxUz5LCztc,4403
|
43
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
|
-
tests/constants.py,sha256=3E0GUPV-ozPVZ6Qrfq3aTDqCgVWt1fUk8_u4cfyuUvg,3560
|
45
|
-
tests/test_comb.py,sha256=TS-CbtiPbntL4u6E1gSZ6xquNp6cQxIFdJqUr2ak7PA,5515
|
46
|
-
tests/test_comm.py,sha256=iwl-Ey-xoytXmlNrjG84pDm82Ry_QUX6wY4gmVh4NDc,2516
|
47
|
-
tests/test_inj.py,sha256=UakPA1Sd1GAbFvFepEredWcWPoW7PMLKotfqVZ1i4hE,1434
|
48
|
-
tests/test_method.py,sha256=KB7yAtVb4gZftnYzh-VfPb9LGVZOHUIW6OljEYRtbhA,4570
|
49
|
-
tests/test_nightly.py,sha256=WpLZfs-n9oPrwz-64gWJB5oxJGYz_ab4sLZ4E-xFBpY,2654
|
50
|
-
tests/test_proc_rep.py,sha256=sxRiTBybVm6lyAqmgrri-T2EfZgs27oSgbYXSsN9CwU,1380
|
51
|
-
tests/test_runs_stable.py,sha256=sT9gNt7Rscz73BybpRGYj8RSGPBR58wrzvIAFFK-_pM,5530
|
52
|
-
tests/test_sequence.py,sha256=vs5-dqkItRds_tPM2-N6MNJ37FB0nLRFaDzBV8d42i8,4880
|
53
|
-
tests/test_stable.py,sha256=UFb9rUBnOk7JabcweNIYZLWpBHWGbqKAtsTNfxDhEFg,12208
|
54
|
-
pychemstation-0.7.0.dev2.dist-info/LICENSE,sha256=9bdF75gIf1MecZ7oymqWgJREVz7McXPG-mjqrTmzzD8,18658
|
55
|
-
pychemstation-0.7.0.dev2.dist-info/METADATA,sha256=A6ZUpxSn1kImFamlVNU1jnXB_oDHrqeSIj9gy6rRu3I,4409
|
56
|
-
pychemstation-0.7.0.dev2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
57
|
-
pychemstation-0.7.0.dev2.dist-info/top_level.txt,sha256=zXfKu_4nYWwPHo3OsuhshMNC3SPkcoTGCyODjURaghY,20
|
58
|
-
pychemstation-0.7.0.dev2.dist-info/RECORD,,
|
tests/__init__.py
DELETED
File without changes
|
tests/constants.py
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import random
|
3
|
-
|
4
|
-
from pychemstation.control import HPLCController
|
5
|
-
from pychemstation.utils.macro import Command
|
6
|
-
from pychemstation.utils.method_types import *
|
7
|
-
from pychemstation.utils.sequence_types import *
|
8
|
-
|
9
|
-
DEFAULT_METHOD = "GENERAL-POROSHELL-OPT"
|
10
|
-
DEFAULT_SEQUENCE = "hplc_testing"
|
11
|
-
|
12
|
-
# CONSTANTS: paths only work in Hein group HPLC machine in room 242
|
13
|
-
DEFAULT_COMMAND_PATH = "C:\\Users\\User\\Desktop\\Lucy\\hplc-method-optimization\\tests\\"
|
14
|
-
DEFAULT_METHOD_DIR = "C:\\ChemStation\\1\\Methods\\"
|
15
|
-
DATA_DIR = "C:\\Users\\Public\\Documents\\ChemStation\\2\\Data\\LC-BO\\"
|
16
|
-
SEQUENCE_DIR = "C:\\USERS\\PUBLIC\\DOCUMENTS\\CHEMSTATION\\3\\Sequence"
|
17
|
-
SEQUENCE_DATA_DIR = "C:\\Users\\Public\\Documents\\ChemStation\\3\\Data\\"
|
18
|
-
|
19
|
-
HEIN_LAB_CONSTANTS = [DEFAULT_COMMAND_PATH,
|
20
|
-
DEFAULT_METHOD_DIR,
|
21
|
-
DATA_DIR,
|
22
|
-
SEQUENCE_DIR,
|
23
|
-
SEQUENCE_DATA_DIR]
|
24
|
-
|
25
|
-
# these CONSTANTS work in rm 254
|
26
|
-
DEFAULT_COMMAND_PATH_254 = "D:\\\git_repositories\\\hplc_comm\\"
|
27
|
-
DEFAULT_METHOD_DIR_254 = "D:\\Chemstation\\1\\Methods\\"
|
28
|
-
DATA_DIR_254 = "D:\\Chemstation\\1\\Data\\LC BO\\"
|
29
|
-
SEQUENCE_DIR_254 = "C:\\1\\Sequence\\"
|
30
|
-
SEQUENCE_DATA_DIR_254 = "D:\\Chemstation\\1\\Data\\"
|
31
|
-
|
32
|
-
HEIN_LAB_CONSTANTS_254 = [DEFAULT_COMMAND_PATH_254,
|
33
|
-
DEFAULT_METHOD_DIR_254,
|
34
|
-
DATA_DIR_254,
|
35
|
-
SEQUENCE_DIR_254,
|
36
|
-
SEQUENCE_DATA_DIR_254]
|
37
|
-
|
38
|
-
|
39
|
-
def room(num: int):
|
40
|
-
if num == 242:
|
41
|
-
return HEIN_LAB_CONSTANTS
|
42
|
-
elif num == 254:
|
43
|
-
return HEIN_LAB_CONSTANTS_254
|
44
|
-
|
45
|
-
|
46
|
-
def gen_rand_method():
|
47
|
-
org_modifier = int(random.random() * 10)
|
48
|
-
max_run_time = int(random.random() * 10)
|
49
|
-
post_run_time = int(random.random() * 10)
|
50
|
-
flow = float(random.random() * 10) / 10
|
51
|
-
flow_1 = float(random.random() * 10) / 10
|
52
|
-
flow_2 = float(random.random() * 10) / 10
|
53
|
-
return MethodDetails(name=DEFAULT_METHOD,
|
54
|
-
timetable=[TimeTableEntry(start_time=0.10,
|
55
|
-
organic_modifer=org_modifier,
|
56
|
-
flow=flow_1),
|
57
|
-
TimeTableEntry(start_time=1,
|
58
|
-
organic_modifer=100 - int(random.random() * 10),
|
59
|
-
flow=flow_2)],
|
60
|
-
stop_time=max_run_time,
|
61
|
-
post_time=post_run_time,
|
62
|
-
params=HPLCMethodParams(organic_modifier=org_modifier, flow=flow))
|
63
|
-
|
64
|
-
|
65
|
-
seq_entry = SequenceEntry(
|
66
|
-
vial_location=TenVialColumn.ONE,
|
67
|
-
method=DEFAULT_METHOD,
|
68
|
-
num_inj=int(random.random() * 10),
|
69
|
-
inj_vol=int(random.random() * 10),
|
70
|
-
sample_name="Test",
|
71
|
-
sample_type=SampleType(int(random.random() * 3)),
|
72
|
-
)
|
73
|
-
|
74
|
-
|
75
|
-
def set_up_utils(num: int) -> HPLCController:
|
76
|
-
path_constants = room(num)
|
77
|
-
for path in path_constants:
|
78
|
-
if not os.path.exists(path):
|
79
|
-
raise FileNotFoundError(
|
80
|
-
f"{path} does not exist on your system. If you would like to run tests, please change this path.")
|
81
|
-
|
82
|
-
controller = HPLCController(comm_dir=path_constants[0],
|
83
|
-
method_dir=path_constants[1],
|
84
|
-
data_dirs=[path_constants[2], path_constants[4]],
|
85
|
-
sequence_dir=path_constants[3])
|
86
|
-
controller.send(Command.SAVE_METHOD_CMD.value.format(commit_msg="method saved by pychemstation"))
|
87
|
-
controller.send(Command.SAVE_SEQUENCE_CMD)
|
88
|
-
return controller
|