pychemstation 0.5.13.dev2__py3-none-any.whl → 0.5.13.dev3__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.
@@ -314,14 +314,19 @@ class MethodController(TableController):
314
314
  self.table_state = self.load()
315
315
 
316
316
  folder_name = ""
317
- hplc_is_running = self.check_hplc_is_running()
318
- while not hplc_is_running:
317
+ hplc_is_running = False
318
+ tries = 0
319
+ while not hplc_is_running and tries < 10:
319
320
  timestamp = time.strftime(TIME_FORMAT)
320
321
  self.send(Command.RUN_METHOD_CMD.value.format(data_dir=self.data_dir,
321
322
  experiment_name=experiment_name,
322
323
  timestamp=timestamp))
323
324
  folder_name = f"{experiment_name}_{timestamp}.D"
324
325
  hplc_is_running = self.check_hplc_is_running()
326
+ tries += 1
327
+
328
+ if hplc_is_running:
329
+ raise RuntimeError
325
330
 
326
331
  self.data_files.append(os.path.join(self.data_dir, folder_name))
327
332
 
@@ -11,6 +11,7 @@ from typing import Union, Optional
11
11
 
12
12
  import numpy as np
13
13
  import polling
14
+ from polling import MaxCallException
14
15
  from rainbow import DataFile
15
16
  from result import Result, Ok, Err
16
17
  import pandas as pd
@@ -34,20 +35,25 @@ class ChromData:
34
35
 
35
36
  class TableController(abc.ABC):
36
37
 
37
- def __init__(self, controller: CommunicationController, src: str, data_dir: str, table: Table):
38
+ def __init__(self, controller: CommunicationController,
39
+ src: str,
40
+ data_dir: str,
41
+ table: Table,
42
+ offline: bool = False):
38
43
  self.controller = controller
39
44
  self.table = table
40
45
  self.table_state: Optional[TableType] = None
41
46
 
42
- if os.path.isdir(src):
43
- self.src: str = src
44
- else:
45
- raise FileNotFoundError(f"dir: {src} not found.")
47
+ if not offline:
48
+ if os.path.isdir(src):
49
+ self.src: str = src
50
+ else:
51
+ raise FileNotFoundError(f"dir: {src} not found.")
46
52
 
47
- if os.path.isdir(data_dir):
48
- self.data_dir: str = data_dir
49
- else:
50
- raise FileNotFoundError(f"dir: {data_dir} not found.")
53
+ if os.path.isdir(data_dir):
54
+ self.data_dir: str = data_dir
55
+ else:
56
+ raise FileNotFoundError(f"dir: {data_dir} not found.")
51
57
 
52
58
  self.spectra: dict[str, Optional[AgilentHPLCChromatogram]] = {
53
59
  "A": AgilentHPLCChromatogram(self.data_dir),
@@ -202,10 +208,11 @@ class TableController(abc.ABC):
202
208
  return Err("No rows could be read.")
203
209
 
204
210
  def check_hplc_is_running(self) -> bool:
205
- started_running = polling.poll(
206
- lambda: isinstance(self.controller.get_status(), HPLCRunningStatus),
207
- step=5,
208
- max_tries=40)
211
+ try:
212
+ started_running = polling.poll(lambda: isinstance(self.controller.get_status(), HPLCRunningStatus),
213
+ step=3, max_tries=10)
214
+ except MaxCallException:
215
+ return False
209
216
  return started_running
210
217
 
211
218
  def check_hplc_done_running(self,
@@ -41,18 +41,20 @@ class HPLCController:
41
41
  `comm_dir` must match the file path in the macro file.
42
42
 
43
43
  :param comm_dir: Name of directory for communication, where ChemStation will read and write from. Can be any existing directory.
44
- :raises FileNotFoundError: If either `data_dir`, `method_dir` or `comm_dir` is not a valid directory.
44
+ :raises FileNotFoundError: If either `data_dir`, `method_dir`, `sequence_dir`, or `comm_dir` is not a valid directory.
45
45
  """
46
46
  self.comm = CommunicationController(comm_dir=comm_dir) if not offline else None
47
47
  self.method_controller = MethodController(controller=self.comm,
48
48
  src=method_dir,
49
49
  data_dir=data_dir,
50
- table=self.METHOD_TIMETABLE)
50
+ table=self.METHOD_TIMETABLE,
51
+ offline=offline)
51
52
  self.sequence_controller = SequenceController(controller=self.comm,
52
53
  src=sequence_dir,
53
54
  data_dir=data_dir,
54
55
  table=self.SEQUENCE_TABLE,
55
- method_dir=method_dir)
56
+ method_dir=method_dir,
57
+ offline=offline)
56
58
 
57
59
  def send(self, cmd: Union[Command, str]):
58
60
  if not self.comm:
@@ -142,21 +144,25 @@ class HPLCController:
142
144
  """
143
145
  self.sequence_controller.edit_row(row, num)
144
146
 
145
- def get_last_run_method_data(self, data: Optional[str] = None) -> AgilentChannelChromatogramData:
147
+ def get_last_run_method_data(self, read_uv: bool = False,
148
+ data: Optional[str] = None) -> AgilentChannelChromatogramData:
146
149
  """
147
150
  Returns the last run method data.
148
151
 
149
152
  :param data: If you want to just load method data but from a file path. This file path must be the complete file path.
153
+ :param read_uv: whether to also read the UV file
150
154
  """
151
- return self.method_controller.get_data(custom_path=data)
155
+ return self.method_controller.get_data(custom_path=data, read_uv=read_uv)
152
156
 
153
- def get_last_run_sequence_data(self, data: Optional[str] = None) -> list[AgilentChannelChromatogramData]:
157
+ def get_last_run_sequence_data(self, read_uv: bool = False,
158
+ data: Optional[str] = None) -> list[AgilentChannelChromatogramData]:
154
159
  """
155
160
  Returns data for all rows in the last run sequence data.
156
161
 
157
162
  :param data: If you want to just load sequence data but from a file path. This file path must be the complete file path.
163
+ :param read_uv: whether to also read the UV file
158
164
  """
159
- return self.sequence_controller.get_data(custom_path=data)
165
+ return self.sequence_controller.get_data(custom_path=data, read_uv=read_uv)
160
166
 
161
167
  def check_loaded_sequence(self) -> str:
162
168
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pychemstation
3
- Version: 0.5.13.dev2
3
+ Version: 0.5.13.dev3
4
4
  Summary: Library to interact with Chemstation software, primarily used in Hein lab
5
5
  Home-page: https://gitlab.com/heingroup/device-api/pychemstation
6
6
  Author: Lucy Hao
@@ -5,7 +5,7 @@ pychemstation/analysis/spec_utils.py,sha256=UOo9hJR3evJfmaohEEsyb7aq6X996ofuUfu-
5
5
  pychemstation/analysis/utils.py,sha256=ISupAOb_yqA4_DZRK9v18UL-XjUQccAicIJKb1VMnGg,2055
6
6
  pychemstation/control/__init__.py,sha256=4xTy8X-mkn_PPZKr7w9rnj1wZhtmTesbQptPhpYmKXs,64
7
7
  pychemstation/control/comm.py,sha256=u44g1hTluQ0yUG93Un-QAshScoDpgYRrZfFTgweP5tY,7386
8
- pychemstation/control/hplc.py,sha256=5xC5q-hrAn5hKdz-ZwT_Dlas9LWLV27jZvhCKj7Lzg4,8761
8
+ pychemstation/control/hplc.py,sha256=UlafodQoFFow2UVo-INK1ZjxyJ5vrVvv1TjB5VyAsHo,9178
9
9
  pychemstation/control/controllers/__init__.py,sha256=EM6LBNSTJqYVatmnvPq0P-S3q0POA88c-y64zL79I_I,252
10
10
  pychemstation/control/controllers/comm.py,sha256=IU4I_Q42VNCNUlVi93MxCmw2EBY9hiBDkU9FxubKg3c,7441
11
11
  pychemstation/control/controllers/method.py,sha256=XUclB7lQ_SIkquR58MBmmi9drHIPEq9AR8VprTLenvI,15503
@@ -16,9 +16,9 @@ pychemstation/control/controllers/devices/column.py,sha256=SCpCnVFZFUM9LM51MbWkV
16
16
  pychemstation/control/controllers/devices/device.py,sha256=SF1JK93FjmACnYrlKvldX3gEeA21qnXZegeNhc9QJGQ,738
17
17
  pychemstation/control/controllers/devices/pump.py,sha256=DJQh4lNXEraeC1CWrsKmsITOjuYlRI3tih_XRB3F1hg,1404
18
18
  pychemstation/control/controllers/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- pychemstation/control/controllers/tables/method.py,sha256=TlP7FwEmN-QGwewoxXNuzLBAzDipRms9TMTgdAaKJmM,16033
19
+ pychemstation/control/controllers/tables/method.py,sha256=pZO0Z5JAXaiYHyo6OCdKEEDS6LwrVEgoGUZZUASU-eg,16126
20
20
  pychemstation/control/controllers/tables/sequence.py,sha256=Yq31YhcIhmu1A3iVEFV_d_N68QHABGVOkqn1QrvyKu0,8766
21
- pychemstation/control/controllers/tables/table.py,sha256=LAxDNKY2sEypikYR6v6o8SiuP70Ay-FYcvuCfVSFhsQ,11621
21
+ pychemstation/control/controllers/tables/table.py,sha256=56kvNb_U8ka_m1r4sk-6yzRiXTT3CuszP7aoX6-TIlE,11886
22
22
  pychemstation/control/table/__init__.py,sha256=RgMN4uIWHdNUHpGRBWdzmzAbk7XEKl6Y-qtqWCxzSZU,124
23
23
  pychemstation/control/table/method.py,sha256=THVoGomSXff_CTU3eAYme0BYwkPzab5UgZKsiZ29QSk,12196
24
24
  pychemstation/control/table/sequence.py,sha256=Eri52AnbE3BGthfrRSvYKYciquUzvHKo0lYUTySYYE8,10542
@@ -43,8 +43,8 @@ tests/test_comm.py,sha256=EYOpVXzEMQLGhhKYDPO-KaLcJdPSMPTD9Y4jSI0yVQY,2516
43
43
  tests/test_inj.py,sha256=yaPGZoHiOC3ZSgsmrtiqp8QtSo2bMxB9FJhaFlOpad0,1412
44
44
  tests/test_method.py,sha256=r1Q1irqiVzs31QuTYLX3u_A0FpX8rIAQ1L4WOk9tLbk,2473
45
45
  tests/test_sequence.py,sha256=Nz2iqp1cJgw6kcQvnwSkfBmhxpOH62PoEu6o_5rO-PY,4929
46
- pychemstation-0.5.13.dev2.dist-info/LICENSE,sha256=9bdF75gIf1MecZ7oymqWgJREVz7McXPG-mjqrTmzzD8,18658
47
- pychemstation-0.5.13.dev2.dist-info/METADATA,sha256=KRy25kSutKC7MXyLmp6YYcIkiIRh9s0GzglAVa1rudg,4372
48
- pychemstation-0.5.13.dev2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
49
- pychemstation-0.5.13.dev2.dist-info/top_level.txt,sha256=zXfKu_4nYWwPHo3OsuhshMNC3SPkcoTGCyODjURaghY,20
50
- pychemstation-0.5.13.dev2.dist-info/RECORD,,
46
+ pychemstation-0.5.13.dev3.dist-info/LICENSE,sha256=9bdF75gIf1MecZ7oymqWgJREVz7McXPG-mjqrTmzzD8,18658
47
+ pychemstation-0.5.13.dev3.dist-info/METADATA,sha256=2av4WWulIZZUNvF5vg-WDRPUAVBE7YQthe2toAg6YIs,4372
48
+ pychemstation-0.5.13.dev3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
49
+ pychemstation-0.5.13.dev3.dist-info/top_level.txt,sha256=zXfKu_4nYWwPHo3OsuhshMNC3SPkcoTGCyODjURaghY,20
50
+ pychemstation-0.5.13.dev3.dist-info/RECORD,,