Skip to main content

Analyzing experimental chemistry data

Project description

Chem Analysis

Your one-stop shop for analyzing chemistry data.

This package was developed for general chemistry data analysis, but special attention was paid to analyze large data sets (example: analyzing 1000 NMR at once).

Design Philosophy:

  • Handle large data sets
    • Support analyzing 1000s of NMR at once. (like those generated from kinetic analysis)
  • Modular
    • Be able to turn on or off or switch out processing or analysis methods with minimal code change
  • Explict
    • Alot of analytic software automatically perform data transforms and hide this from the user making it hard to truly know what's going on with your data. Here everything needs to be called explicitly, but typical processing steps are suggested in several of the examples.

Support data types:

  • IR
  • NMR (Bruker, Spinsolve) - 1D only
  • SEC (GPC)
  • GC and LC/HPLC/UPLC
  • Mass Spec. and GC-MS
  • UV-Vis (coming soon)

Installation

pypi page

pip install chem_analysis

Dependencies

Required

Optional

Capabilities

Processing Methods:

  • Baseline correction
  • Peak Picking
  • Resampling
  • Translations
  • Smoothing
  • Phase correction (NMR)
  • Referencing (NMR)
  • Chromatogram Library Matching (GC, LC/HPLC/UPLC)
  • Mass Spec Library Matching (MS, GC-MS)
  • And more ...

Analysis Methods:

  • Peak picking
  • Integration
  • Peak fitting
  • Deconvolution (peaks and MS spectra)
  • Multi-component analysis (MCA)
  • And more ...

Plotting / GUI

  • Matplotlib
    • Popular Python Plotting Library
  • Plotly
    • Provides interactive plots (html)
    • Zoom in/out is a game changer
  • PyQt
    • Uses GPU for rendering.
    • Good for lots of data!!

Plotting is hard and everyone has their preferences. The goal of plotting in this package if to provide quick and useful views of the data with useful defaults. It does not strive for perfect looks or full customization.

Quick Examples

See [Examples folder] for a large list.

import pathlib
import plotly.graph_objs as go
import chem_analysis as ca


def main():
    cal_RI = ca.sec.ConventionalCalibration(lambda time: 10 ** (-0.6 * time + 10.644),
                                    mw_bounds=(160, 1_090_000), name="RI calibration")

    # loading data
    file_path = pathlib.Path(r"data//SEC.csv")
    sec_signal = ca.sec.SECSignal.from_csv(file_path)
    sec_signal.calibration = cal_RI

    # processing
    sec_signal.processor.add(
      ca.processing.baseline.ImprovedAsymmetricLeastSquared(lambda_=1e6, p=0.15)
    )

    # analysis
    peak = ca.analysis.peak_picking.find_peak_largest(sec_signal,
                                                      mask=ca.processing.weigths.Spans((10, 12.2), invert=True)
                                                      )
    result = ca.analysis.integration.rolling_ball(peak, n=45, min_height=0.05, n_points_with_pos_slope=1)

    # plotting
    fig = go.Figure(layout=ca.plotting.PlotlyConfig.plotly_layout())
    ca.plotting.signal(sec_signal, fig=fig)
    ca.plotting.calibration(cal_RI, fig=fig)
    ca.plotting.peaks(result, fig=fig)
    fig.data[0].line.color = "blue"  # customize colors
    fig.data[4].fillcolor = "gray"  # customize colors
    # fig.show()
    fig.write_html('figs/sec_data_analysis.png')

    # print results
    print(result.stats_table().to_str())


if __name__ == '__main__':
    main()
peak area ...** mw_d mw_n
0 2.7 ... 1.218 7465

**Only showing 4 of 28 stats calculated for SEC peak

sec_data_analysis.png

Contributing

Let's be honest, that are bugs in the code! Pointing them out are much appreciated, and solutions are double appreciated!

Got a new data type, new algorithm, analysis, etc.? New contributions are welcomed!
Best practice is to open an issue with your idea, and I will let you know if it is a good fit for the project. If you are interested in helping code the addition please mention that as well.

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

chem_analysis-0.0.7.tar.gz (153.5 kB view details)

Uploaded Source

Built Distribution

chem_analysis-0.0.7-py3-none-any.whl (240.1 kB view details)

Uploaded Python 3

File details

Details for the file chem_analysis-0.0.7.tar.gz.

File metadata

  • Download URL: chem_analysis-0.0.7.tar.gz
  • Upload date:
  • Size: 153.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for chem_analysis-0.0.7.tar.gz
Algorithm Hash digest
SHA256 12a12ab5d6d94e7cb6c7309eec36a6e8397819b959d1b437269683b3f4839de3
MD5 f9415f16403a7adefb668afb14d97d80
BLAKE2b-256 f6c306cc303990da7925bcb958d25f93a81018a3221f3c121b93879fd4475970

See more details on using hashes here.

File details

Details for the file chem_analysis-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for chem_analysis-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 171e284c97440e1c8d8f15d606d6ca00b5a2990e913fe5c09074a0c8cbb7dcd0
MD5 ae494f2286e5c188649d8e3576d8b257
BLAKE2b-256 aa04c6e318263d8efe96d147ce8bf4a85aeb23402d7170f4477016647ace2ec2

See more details on using hashes here.

Supported by

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