Metadata-Version: 2.4
Name: trattoria-arrays
Version: 0.4.1
Summary: The fastest streaming algorithms for your TTTR data
License: MIT
Author: Guillem Ballesteros
Author-email: dev+pypi@maxwellrules.com
Requires-Python: >=3.12,<3.15
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: numpy (>=2.5.2,<3)
Requires-Dist: scipy (>=1.18,<2)
Requires-Dist: trattoria-core-arrays (>=0.5.1,<0.6.0)
Project-URL: Homepage, https://github.com/zak489/trattoria-arrays
Project-URL: Repository, https://github.com/zak489/trattoria-arrays
Description-Content-Type: text/markdown

# 🍕 Trattoria 🍕 + Arrays
In the spirit of the [original repository](https://github.com/GCBallesteros/trattoria), *Trattoria(+arrays)* delivers you the fastest streaming algorithms to analyze your TTTR data. 

While *Trattoria* supports the following algorithms with PTU files from PicoQuant:
- __Second order autocorrelations__: Calculate the autocorrelation between two channels of
  your TCSPC.
- __Third Order autocorrelations__: Calculate the coincidences between 3 channels. A sync
version is provided were it uses the fact that the sync channel is periodic and known.
- __Intensity time trace__: Calculate the intensity on each (or all) channels versus time.
- __Zero finder__: Given two uncorrelated channels (e.g. a laser behind a 50/50 splitter)
  compute the delay between the input channels.
- __Lifetime__: Compute the lifetime histogram from a pulsed excitation experiment.

*Trattoria-arrays* support  __Intensity time trace__ and __Second order autocorrelations__  functionality with raw timestamps in the form of two numpy arrays: 
1. Timestamps in the unit of ps
2. Corresponding channel list

## Installing
```
pip install trattoria-arrays
```

## Examples
For more details check the docstrings in `core.py`.
Check out the [example code for extracting the time trace and second-order correlation function.](examples/timetrace_g2_raw_timestamps.py).

## Design
Trattoria is just a very thin wrapper around the [trattoria-core-arrays](https://github.com/zak489/trattoria-core-arrays) library which itself provides a lower level interface to the[tttr-toolbox-arrays](https://github.com/zak489/tttr-toolbox-arrays) library. 
A Rust project that provides the compiled components that allows us to go fast.
They are modified from the original libraries with the aid of LLMs.
Please report any bugs you find as a result. 
Credit to G.C. Ballesteros for his fantastic work on developing these libraries. 
- [trattoria-core](https://github.com/GCBallesteros/trattoria-core)
- [tttr-toolbox](https://github.com/GCBallesteros/tttr-toolbox)

## Changelog
### 0.4.1
- Updated the readme.
- Added example scripts.
- Added an improved function for post-selection.


### 0.4.0
- Added the functionality to work with raw timestamps in the form of numpy arrays.
- Adapted such functionality with intensity time trace and second order correlation function.
- Tested with the timestamps generated from a Swabian .ttbin file.

### 0.3.5
- Bug fix. The last 1024\*16 where being ignored for performance reasons. This has
  has been fixed upstream in `tttr-toolbox` and this version of Trattoria uses the
  upgraded version of `trattoria-core`.
- `trattoria-core` dropped support for Python 3.6 and 3.7 and therefore Trattoria too.

### 0.3.4
- The g2 algorithm now supports a mode flag. With "symmetric" we use the
  prefered version of the algorithm that returns negative and positive delays.
  "asymmetric" returns only positive delays but is faster. Default is
  "symmetric".

### 0.3.3
- The underlying TTTR Toolbox and Trattoria Core were refactored to support
  multiple custom ranges or records at once. `start_range` and `stop_range`
  have disappeared in favor of `record_ranges`. It takes a list of tuples of
  integers or `None`.


## Citing


