pychemstation 0.5.13.dev2__tar.gz → 0.5.13.dev3__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.
Files changed (48) hide show
  1. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/PKG-INFO +1 -1
  2. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/tables/method.py +7 -2
  3. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/tables/table.py +20 -13
  4. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/hplc.py +13 -7
  5. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation.egg-info/PKG-INFO +1 -1
  6. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/setup.py +1 -1
  7. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/LICENSE +0 -0
  8. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/README.md +0 -0
  9. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/__init__.py +0 -0
  10. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/analysis/__init__.py +0 -0
  11. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/analysis/base_spectrum.py +0 -0
  12. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/analysis/spec_utils.py +0 -0
  13. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/analysis/utils.py +0 -0
  14. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/__init__.py +0 -0
  15. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/__init__.py +0 -0
  16. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/comm.py +0 -0
  17. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/devices/__init__.py +0 -0
  18. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/devices/column.py +0 -0
  19. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/devices/device.py +0 -0
  20. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/devices/pump.py +0 -0
  21. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/tables/__init__.py +0 -0
  22. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/control/controllers/tables/sequence.py +0 -0
  23. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/generated/__init__.py +0 -0
  24. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/generated/dad_method.py +0 -0
  25. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/generated/pump_method.py +0 -0
  26. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/__init__.py +0 -0
  27. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/chromatogram.py +0 -0
  28. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/injector_types.py +0 -0
  29. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/macro.py +0 -0
  30. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/method_types.py +0 -0
  31. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/parsing.py +0 -0
  32. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/pump_types.py +0 -0
  33. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/sequence_types.py +0 -0
  34. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/table_types.py +0 -0
  35. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation/utils/tray_types.py +0 -0
  36. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation.egg-info/SOURCES.txt +0 -0
  37. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation.egg-info/dependency_links.txt +0 -0
  38. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation.egg-info/requires.txt +0 -0
  39. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pychemstation.egg-info/top_level.txt +0 -0
  40. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/pyproject.toml +0 -0
  41. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/setup.cfg +0 -0
  42. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/__init__.py +0 -0
  43. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/constants.py +0 -0
  44. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/test_comb.py +0 -0
  45. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/test_comm.py +0 -0
  46. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/test_inj.py +0 -0
  47. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/test_method.py +0 -0
  48. {pychemstation-0.5.13.dev2 → pychemstation-0.5.13.dev3}/tests/test_sequence.py +0 -0
@@ -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
@@ -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 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="pychemstation",
8
- version="0.5.13.dev2",
8
+ version="0.5.13.dev3",
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",