Python library for analyzing and visualizing SSLS SUV Beamline data.
Project description
SUV Tools
Visit the project homepage https://pranabdas.github.io/suvtools/
Quick start
Install latest stable release:
pip3 install --upgrade suvtools
Import suvtools into your project:
import suvtools as suv
Modules:
-
suv.load("datafile.txt", scan=None)
: It will return a two dimensional array with columns for various parameters. If the second argument, i.e., the scan number is not specified, the code will read the last scan from the file. -
suv.fit_gauss(x, y, a=None, x0=None, sigma=None, xmin=None, xmax=None, num=1000)
: returns x, Gaussian fitted y values, and prints out relevant parameters.xmin
andxmax
determines the range to fit. Ifxmin
andxmax
are not provided, whole range is used.num
determines the number of points returned inx_fit
andy_fit
. -
suv.fit_lorentz(x, y, a=None, x0=None, gamma=None, xmin=None, xmax=None, num=1000)
: returns x, Lorentzian fitted y values, and prints out relevant parameters.xmin
andxmax
determines the range to fit. Ifxmin
andxmax
are not provided, whole range is used.num
determines the number of points returned inx_fit
andy_fit
. -
suv.save_csv("datafile.txt", csvname=None, scan=None)
: saves scan to a csv file. The file will be saved in the save directory asdatafile
with namedatafile.csv
unlesscsvname
is specified. Like theload
module, if the scan number is not specified, it will read the last scan from the file. -
suv.norm_bg(energy, intensity, x1, x2, x_norm_loc=None)
: Removes linear background, and normalizes the data. x1, x2 are energy values that determines the slope of the background. By default the normalization done at the tail point of the spectra. It can be changed to other point, enter the corresponding energy value. The intention is to normalize at an energy value away from the peaks/features of interest. -
suv.lock_peak(data, refdata, x1=None, x2=None, E_col=0, I_col=9, I0_col=4)
: Locks peak position with respect to the reference data. It locks the maximum of intensity to the same energy; the range of peak search can be specified by inputx1
andx2
. If no bounds are given, it will find the maximum in the whole data range. -
suv.calc_area(y, x, x_start=None, x_end=None)
: Calculates area under the curve for givenx
andy
values.x_start
andx_end
can be specified to set the limit of integration region, if not provided whole range is integrated.
See the notebook and documentation for example usage.
Documentation development
# install npm packages
npm install
# serve locally
npm start
# build
npm run build
Python tests
python3 -m unittest discover tests
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 suvtools-1.0.1.tar.gz
.
File metadata
- Download URL: suvtools-1.0.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c79ad54825116e1073507707cac8fb5b39e69a1583aa6770f0db7c7f3db75f49 |
|
MD5 | e4f512946e01787bf5c1ebdf861d294a |
|
BLAKE2b-256 | 05953d34077279103fc322b59699da9f65daf5e71138dc7c18a3a611f2b2954c |
File details
Details for the file suvtools-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: suvtools-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aa8bbf5b1a4e7092559888b57323025b64d76a0e09685768cd019abf0dba422 |
|
MD5 | cea0b3a7900a3ba19e8cdacc074477ea |
|
BLAKE2b-256 | efb56014d6f042b68a8401e3f77060ee296bbeb08200825403d4b39337d55af6 |