semvec/pypi-packages huggingface dataset:
lifetimefitting 0.0.30
PicoHarp TCSPC lifetime fitting tool
Requires Python: >=3.8

# LifetimeFittingTool
This is a quick tool I wrote to take some of my TCSPC fluorescence lifetime fitting tools from [spectraImport.ipynb](https://github.com/adreasnow/excided-state-notebooks/blob/main/spectraImport.ipynb) and make them usable for other people. It can read PicoHarp .phd files thanks to [adreasnow/picoharp-phd](https://github.com/adreasnow/picoharp-phd) and also reads the plain `.txt` output it can save.

![screenshot](screenshot.png)

The app itself is a basic least squares regression tool but allows you to fit in linear or logarithmic space, supports up to 4 decays, and can export images as well as .csv files of the fitted histograms

## Installing

### PyPi

The easiest way to get it is to install it directly from pypy, so as too pull all the dependencies:

```python
pip install lifetimefitting
```

### Manually

* Python (I'm not sure how old you could go, but I know it runs on >3.9)
* Matplotlib
* Numpy
* PyQt6
* Scipy

These can be installed pretty easily via pip

```bash
pip install matplotlib numpy scipy pyqt6
```

or conda

```bash
conda install matplotlib numpy scipy pyqt6
```

Then you can clone the module down and install it manually

```bash
git clone https://github.com/adreasnow/LifetimeFittingTool.git
cd LifetimeFittingTool
python setup.py install
```

## Usage

To run the app, all you need to do is execute the module in python and a QT window should appear :)

```bash
python -m lifetimefitting
```



## The Maths

Uses the form of the function:

$$
fl(t)=I_0 exp\bigg(-\frac{t}{\tau}\bigg)
$$

Where:
* $t =$ Time
* $\tau =$ Fluorescence lifetime
* $I_0 =$ Initial photon concentration

For the corrected fitting procedure, the convolved function is calculated as:

$$
fl=fl(t)_{IRF}\otimes fl(t)
$$

$$
fl_{fitted}=\sum_{i=1}^{\text{exponents}} C_i\cdot fl(t)_i
$$

Where:
* $fl(t)_{IRF} =$ Fitted instrument response function
* $fl(t)_i =$ Fitted function for each decay
* $C_i =$ Linear coefficient for each decay

$\chi^2$ is calculated as per [fluortools](http://www.fluortools.com/software/decayfit/documentation/fit)

$$
\chi^2 = \sum_{j=1}^{n} (c_j-\hat{c_j})^2/\hat{c_j}\\
\chi^2_{red}=\frac{\chi^2}{n}
$$
pyfirebasehandler 1.0.0
A Python module for handling a Firebase database

Certainly! Here's an example `README.md` file for your module:

```markdown
# pyfirebasehandler

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Your Module is a Python module for handling a Firebase database using the `firebase-admin` library.

## Installation

You can install Your Module using pip:

```shell
pip install pyfirebasehandler
```

Make sure you have the `firebase-admin` library installed as well.

## Usage

```python
from pyfirebasehandler.firebase_handler import FirebaseHandler

# Initialize FirebaseHandler with credentials
handler = FirebaseHandler('path/to/credentials.json')

# Create a document
data = {'name': 'John Doe', 'age': 30}
document_id = handler.create_document('users', data)

## for creating a document with a custom reference
document_id = handler.create_document('users', data, custom_ref="id01")
print(f"Created document with ID: {document_id}")

# Retrieve a document
document_data = handler.get_document('users', document_id)
print(f"Retrieved document data: {document_data}")

# Retrive list of documents from a collection
collection_data = handler.read_collection('users')
print(f"Retrieved list of collection data: {document_data}")

# Update a document
updated_data = {'age': 31}
handler.update_document('users', document_id, updated_data)
print("Document updated successfully")

# Delete a document
handler.delete_document('users', document_id)
print("Document deleted successfully")
```

Replace `'path/to/credentials.json'` with the actual path to your Firebase service account credentials JSON file.

## Tests

To run the tests for Module, execute the following command:

```shell
python -m unittest tests.test_firebase_handler
```

Make sure you have the necessary test credentials for your Firebase database.

## License

This project is licensed under the terms of the MIT License. See the [LICENSE](LICENCE) file for details.
```
MIT License

Copyright (c) 2023 pyfirebasehandler

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.
```
phdimporter 0.0.3
PicoHarp .PhD file importer
Requires Python: >=3.6

# PicoHarp 300 TCSPC .phd file loader

This module was written to be able to read in `.phd` photon time histograms from the PicoHarp software.

The layout of the file is as documented in the [PicoHarp 300 manual](http://ridl.cfd.rit.edu/products/manuals/PicoQuant/PicoHarp%20300%20v2.3/manual/Manual.pdf) in section 8.2.1 (pages 56-58).

Both of these are easy to modify, however the scope of this projec tis limited to our usage case.

The module also loads `.txt` files which are the copy-pasted data from the PicoHarp software. This is primary way our research group has extracted data in the past, so it makes sense to keep the functionality alive.

For our friends at the University of Saskatchewan, I've also added `.asc` file loading.

## Installation

```bash
pip install phdimporter
```

## Usage

The module only uses one `struct` import and contains one class of importance, `TRF`.

```python
from phd import TRF

trf = phd('path/to/file/.phd')
## or
trf = phd('path/to/file/.txt')
```

The most simple way to return the histogram data is to:

```python
x = trf.x # bins in ns
y = trf.y # counts/bin
```

It is possible to pull raw data out from the .phd file since it's all stored in the `TRF` object, however I'm not going to document this as the variables share the same names as in the PicoHarp manual, and are easily seen in phd.py.

## Not Implemented

The importer has been written with a couple of limitations in mind that are based on our usage:

* Assumes only one histogram per file
* Assumes only one PicoHarp device on the machine

The only variable I haven't implemented is the acquisition time, as the computer that we use is not internet connected and the clock is always off, and I'm also not sure how to interpret the `time_t` data type that the variable is stored in.