Skip to main content

Python library for analyzing and visualizing SSLS SUV Beamline data.

Project description

SUV Tools

Python tests status Deploy gh-pages status Deploy gh-pages status Latest Release Supported Python versions

Visit the project homepage https://pranabdas.github.io/suvtools/

Quick start

Install latest stable release:

pip 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 and xmax determines the range to fit. If xmin and xmax are not provided, whole range is used. num determines the number of points returned in x_fit and y_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 and xmax determines the range to fit. If xmin and xmax are not provided, whole range is used. num determines the number of points returned in x_fit and y_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 as datafile with name datafile.csv unless csvname is specified. Like the load 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 input x1 and x2. 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 given x and y values. x_start and x_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.

Python tests

python3 -m unittest discover tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

suvtools-1.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

suvtools-1.2.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file suvtools-1.2.0.tar.gz.

File metadata

  • Download URL: suvtools-1.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for suvtools-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5a4ea6c67e24d109f42c1916500b944088884727a60e3ae4441124c5a49cf196
MD5 f759b156918307f62feddd29801c3083
BLAKE2b-256 be7b6b31909597ba89f4ca538652d493f1c76c7e7486ba9dccb260d601d7a92e

See more details on using hashes here.

Provenance

The following attestation bundles were made for suvtools-1.2.0.tar.gz:

Publisher: publish.yml on pranabdas/suvtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file suvtools-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: suvtools-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for suvtools-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0791b1e7a85f9a70ca40a682e369288ee038ca6c09e7f7b1c5a61fbadb912e6
MD5 cf0654ff8eab3e0fb76cb802ae6070e9
BLAKE2b-256 5da8967d3388dba5bef85273716ed246bf80039b853eacc0c9ec6de76cd2afe1

See more details on using hashes here.

Provenance

The following attestation bundles were made for suvtools-1.2.0-py3-none-any.whl:

Publisher: publish.yml on pranabdas/suvtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page