pychemstation 0.5.14__tar.gz → 0.5.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pychemstation-0.5.14 → pychemstation-0.5.15}/PKG-INFO +1 -1
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/injector.py +29 -13
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/table.py +19 -17
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/injector_types.py +2 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/macro.py +1 -1
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/table_types.py +2 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation.egg-info/PKG-INFO +1 -1
- {pychemstation-0.5.14 → pychemstation-0.5.15}/setup.py +1 -1
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/test_inj.py +6 -31
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/test_method.py +20 -2
- {pychemstation-0.5.14 → pychemstation-0.5.15}/LICENSE +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/README.md +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/analysis/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/analysis/base_spectrum.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/analysis/spec_utils.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/analysis/utils.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/comm.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/column.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/device.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/pump.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/method.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/ms.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/sequence.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/hplc.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/generated/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/generated/dad_method.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/generated/pump_method.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/chromatogram.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/method_types.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/parsing.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/pump_types.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/sequence_types.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/utils/tray_types.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation.egg-info/SOURCES.txt +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation.egg-info/dependency_links.txt +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation.egg-info/requires.txt +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation.egg-info/top_level.txt +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/pyproject.toml +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/setup.cfg +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/__init__.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/constants.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/test_comb.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/test_comm.py +0 -0
- {pychemstation-0.5.14 → pychemstation-0.5.15}/tests/test_sequence.py +0 -0
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/injector.py
RENAMED
@@ -1,6 +1,7 @@
|
|
1
1
|
from ....control.controllers import CommunicationController
|
2
2
|
from .device import DeviceController
|
3
3
|
from ....utils.injector_types import *
|
4
|
+
from ....utils.macro import Command
|
4
5
|
from ....utils.table_types import Table, RegisterFlag
|
5
6
|
|
6
7
|
|
@@ -19,10 +20,14 @@ class InjectorController(DeviceController):
|
|
19
20
|
elif function == "Inject":
|
20
21
|
return Inject()
|
21
22
|
elif function == "Draw":
|
23
|
+
# TODO: better error handling
|
22
24
|
is_source = SourceType(self.get_text(row, RegisterFlag.DRAW_SOURCE))
|
23
25
|
is_volume = Mode(self.get_text(row, RegisterFlag.DRAW_VOLUME))
|
24
|
-
|
25
|
-
|
26
|
+
vol = self.get_num(row, RegisterFlag.DRAW_VOLUME_VALUE) if is_volume == Mode.SET else None
|
27
|
+
if is_source is SourceType.SPECIFIC_LOCATION:
|
28
|
+
return Draw(amount=vol, source=return_tray_loc())
|
29
|
+
elif is_source is SourceType.LOCATION:
|
30
|
+
return Draw(amount=vol, location=self.get_text(row, RegisterFlag.DRAW_LOCATION))
|
26
31
|
elif function == "Remote":
|
27
32
|
return Remote(command=RemoteCommand(self.get_text(row, RegisterFlag.REMOTE)),
|
28
33
|
duration=self.get_num(row, RegisterFlag.REMOTE_DUR))
|
@@ -30,17 +35,21 @@ class InjectorController(DeviceController):
|
|
30
35
|
def load(self) -> InjectorTable:
|
31
36
|
rows = self.get_num_rows()
|
32
37
|
if rows.is_ok():
|
33
|
-
return InjectorTable(functions=[self.get_row(i + 1) for i in range(rows.ok_value.num_response)])
|
38
|
+
return InjectorTable(functions=[self.get_row(i + 1) for i in range(int(rows.ok_value.num_response))])
|
34
39
|
|
35
40
|
def edit(self, injector_table: InjectorTable):
|
36
|
-
self.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
rows = self.get_num_rows()
|
42
|
+
if rows.is_ok():
|
43
|
+
existing_row_num = rows.value.num_response
|
44
|
+
wanted_row_num = len(injector_table.functions)
|
45
|
+
while existing_row_num != wanted_row_num:
|
46
|
+
if wanted_row_num > existing_row_num:
|
47
|
+
self.add_row()
|
48
|
+
elif wanted_row_num < existing_row_num:
|
49
|
+
self.delete_row(int(existing_row_num))
|
50
|
+
self.send(Command.SAVE_METHOD_CMD)
|
51
|
+
existing_row_num = self.get_num_rows().ok_value.num_response
|
52
|
+
self.send(Command.SWITCH_METHOD_CMD)
|
44
53
|
|
45
54
|
columns_added = set()
|
46
55
|
|
@@ -72,7 +81,10 @@ class InjectorController(DeviceController):
|
|
72
81
|
else:
|
73
82
|
add_table_val(col_name=RegisterFlag.DRAW_VOLUME, val=Mode.DEFAULT.value)
|
74
83
|
|
75
|
-
if draw.
|
84
|
+
if draw.location:
|
85
|
+
add_table_val(col_name=RegisterFlag.DRAW_SOURCE, val=SourceType.LOCATION.value)
|
86
|
+
add_table_val(col_name=RegisterFlag.DRAW_LOCATION, val=draw.location)
|
87
|
+
elif draw.source:
|
76
88
|
add_table_val(col_name=RegisterFlag.DRAW_SOURCE, val=SourceType.SPECIFIC_LOCATION.value)
|
77
89
|
add_table_val(col_name=RegisterFlag.DRAW_LOCATION_UNIT, val=1)
|
78
90
|
add_table_val(col_name=RegisterFlag.DRAW_LOCATION_TRAY, val=1)
|
@@ -101,6 +113,10 @@ class InjectorController(DeviceController):
|
|
101
113
|
elif isinstance(function, Remote):
|
102
114
|
add_remote(function)
|
103
115
|
self.download()
|
116
|
+
self.send(Command.SAVE_METHOD_CMD)
|
117
|
+
self.send(Command.SWITCH_METHOD_CMD)
|
104
118
|
|
105
119
|
def download(self):
|
106
|
-
|
120
|
+
self.send('Sleep 1')
|
121
|
+
self.sleepy_send("DownloadLWls 1")
|
122
|
+
self.send('Sleep 1')
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/table.py
RENAMED
@@ -6,6 +6,7 @@ Authors: Lucy Hao
|
|
6
6
|
|
7
7
|
import abc
|
8
8
|
import os
|
9
|
+
import warnings
|
9
10
|
from dataclasses import dataclass
|
10
11
|
from typing import Union, Optional
|
11
12
|
|
@@ -33,8 +34,8 @@ class ChromData:
|
|
33
34
|
class TableController(abc.ABC):
|
34
35
|
|
35
36
|
def __init__(self, controller: CommunicationController,
|
36
|
-
src: str,
|
37
|
-
data_dir: str,
|
37
|
+
src: Optional[str],
|
38
|
+
data_dir: Optional[str],
|
38
39
|
table: Table,
|
39
40
|
offline: bool = False):
|
40
41
|
self.controller = controller
|
@@ -45,26 +46,27 @@ class TableController(abc.ABC):
|
|
45
46
|
# Initialize row counter for table operations
|
46
47
|
self.send('Local Rows')
|
47
48
|
|
48
|
-
if os.path.isdir(src):
|
49
|
+
if src and os.path.isdir(src):
|
49
50
|
self.src: str = src
|
50
51
|
else:
|
51
|
-
|
52
|
+
warnings.warn(f"dir: {src} not found.")
|
52
53
|
|
53
|
-
if os.path.isdir(data_dir):
|
54
|
+
if data_dir and os.path.isdir(data_dir):
|
54
55
|
self.data_dir: str = data_dir
|
55
56
|
else:
|
56
|
-
|
57
|
-
|
58
|
-
self
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
warnings.warn(f"dir: {data_dir} not found.")
|
58
|
+
|
59
|
+
if hasattr(self, "data_dir"):
|
60
|
+
self.spectra: dict[str, Optional[AgilentHPLCChromatogram]] = {
|
61
|
+
"A": AgilentHPLCChromatogram(self.data_dir),
|
62
|
+
"B": AgilentHPLCChromatogram(self.data_dir),
|
63
|
+
"C": AgilentHPLCChromatogram(self.data_dir),
|
64
|
+
"D": AgilentHPLCChromatogram(self.data_dir),
|
65
|
+
"E": AgilentHPLCChromatogram(self.data_dir),
|
66
|
+
"F": AgilentHPLCChromatogram(self.data_dir),
|
67
|
+
"G": AgilentHPLCChromatogram(self.data_dir),
|
68
|
+
"H": AgilentHPLCChromatogram(self.data_dir),
|
69
|
+
}
|
68
70
|
else:
|
69
71
|
self.spectra: dict[str, Optional[AgilentHPLCChromatogram]] = {
|
70
72
|
"A": AgilentHPLCChromatogram(),
|
@@ -8,6 +8,7 @@ from pychemstation.utils.tray_types import Tray
|
|
8
8
|
class SourceType(Enum):
|
9
9
|
DEFAULT = "ActualPosition"
|
10
10
|
SPECIFIC_LOCATION = "ActualPositionPlusLocation"
|
11
|
+
LOCATION = "Location"
|
11
12
|
|
12
13
|
|
13
14
|
class Mode(Enum):
|
@@ -18,6 +19,7 @@ class Mode(Enum):
|
|
18
19
|
@dataclass
|
19
20
|
class Draw:
|
20
21
|
amount: Optional[float] = None
|
22
|
+
location: Optional[str] = None
|
21
23
|
source: Optional[Tray] = None
|
22
24
|
|
23
25
|
|
@@ -37,7 +37,7 @@ 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 = 'LoadMethod
|
40
|
+
SWITCH_METHOD_CMD = 'LoadMethod _MethPath$, _MethFile$'
|
41
41
|
START_METHOD_CMD = "StartMethod"
|
42
42
|
RUN_METHOD_CMD = 'RunMethod "{data_dir}",, "{experiment_name}_{timestamp}"'
|
43
43
|
STOP_METHOD_CMD = "StopMethod"
|
@@ -71,7 +71,9 @@ class RegisterFlag(Enum):
|
|
71
71
|
DRAW_VOLUME = "DrawVolume_Mode"
|
72
72
|
DRAW_SPEED = "DrawSpeed_Mode"
|
73
73
|
DRAW_OFFSET = "DrawOffset_Mode"
|
74
|
+
# SetObjHdrVal RCWLS1Pretreatment[1], "DrawVolume_Value", 1
|
74
75
|
DRAW_VOLUME_VALUE = "DrawVolume_Value"
|
76
|
+
DRAW_LOCATION = "DrawLocation"
|
75
77
|
DRAW_LOCATION_TRAY = "DrawLocationPlus_Tray"
|
76
78
|
DRAW_LOCATION_UNIT = "DrawLocationPlus_Unit"
|
77
79
|
DRAW_LOCATION_ROW = "DrawLocationPlus_Row"
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="pychemstation",
|
8
|
-
version="0.5.
|
8
|
+
version="0.5.15",
|
9
9
|
author="Lucy Hao",
|
10
10
|
author_email="lhao03@student.ubc.ca",
|
11
11
|
description="Library to interact with Chemstation software, primarily used in Hein lab",
|
@@ -9,7 +9,7 @@ from tests.constants import *
|
|
9
9
|
|
10
10
|
class TestInj(unittest.TestCase):
|
11
11
|
def setUp(self):
|
12
|
-
path_constants = room(
|
12
|
+
path_constants = room(254)
|
13
13
|
for path in path_constants:
|
14
14
|
if not os.path.exists(path):
|
15
15
|
self.fail(
|
@@ -23,7 +23,8 @@ class TestInj(unittest.TestCase):
|
|
23
23
|
def test_load_inj(self):
|
24
24
|
self.hplc_controller.switch_method(DEFAULT_METHOD)
|
25
25
|
try:
|
26
|
-
self.hplc_controller.load_injector_program()
|
26
|
+
inj_table = self.hplc_controller.load_injector_program()
|
27
|
+
self.assertTrue(len(inj_table.functions) == 2)
|
27
28
|
except Exception as e:
|
28
29
|
self.fail(f"Should have not failed, {e}")
|
29
30
|
|
@@ -32,23 +33,8 @@ class TestInj(unittest.TestCase):
|
|
32
33
|
try:
|
33
34
|
injector_program = InjectorTable(
|
34
35
|
functions=[
|
35
|
-
Draw(
|
36
|
-
|
37
|
-
source=FiftyFourVialPlate(
|
38
|
-
plate=Plate.ONE,
|
39
|
-
letter=Letter.A,
|
40
|
-
num=Num.EIGHT)),
|
41
|
-
Remote(
|
42
|
-
command=RemoteCommand.PREPARE,
|
43
|
-
duration=10,
|
44
|
-
),
|
45
|
-
Wait(
|
46
|
-
duration=2
|
47
|
-
),
|
48
|
-
Inject(
|
49
|
-
|
50
|
-
)
|
51
|
-
]
|
36
|
+
Draw(amount=0.3, location="P1-A2"),
|
37
|
+
Inject()]
|
52
38
|
)
|
53
39
|
self.hplc_controller.edit_injector_program(injector_program)
|
54
40
|
except Exception as e:
|
@@ -58,19 +44,8 @@ class TestInj(unittest.TestCase):
|
|
58
44
|
self.hplc_controller.switch_method(DEFAULT_METHOD)
|
59
45
|
try:
|
60
46
|
injector_program = InjectorTable(
|
61
|
-
functions=[
|
62
|
-
Draw(
|
63
|
-
amount=0.3,
|
64
|
-
source=FiftyFourVialPlate(
|
65
|
-
plate=Plate.ONE,
|
66
|
-
letter=Letter.A,
|
67
|
-
num=Num.EIGHT)),
|
68
|
-
Inject(
|
69
|
-
|
70
|
-
)
|
71
|
-
]
|
47
|
+
functions=[Draw(location="P1-F2"), Inject()]
|
72
48
|
)
|
73
|
-
|
74
49
|
self.hplc_controller.edit_injector_program(injector_program)
|
75
50
|
except Exception as e:
|
76
51
|
self.fail(f"Should have not failed: {e}")
|
@@ -7,7 +7,7 @@ from tests.constants import *
|
|
7
7
|
|
8
8
|
class TestMethod(unittest.TestCase):
|
9
9
|
def setUp(self):
|
10
|
-
path_constants = room(
|
10
|
+
path_constants = room(254)
|
11
11
|
for path in path_constants:
|
12
12
|
if not os.path.exists(path):
|
13
13
|
self.fail(
|
@@ -28,7 +28,25 @@ class TestMethod(unittest.TestCase):
|
|
28
28
|
|
29
29
|
def test_edit_method(self):
|
30
30
|
self.hplc_controller.method_controller.switch(DEFAULT_METHOD)
|
31
|
-
new_method =
|
31
|
+
new_method = MethodDetails(name=DEFAULT_METHOD,
|
32
|
+
timetable=[TimeTableEntry(start_time=1,
|
33
|
+
organic_modifer=20,
|
34
|
+
flow=0.65),
|
35
|
+
TimeTableEntry(start_time=2,
|
36
|
+
organic_modifer=30,
|
37
|
+
flow=0.65),
|
38
|
+
TimeTableEntry(start_time=2.5,
|
39
|
+
organic_modifer=60,
|
40
|
+
flow=0.65),
|
41
|
+
TimeTableEntry(start_time=3,
|
42
|
+
organic_modifer=80,
|
43
|
+
flow=0.65),
|
44
|
+
TimeTableEntry(start_time=3.5,
|
45
|
+
organic_modifer=100,
|
46
|
+
flow=0.65)],
|
47
|
+
stop_time=4,
|
48
|
+
post_time=1,
|
49
|
+
params=HPLCMethodParams(organic_modifier=5, flow=0.65))
|
32
50
|
try:
|
33
51
|
self.hplc_controller.edit_method(new_method)
|
34
52
|
except Exception as e:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/__init__.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/column.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/device.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/devices/pump.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/__init__.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/method.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/ms.py
RENAMED
File without changes
|
{pychemstation-0.5.14 → pychemstation-0.5.15}/pychemstation/control/controllers/tables/sequence.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|