aghplctools package¶
Subpackages¶
aghplctools.local_paths module¶
Automatic determination of local ChemStation paths on this system
-
class
aghplctools.local_paths.
AcquisitionSearch
(data_path: Union[str, pathlib.Path], cycle_time: float = 1.0, always_search: bool = False, autostart: bool = True)¶ Bases:
object
An Agilent ChemStation data path monitoring class. This class will monitor for sequence flags and will live-update acquiring status, the current data file, and the current sample number.
Parameters: - data_path – file path to the data directory
- cycle_time – cycle time to check for updates to the file
- always_search – flag to enable continuous searching, even when a file has been located in another instance
- autostart – flag to control autostart (if the all started flag is set, setting this to True will prevent the monitor thread from starting and require the user to start the thread manually)
-
acquiring
¶ whether acquiring is indicated in the target directory
-
classmethod
acquiring_instance
() → aghplctools.local_paths.AcquisitionSearch¶ retrieve the currently acquiring instance
-
classmethod
acquiring_instance_num_and_file
() → Tuple[int, pathlib.Path]¶ Retrieves the current number and file name of the currently acquiring path
Returns: sample number, sample path
-
acquiring_path
¶ path to the acquiring file
-
current_file
¶ currently acquiring file indicated in acquiring file
-
static
current_num_and_file
(path: Union[str, pathlib.Path]) → Tuple[int, str]¶ Returns the current number in the sequence and the name of the data file being acquired.
Parameters: path – path to parse Returns: current file number, current file name
-
current_number
¶ current acquiring number indicated in acquiring file
-
data_paths
= []¶
-
find_acquiring
() → Optional[pathlib.Path]¶ Locates ACQUIRING.TXT files in the directory. This file appears when ChemStation is acquiring a sequence. The search prioritizes newer subdirectories.
Returns: path to acquiring.txt (if found)
-
classmethod
get_by_path
(path: Union[str, pathlib.Path], always_search: bool = False, autostart: bool = True) → aghplctools.local_paths.AcquisitionSearch¶ Retrieves an instance by path. If the path is already being monitored, the existing instance is returned. Otherwise creates a new instance.
Parameters: - path – pathlike
- always_search – flag to enable continuous searching, even when a file has been located in another instance
- autostart – flag to control autostart (if the all started flag is set, setting this to True will prevent the monitor thread from starting and require the user to start the thread manually)
-
instances
= []¶
-
classmethod
kill_all_monitors
()¶ terminates all monitor threads
-
kill_monitor
()¶ cleanly terminates the monitor thread
-
newsorted_subdirectories
¶ subdirectories of the root path sorted by date modified in newest to oldest order
-
classmethod
parent_of_any_path
(path: Union[str, pathlib.Path]) → bool¶ Checks whether the provided path is a parent of any path instance.
Parameters: path – path to check Returns: parent of any path
-
parent_of_path
(path: Union[str, pathlib.Path]) → bool¶ Checks whether the provided path is a parent of the instance’s path. (The instance’s path is a subfolder of the provided path.
Parameters: path – pathlike Returns: provided path is parent
-
classmethod
sequence_is_running
() → bool¶ True if any acquisition search instance is aware of an acquiring flag file
-
start_monitor
()¶ starts the acquiring monitor thread
-
classmethod
start_monitoring_all_paths
()¶ starts the monitor thread on all data paths
-
subdirectories
¶ subdirectories of the root folder
-
classmethod
wait_for_acquiring
(timeout: float = None, cycle_time: float = 0.1) → Optional[aghplctools.local_paths.AcquisitionSearch]¶ Waits for the acquiring flag file to appear in registered instances. Once found, the acquiring instance is returned.
Parameters: - timeout – Optional timeout to prevent eternal waits
- cycle_time – cycle time for checks
Returns: acquiring instance once located
-
class
aghplctools.local_paths.
ChemStationConfig
(data_path: Union[str, pathlib.Path] = None, core_path: Union[str, pathlib.Path] = None, method_path: Union[str, pathlib.Path] = None, sequence_path: Union[str, pathlib.Path] = None, version: str = None, number: int = None)¶ Bases:
object
A class for managing pathing attributes for ChemStation instances installed on the current system.
Parameters: - data_path – default data path for the installation
- core_path – core installation path (location of the “CORE” directory)
- method_path – path to methods
- sequence_path – path to sequences
- version – ChemStation version
- number – published ChemStation number
-
DEFAULT_INI_LOCATION
= 'C:\\ProgramData\\Agilent Technologies\\ChemStation\\ChemStation.ini'¶
-
classmethod
construct_from_env
(env_name: str = 'hplcfolder')¶ Constructs an instance from an environment variable name. If the environment variable is not set, no action is taken.
Parameters: env_name – environment variable name
-
classmethod
construct_from_ini
(ini_path: Union[str, pathlib.Path] = None) → List[aghplctools.local_paths.ChemStationConfig]¶ Constructs ChemStation config instances as defined in the provided INI file. If no INI is provided, the default ChemStation INI location will be used.
Parameters: ini_path – path to INI file location. The provided INI file is expected to have the structure used by ChemStation ini files. Returns: instances created via the ini
-
core_path
¶ path to the CORE installation folder
-
data_path
¶ path to the default data directory
-
classmethod
get_by_data_path
(path: Union[str, pathlib.Path]) → aghplctools.local_paths.ChemStationConfig¶ Retrieves an instance by its data path. If the data path is not associated with an instance, an error is raised.
Parameters: path – path to check for Returns: chemstation config instance
-
method_path
¶ path to the method save directory
-
registered_chemstations
= []¶
-
sequence_path
¶ path to the sequence save directory