pychemstation 0.10.3__py3-none-any.whl → 0.10.5__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/__init__.py +1 -1
- pychemstation/analysis/__init__.py +1 -6
- pychemstation/analysis/base_spectrum.py +7 -7
- pychemstation/{utils → analysis}/chromatogram.py +24 -4
- pychemstation/analysis/process_report.py +189 -90
- pychemstation/control/__init__.py +5 -2
- pychemstation/control/controllers/__init__.py +2 -7
- pychemstation/control/controllers/comm.py +56 -32
- pychemstation/control/controllers/devices/device.py +59 -24
- pychemstation/control/controllers/devices/injector.py +33 -10
- pychemstation/control/controllers/tables/__init__.py +4 -0
- pychemstation/control/controllers/tables/method.py +241 -151
- pychemstation/control/controllers/tables/sequence.py +226 -107
- pychemstation/control/controllers/tables/table.py +216 -132
- pychemstation/control/hplc.py +89 -75
- pychemstation/generated/__init__.py +0 -2
- pychemstation/generated/pump_method.py +15 -19
- pychemstation/utils/injector_types.py +1 -1
- pychemstation/utils/macro.py +11 -10
- pychemstation/utils/method_types.py +2 -1
- pychemstation/utils/parsing.py +0 -11
- pychemstation/utils/sequence_types.py +2 -3
- pychemstation/utils/spec_utils.py +2 -3
- pychemstation/utils/table_types.py +10 -9
- pychemstation/utils/tray_types.py +45 -36
- {pychemstation-0.10.3.dist-info → pychemstation-0.10.5.dist-info}/METADATA +5 -4
- pychemstation-0.10.5.dist-info/RECORD +36 -0
- pychemstation/control/controllers/tables/ms.py +0 -21
- pychemstation-0.10.3.dist-info/RECORD +0 -37
- {pychemstation-0.10.3.dist-info → pychemstation-0.10.5.dist-info}/WHEEL +0 -0
- {pychemstation-0.10.3.dist-info → pychemstation-0.10.5.dist-info}/licenses/LICENSE +0 -0
pychemstation/control/hplc.py
CHANGED
@@ -3,57 +3,44 @@ Module to provide API for higher-level HPLC actions.
|
|
3
3
|
|
4
4
|
Authors: Lucy Hao
|
5
5
|
"""
|
6
|
+
|
6
7
|
from __future__ import annotations
|
7
8
|
|
8
9
|
from typing import Dict, List, Optional, Tuple, Union
|
9
10
|
|
10
|
-
from pychemstation.
|
11
|
+
from pychemstation.analysis.chromatogram import AgilentChannelChromatogramData
|
12
|
+
from pychemstation.analysis.chromatogram import (
|
11
13
|
AgilentHPLCChromatogram,
|
12
14
|
)
|
13
|
-
|
15
|
+
from .controllers.devices.injector import InjectorController
|
16
|
+
from .controllers.tables.sequence import SequenceController, MethodController
|
14
17
|
from ..analysis.process_report import AgilentReport, ReportType
|
15
|
-
from ..control.controllers import
|
16
|
-
CommunicationController,
|
17
|
-
MethodController,
|
18
|
-
SequenceController,
|
19
|
-
)
|
20
|
-
from ..utils.chromatogram import AgilentChannelChromatogramData
|
18
|
+
from ..control.controllers import CommunicationController
|
21
19
|
from ..utils.macro import Command, Response, Status
|
22
20
|
from ..utils.method_types import MethodDetails
|
23
21
|
from ..utils.sequence_types import SequenceTable
|
24
22
|
from ..utils.table_types import Table
|
25
|
-
from .controllers.devices.injector import InjectorController
|
26
23
|
|
27
24
|
|
28
25
|
class HPLCController:
|
29
26
|
# tables
|
30
|
-
METHOD_TIMETABLE = Table(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
name="SprayChamber"
|
48
|
-
)
|
49
|
-
|
50
|
-
def __init__(self,
|
51
|
-
comm_dir: str,
|
52
|
-
method_dir: str,
|
53
|
-
sequence_dir: str,
|
54
|
-
data_dirs: List[str],
|
55
|
-
offline: bool = False,
|
56
|
-
debug: bool = False,):
|
27
|
+
METHOD_TIMETABLE = Table(register="RCPMP1Method[1]", name="Timetable")
|
28
|
+
|
29
|
+
SEQUENCE_TABLE = Table(register="_sequence[1]", name="SeqTable1")
|
30
|
+
|
31
|
+
INJECTOR_TABLE = Table(register="RCWLS1Pretreatment[1]", name="InstructionTable")
|
32
|
+
|
33
|
+
MSD_TABLE = Table(register="MSACQINFO[1]", name="SprayChamber")
|
34
|
+
|
35
|
+
def __init__(
|
36
|
+
self,
|
37
|
+
comm_dir: str,
|
38
|
+
method_dir: str,
|
39
|
+
sequence_dir: str,
|
40
|
+
data_dirs: List[str],
|
41
|
+
offline: bool = False,
|
42
|
+
debug: bool = False,
|
43
|
+
):
|
57
44
|
"""Initialize HPLC controller. The `hplc_talk.mac` macro file must be loaded in the Chemstation software.
|
58
45
|
`comm_dir` must match the file path in the macro file. All file paths are normal strings, with the left slash
|
59
46
|
double escaped: "C:\\my_folder\\"
|
@@ -65,21 +52,27 @@ class HPLCController:
|
|
65
52
|
:param sequence_dir: Name of directory where sequence files are stored.
|
66
53
|
:raises FileNotFoundError: If either `data_dir`, `method_dir`, `sequence_dir`, `sequence_data_dir`or `comm_dir` is not a valid directory.
|
67
54
|
"""
|
68
|
-
self.comm = CommunicationController(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
55
|
+
self.comm: CommunicationController = CommunicationController(
|
56
|
+
comm_dir=comm_dir, debug=debug
|
57
|
+
)
|
58
|
+
self.method_controller: MethodController = MethodController(
|
59
|
+
controller=self.comm,
|
60
|
+
src=method_dir,
|
61
|
+
data_dirs=data_dirs,
|
62
|
+
table=self.METHOD_TIMETABLE,
|
63
|
+
offline=offline,
|
64
|
+
injector_controller=InjectorController(
|
65
|
+
controller=self.comm, table=self.INJECTOR_TABLE, offline=offline
|
66
|
+
),
|
67
|
+
)
|
68
|
+
self.sequence_controller: SequenceController = SequenceController(
|
69
|
+
controller=self.comm,
|
70
|
+
src=sequence_dir,
|
71
|
+
data_dirs=data_dirs,
|
72
|
+
table=self.SEQUENCE_TABLE,
|
73
|
+
method_controller=self.method_controller,
|
74
|
+
offline=offline,
|
75
|
+
)
|
83
76
|
|
84
77
|
def send(self, cmd: Union[Command, str]):
|
85
78
|
"""
|
@@ -89,10 +82,11 @@ class HPLCController:
|
|
89
82
|
"""
|
90
83
|
if not self.comm:
|
91
84
|
raise RuntimeError(
|
92
|
-
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
85
|
+
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
86
|
+
)
|
93
87
|
self.comm.send(cmd)
|
94
88
|
|
95
|
-
def receive(self) -> Response:
|
89
|
+
def receive(self) -> None | Response | str:
|
96
90
|
"""
|
97
91
|
Get the most recent response from Chemstation.
|
98
92
|
|
@@ -100,7 +94,8 @@ class HPLCController:
|
|
100
94
|
"""
|
101
95
|
if not self.comm:
|
102
96
|
raise RuntimeError(
|
103
|
-
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
97
|
+
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
98
|
+
)
|
104
99
|
return self.comm.receive().value
|
105
100
|
|
106
101
|
def status(self) -> Status:
|
@@ -111,7 +106,8 @@ class HPLCController:
|
|
111
106
|
"""
|
112
107
|
if not self.comm:
|
113
108
|
raise RuntimeError(
|
114
|
-
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
109
|
+
"Communication controller must be initialized before sending command. It is currently in offline mode."
|
110
|
+
)
|
115
111
|
return self.comm.get_status()
|
116
112
|
|
117
113
|
def switch_method(self, method_name: str):
|
@@ -135,7 +131,12 @@ class HPLCController:
|
|
135
131
|
"""
|
136
132
|
self.sequence_controller.switch(sequence_name)
|
137
133
|
|
138
|
-
def run_method(
|
134
|
+
def run_method(
|
135
|
+
self,
|
136
|
+
experiment_name: str,
|
137
|
+
add_timestamp: bool = True,
|
138
|
+
stall_while_running: bool = True,
|
139
|
+
):
|
139
140
|
"""
|
140
141
|
This is the preferred method to trigger a run.
|
141
142
|
Starts the currently selected method, storing data
|
@@ -146,9 +147,11 @@ class HPLCController:
|
|
146
147
|
:param stall_while_running: whether to return or stall while HPLC runs.
|
147
148
|
:param add_timestamp: whether to append a timestamp in '%Y-%m-%d-%H-%M' format to end of experiment name.
|
148
149
|
"""
|
149
|
-
self.method_controller.run(
|
150
|
-
|
151
|
-
|
150
|
+
self.method_controller.run(
|
151
|
+
experiment_name=experiment_name,
|
152
|
+
stall_while_running=stall_while_running,
|
153
|
+
add_timestamp=add_timestamp,
|
154
|
+
)
|
152
155
|
|
153
156
|
def stop_method(self):
|
154
157
|
"""Stops the current running method, manual intervention may be needed."""
|
@@ -197,9 +200,11 @@ class HPLCController:
|
|
197
200
|
"""
|
198
201
|
self.sequence_controller.edit(updated_sequence)
|
199
202
|
|
200
|
-
def get_last_run_method_report(
|
201
|
-
|
202
|
-
|
203
|
+
def get_last_run_method_report(
|
204
|
+
self,
|
205
|
+
custom_path: Optional[str] = None,
|
206
|
+
report_type: ReportType = ReportType.CSV,
|
207
|
+
) -> AgilentReport:
|
203
208
|
"""
|
204
209
|
Return data contained in the REPORT files. Use `aghplctools` if you want more report processing utility.
|
205
210
|
|
@@ -207,10 +212,13 @@ class HPLCController:
|
|
207
212
|
:param report_type: read either the TXT or CSV version
|
208
213
|
:return: report data for method
|
209
214
|
"""
|
210
|
-
return self.method_controller.get_report(
|
215
|
+
return self.method_controller.get_report(
|
216
|
+
custom_path=custom_path, report_type=report_type
|
217
|
+
)[0]
|
211
218
|
|
212
|
-
def get_last_run_method_data(
|
213
|
-
|
219
|
+
def get_last_run_method_data(
|
220
|
+
self, read_uv: bool = False, custom_path: Optional[str] = None
|
221
|
+
) -> Dict[int, AgilentHPLCChromatogram] | AgilentChannelChromatogramData:
|
214
222
|
"""
|
215
223
|
Returns the last run method data.
|
216
224
|
|
@@ -222,9 +230,11 @@ class HPLCController:
|
|
222
230
|
else:
|
223
231
|
return self.method_controller.get_data(custom_path=custom_path)
|
224
232
|
|
225
|
-
def get_last_run_sequence_reports(
|
226
|
-
|
227
|
-
|
233
|
+
def get_last_run_sequence_reports(
|
234
|
+
self,
|
235
|
+
custom_path: Optional[str] = None,
|
236
|
+
report_type: ReportType = ReportType.CSV,
|
237
|
+
) -> List[AgilentReport]:
|
228
238
|
"""
|
229
239
|
Return data contained in the REPORT files. Use `aghplctools` if you want more report processing utility.
|
230
240
|
|
@@ -232,11 +242,15 @@ class HPLCController:
|
|
232
242
|
:param report_type: read either the TXT or CSV version
|
233
243
|
:return: list of reports for each row
|
234
244
|
"""
|
235
|
-
return self.sequence_controller.get_report(
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
245
|
+
return self.sequence_controller.get_report(
|
246
|
+
custom_path=custom_path, report_type=report_type
|
247
|
+
)
|
248
|
+
|
249
|
+
def get_last_run_sequence_data(
|
250
|
+
self, read_uv: bool = False, custom_path: Optional[str] = None
|
251
|
+
) -> (
|
252
|
+
List[Dict[int, AgilentHPLCChromatogram]] | List[AgilentChannelChromatogramData]
|
253
|
+
):
|
240
254
|
"""
|
241
255
|
Returns data for all rows in the last run sequence data.
|
242
256
|
|
@@ -244,7 +258,7 @@ class HPLCController:
|
|
244
258
|
:param read_uv: whether to also read the UV file
|
245
259
|
"""
|
246
260
|
if read_uv:
|
247
|
-
return self.sequence_controller.
|
261
|
+
return self.sequence_controller.get_data_mult_uv(custom_path=custom_path)
|
248
262
|
else:
|
249
263
|
return self.sequence_controller.get_data(custom_path=custom_path)
|
250
264
|
|
@@ -269,7 +283,7 @@ class HPLCController:
|
|
269
283
|
self.send(Command.STANDBY_CMD)
|
270
284
|
|
271
285
|
def preprun(self):
|
272
|
-
"""
|
286
|
+
"""Prepares all modules for run. All lamps and pumps are switched on."""
|
273
287
|
self.send(Command.PREPRUN_CMD)
|
274
288
|
|
275
289
|
def lamp_on(self):
|
@@ -313,25 +313,21 @@ class SolventElement:
|
|
313
313
|
"required": True,
|
314
314
|
},
|
315
315
|
)
|
316
|
-
channel1_extended_solvent_type: Optional[Channel1ExtendedSolventType] = (
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
"type": "Element",
|
332
|
-
"required": True,
|
333
|
-
},
|
334
|
-
)
|
316
|
+
channel1_extended_solvent_type: Optional[Channel1ExtendedSolventType] = field(
|
317
|
+
default=None,
|
318
|
+
metadata={
|
319
|
+
"name": "Channel1ExtendedSolventType",
|
320
|
+
"type": "Element",
|
321
|
+
"required": True,
|
322
|
+
},
|
323
|
+
)
|
324
|
+
channel2_extended_solvent_type: Optional[Channel2ExtendedSolventType] = field(
|
325
|
+
default=None,
|
326
|
+
metadata={
|
327
|
+
"name": "Channel2ExtendedSolventType",
|
328
|
+
"type": "Element",
|
329
|
+
"required": True,
|
330
|
+
},
|
335
331
|
)
|
336
332
|
|
337
333
|
|
pychemstation/utils/macro.py
CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from dataclasses import dataclass
|
4
4
|
from enum import Enum
|
5
|
-
from typing import Union
|
5
|
+
from typing import Union
|
6
6
|
|
7
7
|
|
8
8
|
@dataclass
|
@@ -15,7 +15,7 @@ class Response:
|
|
15
15
|
# See https://www.agilent.com/cs/library/usermanuals/Public/MACROS.PDF
|
16
16
|
class Command(Enum):
|
17
17
|
def __str__(self):
|
18
|
-
return
|
18
|
+
return "%s" % self.value
|
19
19
|
|
20
20
|
GET_NUM_VAL_CMD = "response_num = {cmd}"
|
21
21
|
GET_TEXT_VAL_CMD = "response$ = {cmd}"
|
@@ -37,17 +37,17 @@ class Command(Enum):
|
|
37
37
|
# Method and Sequence Related
|
38
38
|
GET_METHOD_CMD = "response$ = _MethFile$"
|
39
39
|
GET_ROWS_CMD = 'response_num = TabHdrVal({register}, "{table_name}", "{col_name}")'
|
40
|
-
SWITCH_METHOD_CMD =
|
40
|
+
SWITCH_METHOD_CMD = "LoadMethod _MethPath$, _MethFile$"
|
41
41
|
SWITCH_METHOD_CMD_SPECIFIC = 'LoadMethod "{method_dir}", "{method_name}.M"'
|
42
42
|
START_METHOD_CMD = "StartMethod"
|
43
43
|
RUN_METHOD_CMD = 'RunMethod "{data_dir}",, "{experiment_name}"'
|
44
44
|
STOP_METHOD_CMD = "StopMethod"
|
45
|
-
UPDATE_METHOD_CMD =
|
46
|
-
SWITCH_SEQUENCE_CMD =
|
47
|
-
SAVE_SEQUENCE_CMD =
|
45
|
+
UPDATE_METHOD_CMD = "UpdateMethod"
|
46
|
+
SWITCH_SEQUENCE_CMD = "LoadSequence _SeqPath$, _SeqFile$"
|
47
|
+
SAVE_SEQUENCE_CMD = "SaveSequence _SeqPath$, _SeqFile$"
|
48
48
|
SAVE_METHOD_CMD = 'SaveMethod _MethPath$, _MethFile$, "{commit_msg}"'
|
49
|
-
GET_SEQUENCE_CMD =
|
50
|
-
RUN_SEQUENCE_CMD =
|
49
|
+
GET_SEQUENCE_CMD = "response$ = _SeqFile$"
|
50
|
+
RUN_SEQUENCE_CMD = "RunSequence"
|
51
51
|
|
52
52
|
|
53
53
|
class HPLCRunningStatus(Enum):
|
@@ -76,7 +76,6 @@ class HPLCAvailStatus(Enum):
|
|
76
76
|
|
77
77
|
|
78
78
|
class HPLCErrorStatus(Enum):
|
79
|
-
|
80
79
|
@classmethod
|
81
80
|
def has_member_key(cls, key):
|
82
81
|
return key in cls.__members__
|
@@ -87,7 +86,9 @@ class HPLCErrorStatus(Enum):
|
|
87
86
|
MALFORMED = "MALFORMED"
|
88
87
|
|
89
88
|
|
90
|
-
def str_to_status(
|
89
|
+
def str_to_status(
|
90
|
+
status: str,
|
91
|
+
):
|
91
92
|
if HPLCErrorStatus.has_member_key(status):
|
92
93
|
return HPLCErrorStatus[status]
|
93
94
|
if HPLCRunningStatus.has_member_key(status):
|
@@ -31,7 +31,7 @@ class HPLCMethodParams:
|
|
31
31
|
@dataclass
|
32
32
|
class TimeTableEntry:
|
33
33
|
start_time: float
|
34
|
-
organic_modifer: float
|
34
|
+
organic_modifer: Optional[float]
|
35
35
|
flow: Optional[float] = None
|
36
36
|
|
37
37
|
|
@@ -47,6 +47,7 @@ class MethodDetails:
|
|
47
47
|
:attribute params: the organic modifier (pump B) and flow rate displayed for the method (the time 0 settings)
|
48
48
|
:attribute dad_wavelengthes:
|
49
49
|
"""
|
50
|
+
|
50
51
|
name: str
|
51
52
|
params: HPLCMethodParams
|
52
53
|
timetable: list[TimeTableEntry]
|
pychemstation/utils/parsing.py
CHANGED
@@ -27,7 +27,6 @@ UINT32 = ENDIAN + "I"
|
|
27
27
|
|
28
28
|
|
29
29
|
def fread(fid, nelements, dtype):
|
30
|
-
|
31
30
|
"""Equivalent to Matlab fread function"""
|
32
31
|
|
33
32
|
if dtype is str:
|
@@ -42,7 +41,6 @@ def fread(fid, nelements, dtype):
|
|
42
41
|
|
43
42
|
|
44
43
|
def parse_utf16_string(file_, encoding="UTF16"):
|
45
|
-
|
46
44
|
"""Parse a pascal type UTF16 encoded string from a binary file object"""
|
47
45
|
|
48
46
|
# First read the expected number of CHARACTERS
|
@@ -53,7 +51,6 @@ def parse_utf16_string(file_, encoding="UTF16"):
|
|
53
51
|
|
54
52
|
|
55
53
|
class cached_property(object):
|
56
|
-
|
57
54
|
"""A property that is only computed once per instance and then replaces
|
58
55
|
itself with an ordinary attribute. Deleting the attribute resets the
|
59
56
|
property.
|
@@ -73,7 +70,6 @@ class cached_property(object):
|
|
73
70
|
|
74
71
|
|
75
72
|
class CHFile(object):
|
76
|
-
|
77
73
|
"""Class that implementats the Agilent .ch file format version
|
78
74
|
130. Warning: Not all aspects of the file header is understood,
|
79
75
|
so there may and probably is information that is not parsed. See
|
@@ -122,7 +118,6 @@ class CHFile(object):
|
|
122
118
|
supported_versions = {130}
|
123
119
|
|
124
120
|
def __init__(self, filepath):
|
125
|
-
|
126
121
|
self.filepath = filepath
|
127
122
|
self.metadata = {}
|
128
123
|
with open(self.filepath, "rb") as file_:
|
@@ -130,7 +125,6 @@ class CHFile(object):
|
|
130
125
|
self.values = self._parse_data(file_)
|
131
126
|
|
132
127
|
def _parse_header(self, file_):
|
133
|
-
|
134
128
|
"""Parse the header"""
|
135
129
|
|
136
130
|
# Parse and check version
|
@@ -154,7 +148,6 @@ class CHFile(object):
|
|
154
148
|
]
|
155
149
|
|
156
150
|
def _parse_header_status(self):
|
157
|
-
|
158
151
|
"""Print known and unknown parts of the header"""
|
159
152
|
|
160
153
|
file_ = open(self.filepath, "rb")
|
@@ -234,7 +227,6 @@ class CHFile(object):
|
|
234
227
|
file_.close()
|
235
228
|
|
236
229
|
def _parse_data(self, file_):
|
237
|
-
|
238
230
|
"""Parse the data. Decompress the delta-encoded data, and scale them
|
239
231
|
with y-scaling"""
|
240
232
|
|
@@ -252,7 +244,6 @@ class CHFile(object):
|
|
252
244
|
buff = [0, 0, 0, 0]
|
253
245
|
|
254
246
|
while file_.tell() < stop:
|
255
|
-
|
256
247
|
buff[0] = fread(file_, 1, INT16)[0][0]
|
257
248
|
buff[1] = buff[3]
|
258
249
|
|
@@ -260,7 +251,6 @@ class CHFile(object):
|
|
260
251
|
break
|
261
252
|
|
262
253
|
for i in range(buff[0] & 4095):
|
263
|
-
|
264
254
|
buff[2] = fread(file_, 1, INT16)[0][0]
|
265
255
|
|
266
256
|
if buff[2] != -32768:
|
@@ -279,7 +269,6 @@ class CHFile(object):
|
|
279
269
|
|
280
270
|
@cached_property
|
281
271
|
def times(self):
|
282
|
-
|
283
272
|
"""The time values (x-value) for the data set in minutes"""
|
284
273
|
|
285
274
|
return np.linspace(
|
@@ -1,9 +1,8 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from dataclasses import dataclass
|
4
3
|
from enum import Enum
|
5
4
|
from typing import Optional, List
|
6
|
-
|
5
|
+
from dataclasses import dataclass, field
|
7
6
|
from pychemstation.utils.tray_types import Tray
|
8
7
|
|
9
8
|
|
@@ -11,7 +10,7 @@ from pychemstation.utils.tray_types import Tray
|
|
11
10
|
class SequenceDataFiles:
|
12
11
|
sequence_name: str
|
13
12
|
dir: str
|
14
|
-
child_dirs:
|
13
|
+
child_dirs: List[str] = field(default_factory=list)
|
15
14
|
|
16
15
|
|
17
16
|
class SampleType(Enum):
|
@@ -28,7 +28,6 @@ def create_binary_peak_map(data):
|
|
28
28
|
peak_map = np.full_like(data_c, False, dtype=bool)
|
29
29
|
|
30
30
|
for _ in range(100500): # shouldn't take more iterations
|
31
|
-
|
32
31
|
# looking for peaks
|
33
32
|
peaks_found = np.logical_or(
|
34
33
|
data_c > np.mean(data_c) + np.std(data_c) * 3,
|
@@ -156,14 +155,14 @@ def filter_noisy_regions(y_data, peaks_regions):
|
|
156
155
|
# compute the actual regions data points
|
157
156
|
y_data_regions = []
|
158
157
|
for region in peaks_regions:
|
159
|
-
y_data_regions.append(y_data[region[0]: region[-1]])
|
158
|
+
y_data_regions.append(y_data[region[0] : region[-1]])
|
160
159
|
|
161
160
|
# compute noise data regions, i.e. in between peak regions
|
162
161
|
noise_data_regions = []
|
163
162
|
for row, _ in enumerate(peaks_regions):
|
164
163
|
try:
|
165
164
|
noise_data_regions.append(
|
166
|
-
y_data[peaks_regions[row][1]: peaks_regions[row + 1][0]]
|
165
|
+
y_data[peaks_regions[row][1] : peaks_regions[row + 1][0]]
|
167
166
|
)
|
168
167
|
except IndexError:
|
169
168
|
# exception for the last row -> discard
|
@@ -7,28 +7,30 @@ from typing import TypeVar
|
|
7
7
|
|
8
8
|
class TableOperation(Enum):
|
9
9
|
def __str__(self):
|
10
|
-
return
|
10
|
+
return "%s" % self.value
|
11
11
|
|
12
12
|
DELETE_TABLE = 'DelTab {register}, "{table_name}"'
|
13
13
|
CREATE_TABLE = 'NewTab {register}, "{table_name}"'
|
14
14
|
NEW_ROW = 'InsTabRow {register}, "{table_name}"'
|
15
15
|
DELETE_ROW = 'DelTabRow {register}, "{table_name}", {row}'
|
16
16
|
EDIT_ROW_VAL = 'SetTabVal "{register}", "{table_name}", {row}, "{col_name}", {val}'
|
17
|
-
EDIT_ROW_TEXT =
|
17
|
+
EDIT_ROW_TEXT = (
|
18
|
+
'SetTabText "{register}", "{table_name}", {row}, "{col_name}", "{val}"'
|
19
|
+
)
|
18
20
|
GET_ROW_VAL = 'TabVal("{register}", "{table_name}", {row}, "{col_name}")'
|
19
21
|
GET_ROW_TEXT = 'TabText$("{register}", "{table_name}", {row}, "{col_name}")'
|
20
22
|
GET_NUM_ROWS = 'Rows = TabHdrVal({register}, "{table_name}", "{col_name}")'
|
21
23
|
GET_OBJ_HDR_VAL = 'ObjHdrVal("{register}", "{register_flag}")'
|
22
24
|
GET_OBJ_HDR_TEXT = 'ObjHdrText$("{register}", "{register_flag}")'
|
23
|
-
UPDATE_OBJ_HDR_VAL =
|
24
|
-
UPDATE_OBJ_HDR_TEXT =
|
25
|
+
UPDATE_OBJ_HDR_VAL = "SetObjHdrVal {register}, {register_flag}, {val}"
|
26
|
+
UPDATE_OBJ_HDR_TEXT = "SetObjHdrText {register}, {register_flag}, {val}"
|
25
27
|
NEW_COL_TEXT = 'NewColText {register}, "{table_name}", "{col_name}", "{val}"'
|
26
28
|
NEW_COL_VAL = 'NewColVal {register}, "{table_name}", "{col_name}", {val}'
|
27
29
|
|
28
30
|
|
29
31
|
class RegisterFlag(Enum):
|
30
32
|
def __str__(self):
|
31
|
-
return
|
33
|
+
return "%s" % self.value
|
32
34
|
|
33
35
|
# for table
|
34
36
|
NUM_ROWS = "NumberOfRows"
|
@@ -40,7 +42,7 @@ class RegisterFlag(Enum):
|
|
40
42
|
SOLVENT_D_COMPOSITION = "PumpChannel4_CompositionPercentage"
|
41
43
|
FLOW = "Flow"
|
42
44
|
MAX_TIME = "StopTime_Time"
|
43
|
-
POST_TIME = "PostTime_Time"
|
45
|
+
POST_TIME = "PostTime_Time" # TODO: check
|
44
46
|
COLUMN_OVEN_TEMP1 = "TemperatureControl_Temperature"
|
45
47
|
COLUMN_OVEN_TEMP2 = "TemperatureControl2_Temperature"
|
46
48
|
STOPTIME_MODE = "StopTime_Mode"
|
@@ -55,7 +57,6 @@ class RegisterFlag(Enum):
|
|
55
57
|
EXTERNAL_CONTACT = "ExternalContact"
|
56
58
|
FUNCTION = "Function"
|
57
59
|
|
58
|
-
|
59
60
|
# for Sequence
|
60
61
|
VIAL_LOCATION = "Vial"
|
61
62
|
NAME = "SampleName"
|
@@ -86,10 +87,10 @@ class RegisterFlag(Enum):
|
|
86
87
|
REMOTE_DUR = "RemoteDuration"
|
87
88
|
|
88
89
|
|
89
|
-
|
90
90
|
@dataclass
|
91
91
|
class Table:
|
92
92
|
register: str
|
93
93
|
name: str
|
94
94
|
|
95
|
-
|
95
|
+
|
96
|
+
T = TypeVar("T")
|