Metadata-Version: 2.4
Name: spotfitlm
Version: 0.1.3
Summary: MLE 2D gaussian fitting with Poisson deviates
Author: Daniel Elnatan
License: MIT License
        
        Copyright (c) 2024 Daniel Elnatan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/delnatan/spotfitlm
Project-URL: Repository, https://github.com/delnatan/spotfitlm
Keywords: gaussian,fitting,microscopy,spot detection,MLE
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: tqdm
Dynamic: license-file

# spotfitlm

A small Python library for doing robust spot detection in 2D by (MLE) Gaussian fitting. The fitting is done through a small C library implementing a damped Gauss-Newton optimization algorithm (like Levenberg-Marquardt) algorithm. Error estimates (covariance) matrix of the fit parameters are computed from the (inverse of) full Hessian matrix. Currently, only a symmetric Gaussian fit is implemented.

The objective function being minimized is the same as Laurence & Chromy's MLE method [https://www.nature.com/articles/nmeth0510-338].

For spot detection, this package uses the algorithm from Danuser Lab's U-track MATLAB software. Specifically, the code from:
[https://github.com/DanuserLab/u-track3D/blob/9279b3784de64d29bb06c3693e99f2e5c064288e/software/pointSourceDetection.m#L111]

for doing the hypothesis testing on *significant* Gaussian peaks above background noise.

# Installation

This package is not yet released at PyPI so it can't be installed by a simple `pip install`, so you'll need to use `git` to install it to your Python environment:

For MacOS or Linux system make sure you have a c compiler accessible in your path. Windows installation is more complicated because I haven't figured out how to use the right compilers.

1) Clone this repository
```bash
git clone https://github.com/delnatan/spotfitlm.git
```

2) and go into the directory `spotfitlm` and run:
```bash
pip install -e .
```

# Windows installation

Unfortunately, I haven't had the time to work out installation procedure for Windows. You just need to compile the C library and put it in a place where the .dll file can be loaded via Python. In the past, I setup the compiler within a conda environment, and installed `m2w64-toolchain` via conda-forge channels. Then you'll have access to `gcc`. Since there are no dependencies, the library should compile fine. I intend to make a simple Makefile for doing this process to streamline the setup in Windows machine.
