Metadata-Version: 2.4
Name: escape-fel
Version: 0.1.2
Summary: Event Synchronous Categorisation And Processing Environment — event-based data framework for free-electron lasers
Author-email: Henrik Lemke <h.t.lemke@gmail.com>
License: Copyright (c) 2018 The Python Packaging Authority
        
        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/htlemke/escape-fel
Project-URL: Documentation, https://escape-fel.readthedocs.io
Project-URL: Repository, https://github.com/htlemke/escape-fel
Project-URL: Issues, https://github.com/htlemke/escape-fel/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: dask[array]
Requires-Dist: h5py
Requires-Dist: zarr
Requires-Dist: hickle
Requires-Dist: tqdm
Requires-Dist: rich
Requires-Dist: matplotlib
Requires-Dist: pandas
Dynamic: license-file

# escape
## _Event Synchronous Categorisation And Processing Environment_

**escape** is a Python framework for event-based data analysis at free-electron laser (FEL) facilities. It pairs raw measurement arrays with pulse IDs and scan metadata, providing index-aligned arithmetic, scan-step aggregation, and scalable storage — designed for the data volumes and workflows typical at instruments like SwissFEL Bernina.

## Core concepts

- **`Array`** — wraps a data array together with a pulse-ID index and optional scan grouping. Index-aligned arithmetic between arrays is automatic: operations find common pulse IDs and align data before computing.
- **`Scan`** — partitions an Array into sequential steps with parameter metadata (e.g. delay values). Exposes per-step statistics (`nanmean`, `median`, `weighted_stat`, …) directly.
- **`Grid`** — maps scan steps onto an N-dimensional parameter grid, enabling multi-dimensional scans and 2D result arrays.
- **`DataSet`** — named collection of Arrays backed by HDF5 (`.esc.h5`) or zarr (`.esc.zarr`) files for persistent storage.
- **`escaped`** — decorator that lifts any NumPy/dask function to operate on Arrays with automatic index alignment.

## Quick example

```python
import escape as esc
import numpy as np

# Load a dataset
ds = esc.DataSet.load("run042.esc.h5")
sig  = ds["JF_signal"]
i0   = ds["I0_monitor"]
pump = ds["pump_on"]

# Normalize signal to I0 — pulse IDs aligned automatically
sig_norm = sig / i0

# Per-step median across the pump-probe scan
median_on  = sig_norm[pump].scan.nanmedian()
median_off = sig_norm[~pump].scan.nanmedian()
```

## Installation

**conda** (recommended — reuses existing environment packages):
```bash
conda install -c conda-forge escape-fel
```

**pip:**
```bash
pip install escape-fel
```

**Latest development version:**
```bash
pip install git+https://github.com/htlemke/escape-fel
```

## Documentation

Full documentation including user guide and API reference:
**[escape-fel.readthedocs.io](https://escape-fel.readthedocs.io)**

## Links

- [Documentation](https://escape-fel.readthedocs.io)
- [Source code](https://github.com/htlemke/escape-fel)
- [Issue tracker](https://github.com/htlemke/escape-fel/issues)
- [PyPI](https://pypi.org/project/escape-fel)
