A GUI tool for drawing polynomial backgrounds on FTIR spectra and subtracting them to get total absorbance (by height) of a desired peak.
Project description
ftir-background-subtract
README FOR FTIR BACKGROUND SUBTRACT TOOL Copyright Nial Peters & Kayla Iacovino, 2021
Version 1.2.0 Released September 2, 2021 Contact: kaylaiacovino@gmail.com
RUNNING THE SCRIPT: Make sure you have the correct dependencies installed before running the script: Python wxPython matplotlib pylab numpy
Navigate to the directory where bkgd_subtract.py is located. Type "python bkgd_subtract.py" into a terminal. If you have all the dependencies installed properly, it should run the program.
USING THE PROGRAM: Chose your file in the file chooser window. Your spectrum file should be two columns with wavenumber and absorbances (see the example file test-spectrum.CSV).
Use the red and green sliders to set the boundaries over which a polynomial will be fit to your spectrum. Everything within the green sliders will be included in the fit. Everything within the red sliders will be excluded from the fit. The standard approach is to place the red sliders just outside of the peak of interest and set the green sliders to include as much background as possible corresponding to that peak. Once you have chosen your slider positions, click "Apply". Clicking apply will first find the limits set by your sliders and then calculate a background polynomial. The polynomial will then be shown in the second plot (blue points are points used in the fitting; red points are those that could not be fit and were excluded from the fitting). The background-subtracted portion of your spectrum will be shown in the bottom plot. Hover your mouse over the peak to get the y-value.
The four buttons labelled "3500", "CO3", "4500", "5200", and "CO3 (2)" will suggest placement of the sliders for various parts of the spectrum. If using the suggested limits, do not click "Apply", which will read the positions of the limits shown by the sliders. Instead use "Apply suggested", which instead applies the values in the text boxes.
The "Get Limits" button will find the values of the sliders and put them into the limit text boxes. Limits can also be typed in manually. You do not need to click "Get Limits" before clicking "Apply".
The Fit Order is the order of the polynomial. We suggest using fit orders from 1-5.
THE PLOTS: There are three plots shown: (1) Your data [top]; (2) The fit to your data [center]; (3) The background-corrected data [lower].
The top plot contains the data loaded from your CSV file and should never be blank. Upon opening the program, the central and lower plots will be blank. Once a background is drawn, the central and lower plots will be populated.
A NOTE FOR MAC USERS: For some reason, the standard matplotlib toolbar (containing such useful features as zoom, pan, save image) does not appear on Mac. You can use standard marplotlib keyboard shortcuts to get around this:
Home/Reset h or r Back c or left arrow or backspace Forward v or right arrow Pan/Zoom p Zoom-to-rectangle o Save s Toggle fullscreen f Constrain pan/zoom to x axis hold x Constrain pan/zoom to y axis hold y Preserve aspect ratio hold CONTROL Toggle grid g Toggle y axis scale (log/lin) l
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
File details
Details for the file FTIR-background-subtract-1.2.0.tar.gz
.
File metadata
- Download URL: FTIR-background-subtract-1.2.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86478d28681fc731004f9c332c73abadbf0ba7252ab88eed30476cd4dcbd144c |
|
MD5 | 6db8d55e57b219f2b49a9b7db5bb43d7 |
|
BLAKE2b-256 | 557cc7a54890979225ba758467064fdc4829eae47c8c4a3e962cfa164acec362 |
File details
Details for the file FTIR_background_subtract-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: FTIR_background_subtract-1.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a56b86d42aa5d210737b009533359ef62519c139ecd371fe01bccda3d8793fdd |
|
MD5 | 149eb7027344f16a4d59cb3391a80781 |
|
BLAKE2b-256 | de10e120309d0832c0dfa1c585bf6f40cb6bdb4ae560302670160f6b143038d6 |