Metadata-Version: 2.3
Name: pyphotomol
Version: 1.0
Summary: Python package to analyse mass photometry data
Author: Osvaldo Burastero
Author-email: Osvaldo Burastero <oburastero@gmail.com>
Requires-Dist: h5py>=3.14.0
Requires-Dist: kaleido>=1.0.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: numpy>=2.0.2
Requires-Dist: pandas>=2.3.1
Requires-Dist: plotly>=6.2.0
Requires-Dist: pytest[dev]>=9.1.0
Requires-Dist: scipy>=1.13.1
Requires-Dist: pytest>=7.0.0 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0 ; extra == 'dev'
Requires-Dist: coverage-badge>=1.1.0 ; extra == 'dev'
Requires-Dist: black>=23.0.0 ; extra == 'dev'
Requires-Dist: flake8>=6.0.0 ; extra == 'dev'
Requires-Dist: jupyter>=1.0.0 ; extra == 'dev'
Requires-Dist: notebook>=6.0.0 ; extra == 'dev'
Requires-Dist: ipykernel>=6.29.5 ; extra == 'dev'
Requires-Dist: sphinx>=9.1.0 ; extra == 'dev'
Requires-Dist: sphinx-rtd-theme>=3.1.0 ; extra == 'dev'
Requires-Dist: sphinx-design>=0.7.0 ; extra == 'dev'
Requires-Dist: numpydoc>=1.10.0 ; extra == 'dev'
Requires-Dist: nbsphinx>=0.9.7 ; extra == 'dev'
Requires-Dist: sphinx-copybutton>=0.5.2 ; extra == 'dev'
Requires-Dist: sphinx-tabs>=3.4.0 ; extra == 'dev'
Requires-Dist: sphinx>=9.1.0 ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=3.1.0 ; extra == 'docs'
Requires-Dist: sphinx-design>=0.5.0 ; extra == 'docs'
Requires-Dist: numpydoc>=1.6.0 ; extra == 'docs'
Requires-Dist: nbsphinx>=0.9.7 ; extra == 'docs'
Requires-Dist: sphinx-copybutton>=0.5.0 ; extra == 'docs'
Requires-Dist: sphinx-tabs>=3.4.0 ; extra == 'docs'
Requires-Dist: pytest>=7.0.0 ; extra == 'test'
Requires-Dist: pytest-cov>=4.0.0 ; extra == 'test'
Requires-Python: >=3.12
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: test
Description-Content-Type: text/markdown

# PyPhotoMol

[![Tests](https://github.com/osvalB/pyphotomol/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/osvalB/pyphotomol/actions/workflows/ci-cd.yml)
[![codecov](https://codecov.io/gh/osvalB/pyphotomol/graph/badge.svg)](https://codecov.io/gh/osvalB/pyphotomol)
[![Docs](https://img.shields.io/badge/docs-online-blue)](https://osvalb.github.io/pyphotomol)

Welcome to PyPhotoMol, a python-package to analyse mass photometry data.

## Features

- **Data Import**: Import HDF5 (.h5) and csv mass photometry data files, generated by Refeyn instruments (https://refeyn.com).
- **Histogram Analysis**: Create histograms of mass or contrast distributions
- **Peak Detection**: Automated peak finding in histograms using peak height, distance and prominence
- **Mass-Contrast Conversion**: Convert between mass and contrast with calibration parameters
- **Gaussian Fitting**: Fit multiple Gaussians to the histogram data
- **Comprehensive Logging**: Track all operations with logbooks

## Installation

PyPhotoMol requires Python 3.12 or later.

Install PyPhotoMol from PyPI with pip:

```bash
pip install pyphotomol
```

Verify the installation:

```python
import pyphotomol
print(pyphotomol.__version__)
```

For development, clone the repository and install with `uv`:

```bash
git clone https://github.com/osvalB/pyphotomol.git
cd pyphotomol
uv sync --extra dev
```

Run tests and build the documentation:

```bash
uv run pytest
uv run build_docs.py
```

## Quick Start

```python
from pyphotomol import PyPhotoMol

# Create a new analysis instance
model = PyPhotoMol()

# Import data from an HDF5 file
model.import_file('data.h5')

# Create a histogram and detect peaks
model.create_histogram(use_masses=True, window=[0, 1000], bin_width=10)
model.guess_peaks(min_height=10, min_distance=4, prominence=4)

# Fit Gaussian models to detected peaks
model.fit_histogram(
    peaks_guess=model.peaks_guess,
    mean_tolerance=200,
    std_tolerance=300
)

# Create and view results
model.create_fit_table()
print(model.fit_table)
```

## Acknowledgements

PyPhotoMol is derived from PhotoMol, an online tool presented in the following publication: 

Niebling, Stephan, et al. "Biophysical Screening Pipeline for Cryo-EM Grid Preparation of Membrane Proteins." Frontiers in Molecular Biosciences 9 (2022): 903148.


