<img src="https://raw.githubusercontent.com/labscript-suite/labscript-suite/master/art/lyse_32nx32n.svg" height="64" alt="the labscript suite – lyse" align="right">

# the _labscript suite_ » lyse

### Online analysis of live experiment data

[![Actions Status](https://github.com/labscript-suite/lyse/workflows/Build%20and%20Release/badge.svg?branch=maintenance%2F3.0.x)](https://github.com/labscript-suite/lyse/actions)
[![License](https://img.shields.io/pypi/l/lyse.svg)](https://github.com/labscript-suite/lyse/raw/master/LICENSE.txt)
[![Python Version](https://img.shields.io/pypi/pyversions/lyse.svg)](https://python.org)
[![PyPI](https://img.shields.io/pypi/v/lyse.svg)](https://pypi.org/project/lyse)
[![Conda Version](https://img.shields.io/conda/v/labscript-suite/lyse)](https://anaconda.org/labscript-suite/lyse)
[![Google Group](https://img.shields.io/badge/Google%20Group-labscriptsuite-blue.svg)](https://groups.google.com/forum/#!forum/labscriptsuite)
<!--[![DOI](http://img.shields.io/badge/DOI-10.1063%2F1.4817213-0F79D0.svg)](https://doi.org/10.1063/1.4817213)-->


**lyse** is a data analysis framework for experiments controlled by the [*labscript suite*](https://github.com/labscript-suite/labscript-suite). It coordinates online analysis of live experiment data, by automatically running Python analysis scripts.

Analysis routines are Python scripts that can be run on a labscript experiment ([HDF5](https://support.hdfgroup.org/HDF5/whatishdf5.html)) file. We break analysis into two distinct groups:

1. **single-shot analysis** routines analyze a single HDF5 file corresponding to one realization of an experimental sequence, or *shot*; and
2. **multi-shot analysis** routines perform higher-order analysis on data from many shots.

A set of Python scripts can be loaded for each analysis category, which will run (when appropriate) on new shot files as they are sent to lyse from [**blacs**](https://github.com/labscript-suite/blacs). Acquired data, global variables from [**runmanager**](https://github.com/labscript-suite/runmanager) and analysis results generated in lyse, for all loaded shots, are stored in a table (a [pandas `DataFrame`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html). This is a powerful analysis schema that takes advantage of the self-documenting nature of labscript experiment shot files.

The DataFrame is displayed in the lyse GUI and can also be accessed remotely from another PC as follows:

```python
import lyse
df = lyse.data(host='127.0.0.1', port=42519)
```

Moreover, the lyse DataFrame can be serialized so that an analysis session can be restored in lyse or in a headless environment.

<img src="https://bitbucket.org/repo/BMBAeq/images/4286820861-lyse_example.png" alt="lyse interface – screenshot">

The lyse interface, comprising:

- Single- and multi-shot analysis routines (Python scripts);
- A graphical representation of the Pandas DataFrame;
- Figures generated by the analysis scripts.†
- The output log from lyse and the analysis routines.

† In this example, these are publication quality figures generated for the manuscript *Science* **364**, pp. 1267 (2019) [doi:10.1126/science.aat5793](https://doi.org/10.1126/science.aat5793).


## Installation

lyse is distributed as a Python package on [PyPI](https://pypi.org/user/labscript-suite) and [Anaconda Cloud](https://anaconda.org/labscript-suite), and should be installed with other components of the _labscript suite_. Please see the [installation guide](https://docs.labscriptsuite.org/en/latest/installation) for details.
