Library to interact with Chemstation software, primarily used in Hein lab
Project description
Agilent HPLC Macro Control
NOTE: If you are running Python 3.8, use versions 0.8.x. If you are running Python 3.9 use versions 0.8.x. If you are running Python >=3.10, use version 0.10.x. You are welcome to use newer pychemstation versions with older Python versions, but functionality is not guaranteed!
Unofficial Python package to control Agilent Chemstation; we are not affiliated with Agilent. Check out the docs for usage instructions. This project is under active development, and breaking changes may occur at any moment.
Getting started
Before running this library, these are the steps you need to complete.
Add python package
pip install pychemstation
Add required MACRO script
- Open ChemStation
- Run this in the ChemStation command line:
Print _AutoPath$. Go to this path in your file navigator, as this is where you will put your MACRO file(s). - Download the
hplc_talk.mac.- On line 69, change the path name up to
\cmdand\reply. For instance, you should have:MonitorFile "[my path]\cmd", "[my path]\reply" - and then add this file to the folder from the previous step.
- On line 69, change the path name up to
- To have these MACRO files be read by ChemStation, you must either:
- Open ChemStation and run:
macro hplc_talk.mac
HPLCTalk_Run
- OR add the above lines to a MACRO file named:
user.mac, and then putuser.macin the same folder from step 3.- ChemStation will automatically load these MACRO files for you. However, sometimes this does not work, and if it
does not, you will have to run the lines in the
user.macmanually.
- ChemStation will automatically load these MACRO files for you. However, sometimes this does not work, and if it
does not, you will have to run the lines in the
Example Usage
from pychemstation.control import HPLCController
from pychemstation.utils.method_types import *
import pandas as pd
DEFAULT_METHOD_DIR = "C:\\ChemStation\\1\\Methods\\"
SEQUENCE_DIR = "C:\\USERS\\PUBLIC\\DOCUMENTS\\CHEMSTATION\\3\\Sequence"
DEFAULT_COMMAND_PATH = "C:\\Users\\User\\Desktop\\Lucy\\"
DATA_DIR_2 = "C:\\Users\\Public\\Documents\\ChemStation\\2\\Data"
DATA_DIR_3 = "C:\\Users\\Public\\Documents\\ChemStation\\3\\Data"
# Initialize HPLC Controller
hplc_controller = HPLCController(data_dirs=[DATA_DIR_2, DATA_DIR_3],
comm_dir=DEFAULT_COMMAND_PATH,
method_dir=DEFAULT_METHOD_DIR,
sequence_dir=SEQUENCE_DIR)
# Switching a method
hplc_controller.switch_method("General-Poroshell")
# Editing a method
new_method = MethodDetails(
name="General-Poroshell",
params=HPLCMethodParams(
organic_modifier=7,
flow=0.44),
timetable=[
TimeTableEntry(
start_time=0.10,
organic_modifer=7,
flow=0.34
),
TimeTableEntry(
start_time=4,
organic_modifer=99,
flow=0.55
)
],
stop_time=5,
post_time=2
)
hplc_controller.edit_method(new_method)
# Run a method and get a report or data from last run method
hplc_controller.run_method(experiment_name="test_experiment")
report = hplc_controller.get_last_run_method_report()
vial_location = report.vial_location
# Save, analyze or plot the data!
chrom = hplc_controller.get_last_run_method_data()
chromatogram_data = pd.DataFrame.from_dict({"x": chrom.A.x, "y": chrom.A.y})
chromatogram_data.to_csv("Run 10.csv", index=False)
Adding your own MACROs
If you wish to add your own MACRO functions, then all you need to do is write you MACRO (using Agilent's) MACRO guide,
put the file in the user.mac file and then list the function you want to use.
Developing
If you would like to contribute to this project, check out our GitLab!
Authors and Acknowledgements
Lucy Hao, Maria Politi
- Adapted from AnalyticalLabware, created by members in the Cronin Group. Copyright © Cronin Group, used under the CC-BY-4.0 license.
- Adapted from the MACROS used in Operator-free HPLC automated method development guided by Bayesian optimization, created by members in the Bourne Group. Copyright © Bourne Group, used under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pychemstation-0.9.0.tar.gz.
File metadata
- Download URL: pychemstation-0.9.0.tar.gz
- Upload date:
- Size: 5.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
060a88466d368c15592aeae75208f7dcd1e26f2d022d017b5e96f4964eb2f5a3
|
|
| MD5 |
f6bbf4cafe0a92ee8056f4b06eefa739
|
|
| BLAKE2b-256 |
e8f6f27873a69213fc79de6650e6b69be6d84b6ebd029a69ca19c43277cf1367
|
File details
Details for the file pychemstation-0.9.0-py3-none-any.whl.
File metadata
- Download URL: pychemstation-0.9.0-py3-none-any.whl
- Upload date:
- Size: 59.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2b900e50a72e0ca6b838af65528b1fc0f64d23a7466a27819206b6f44ac55c
|
|
| MD5 |
2856d84285372cf562ad3549346dcb95
|
|
| BLAKE2b-256 |
0b1872943b3108ad6f5547988eab9d094f302a25899fb5d6260dd92452ccafb7
|