- Notifications
You must be signed in to change notification settings - Fork1
Command line tool for parsing and processing UV-Vis data from the Agilent 845x Chemstation software.
License
dd-hebert/uv_pro
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
uv_pro
is a feature-rich command line tool for processing UV-Vis data files (.KD format) created from the Agilent 845x UV-Vis Chemstation software.
- Installation
- Command Line Interface
- Command Line Arguments
- Examples
- File Paths & Root Directory
- Multiview Mode
- Uninstall
Clone this repo and usesetuptools andbuild to build the package (python -m build
) then use pip to install the resulting.whl
file.
Withuv_pro
installed, you can run the script directly from the command line using theuvp
shortcut. To begin processing data, usep
and specify the path to your data:
uvp p path\to\your\data.KD
Tip: You can use shorter paths by setting aroot directory or by simply opening a terminal session inside the same directory as your data files.
- Data Processing Args (process, proc, p)
- Batch Exporting Args (batch)
- Peak Detection Args (peaks)
- Binary Mixture Fitting Args (binmix)
- User Config Args (config, cfg)
- Other Args
Process UV-vis data with theprocess
subcommand.
Usage:uvp process <path> <options>
,uvp proc <path> <options>
, oruvp p <path> <options>
The path to a .KD file. You have three options for specifying the path: you can use apath relative to the current working directory, anabsolute path, or apath relative to the root directory (if one has been set). A path is not required if using `--list-colormaps``.
Set the smoothness of the baseline (for outlier detection). Higher values give smoother baselines. Try values between 0.001 and 10000. The default is 10. Seepybaselines.whittaker.asls() for more information.
Set the exit criteria for the baseline algorithm. Try values between 0.001 and 10000. The default is 0.1. See pybaselines.whittaker.asls() for more information.
Set the colormap for the processed spectra plot. Accepts any built-in Matplotlib colormap name. SeeMatplotlib colormaps for more information on colormap options. Default is 'default'.
Perform an exponential fitting of time traces. You must specify the wavelengths to fit with the-tt
argument.
List available colormaps and exit (path not required).
Set the width of the low signal outlier detection window. Set towide
if low signals are interfering with the baseline. The default isnarrow
. If set tonone
, low signal outlier detection is skipped. This is useful when processing spectra with very low absorbance across a majority of measured wavelengths.
Bypass the data export prompt at the end of the script.
The threshold by which spectra are considered outliers. Values closer to 0 will produce more outliers, while values closer to 1 will produce fewer outliers. A value of 1 will produce no outliers. The default value is 0.1.
Generate (and optionally export) a quick figure with a custom plot title and other settings.
Reduce the dataset down to a number of equally-spaced "slices". Example: if a dataset contains 250 spectra and-sl
is 10, then every 25th spectrum will be plotted and exported. The default isNone
, whereall spectra are plotted and exported (no slicing).
Select spectra slices at specific times. The default isNone
, whereall spectra are plotted and exported (no slicing).
Remove spectra outside a given time range. The first integer is the beginning of the time range and the second integer is the end.
# Trim before 50 seconds and after 250 secondsuvp p C:\\Desktop\\MyData\\myfile.KD -tr 50 250
Get time traces for the specified wavelengths. These time traces are independent from the time traces used for outlier detection.
Set the time trace wavelength interval (in nm). An interval of 20 would create time traces like: (window min, window min + 20, ... , window max - 20, window max). Smaller intervals may result in increased loading times. Default is 10. These time traces are used for outlier detection.
Set the time trace wavelength range (min, max) (in nm). The default is (300, 1060). These time traces are used for outlier detection.
Enableview-only mode. No data processing is performed and a plot of the data is shown.
Reduce the dataset down to a number of unequally-spaced "slices". Takes two float valuescoefficient
andexponent
. The step size between slices is calculated by the formulastep_size = coefficient*x^exponent + 1
. This option allows you to create slices with progressively changing intervals, based on the power function defined by the coefficient and exponent. This slicing mode is ideal when there are rapid changes in absorbance at the beginning or end of the experiment, such as a fast decay.
Use a small coefficient (<=1) and positive exponent (>1) when slicing spectra that change rapidly in the beginning and slowly at the end. Large coefficients (>5) and negative exponents (<-1) work best for spectra that change slowly in the beginning and rapidly at the end. The default isNone
, whereall spectra are plotted or exported (no slicing).
Batch export UV-vis data from .KD files in the current working directory. Currently, only batch exporting of time traces is supported.
Usage:uvp batch <wavelengths> <options>
A list of time trace wavelengths (in nm) to export.
A sequence of search filter strings. For example, passing-f copper A
will select .KD files which contain 'copper' OR 'A' in their filename. Passing no filters selects all .KD files in the current working directory.
Find peaks in UV-vis spectra with thepeaks
subcommand.
Usage:uvp peaks <path> <options>
A path to a UV-vis Data File (.KD format).
The molar concentration of the species in the spectrum. Used for calculating molar absorptivity (ε). Default is None.
Set the minimum distance between peaks (in nm). Default is 10. Only used withlocalmax
method.
The max number of peak finding iterations. The default is 1000. Only used withlocalmax
method.
The peak detection method: eitherlocalmax
orderiv
. Default islocalmax
.
The number of peaks that should be found. Default is 0 (find all peaks). Only used withlocalmax
method.
Set the minimum peak prominance. Default is 0. Only used withlocalmax
method.
Set the (min, max) peak detection window (in nm). Search for peaks within the given wavelength range. Default is None (search whole spectrum).
Set the Savitzky-Golay smoothing window. Default is 15. Seescipy.signal.savgol_filter() for more information.
Estimate the relative concentrations of two species in a binary mixture with thebinmix
subcommand.
Usage:uvp binmix <path> <component_a> <component_b> <options>
Path to a UV-vis data file (.csv format) of one or more binary mixture spectra.
Path to a UV-vis spectrum (.csv format) of pure component "A".
Path to a UV-vis spectrum (.csv format) of pure component "B".
Specify the concentration (in M) of pure component "A".
Specify the concentration (in M) of pure component "B".
Specify the columns of the binary mixture .csv file to perform fitting on. Provide the label (header) for each column. Default is None (fit all columns).
Specify the columns of the binary mixture .csv file to perform fitting on. Provide the index for each column. Default is None (fit all columns).
Set the range of wavelengths (in nm) to use from the given spectra for fitting. Default is (300, 1100).
Enable interactive mode. Show an interactive matplotlib figure of the binary mixture fitting.
View, edit, or reset user-configured settings with theconfig
subcommand.
Usage:uvp config <option>
oruvp cfg <option>
Current user-configurable settings:root_directory
- A base directory which contains UV-vis data files. Set a root directory to enable the use of shorter, relative file paths.plot_size
- The size of the 2-by-2 plot shown after data processing. Two integers:WIDTH HEIGHT
Delete the config file and directory. The config file is located in.config/uv_pro/
inside the user's home directory.
Edit configuration settings. Will prompt the user for a selection of configuration settings to edit.
Print the current configuration settings to the console.
Reset configuration settings back to their default value. Will prompt the user for a selection of configuration settings to reset.
Other miscellaneous args and subcommands.
Use-h
to get help with command line arguments. Get help for specific commands withuvp <command> -h
.
Interactively pick a .KD file from the terminal. The file is opened inview-only mode. The file must be located somewhere inside the root directory. Usage:uvp browse
oruvp br
.
Print the root directory file tree to the console. Usage:uvp tree
.
Process the data inmyfile.KD
, set the outlier detection to 0.2, trim the data to keep the spectra from 50 seconds to 250 seconds, and show 10 slices:
uvp p C:\\Desktop\\myfile.KD -tr 50 250 -ot 0.2 -sl 10
Process the data insomefile.KD
, trim the data to keep the spectra from 20 seconds to 120 seconds, show 15 slices, get time traces for 390, 450, 670 nm, and fit an exponential function to the specified time traces:
uvp p C:\\Desktop\\data\\somefile.KD -tr 20 120 -sl 15 -tt 390 450 670 -fx
uv_pro
is flexible in handling file paths. When you give a path at the terminal, you can provide a full absolute path:
uvp p C:\full\path\to\your\data\file.KD
Alternatively, you can open a terminal session inside a directory containing a data file and use a relative path:
# Current working directory = C:\full\path\to\your\datauvp p file.KD
Setting a root directory can simplify file path entry. For instance, if you store all your UV-Vis data files in a common folder, you can designate it as the root directory. Subsequently, any path provided withprocess
can be given relative to the root directory.
Without root directory:
# Must type full file pathuvp p "C:\mydata\UV-Vis Data\mydata.KD"
Without a root directory, you must type the full path"C:\mydata\UV-Vis Data\mydata.KD"
to the data.
With root directory:
# Set the root directory.uvp config -edit# Select the root directory setting and enter the desired path, for example:"C:\mydata\UV-Vis Data"# Now, a shorter relative path can be used.uvp p mydata.KD
With a root directory set, for example"C:\mydata\UV-Vis Data"
, you can omit that part of the path and just give a relative pathmydata.KD
. The root directory is saved between runs in a config file.
You can open multiple .KD files (inview-only mode) simultaneously with themultiviewer
subcommand. Navigate to a directory containing .KD files and run the command:
uvp mv -f some search filters
The script will open .KD files which contain any of the supplied search filters inview-only mode. You can omit the-f
argument to openall .KD files in the current working directory.
The default search behavior is anOR search. You can use the-a
or--and-filter
argument to perform anAND search:
uvp mv -f some search filters -a
Now only .KD files with containall of the search filters in their name will be opened.
Examples:
uvp mv -f copper DMF
OR search, open .KD files withcopper
ORDMF
in their filename.
uvp mv -f copper DMF TEMPOH -a
AND search, open .KD files withcopper
,DMF
,ANDTEMPOH
in their filename.
To uninstalluv_pro
, run the following command:
pip uninstall uv_pro
Uninstallinguv_pro
does not delete its config file. To delete the config file, first run:
uvp config -delete
Before uninstalling the package with pip.
About
Command line tool for parsing and processing UV-Vis data from the Agilent 845x Chemstation software.