Metadata-Version: 2.5
Name: avialsync
Version: 0.1.14
Summary: GUI desktop app to scrub time-synchronized multi-camera video and dense time series.
Project-URL: Homepage, https://github.com/anzalks/avialsync
Project-URL: Documentation, https://avialsync.readthedocs.io/
Project-URL: Source, https://github.com/anzalks/avialsync
Project-URL: Issues, https://github.com/anzalks/avialsync/issues
Project-URL: Changelog, https://github.com/anzalks/avialsync/releases
Author: Antoine Valera
Author-email: Anzal K Shahul <anzal.ks@gmail.com>
License: AGPL-3.0-or-later
License-File: LICENSE
Keywords: behaviour,electrophysiology,multi-camera,neuroscience,pose-estimation,synchronization,time-series,video
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Video :: Display
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: <3.13,>=3.11
Requires-Dist: aiohttp>=3.11
Requires-Dist: av>=12
Requires-Dist: c3d>=0.6.0
Requires-Dist: fsspec>=2025.3
Requires-Dist: h5py
Requires-Dist: neo
Requires-Dist: numpy
Requires-Dist: polars
Requires-Dist: pyqtgraph
Requires-Dist: pyside6<6.12
Requires-Dist: quantities>=0.16.3
Requires-Dist: scipy
Requires-Dist: tifffile>=2024.9.20
Requires-Dist: tzdata; sys_platform == 'win32'
Requires-Dist: xxhash
Requires-Dist: zarr<4,>=3.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: hypothesis; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pillow; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-benchmark; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest-qt; extra == 'dev'
Requires-Dist: pytest-timeout>=2.3; extra == 'dev'
Requires-Dist: pyyaml; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: twine==7.0.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: furo>=2024.1; extra == 'docs'
Requires-Dist: myst-parser>=2.0; extra == 'docs'
Requires-Dist: sphinx>=7.2; extra == 'docs'
Description-Content-Type: text/markdown

# AvialSync

**The Advanced Video and Instrument Alignment Library.**

[![PyPI](https://img.shields.io/pypi/v/avialsync.svg)](https://pypi.org/project/avialsync/)
[![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg)](https://pypi.org/project/avialsync/)
[![CI](https://github.com/anzalks/avialsync/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/anzalks/avialsync/actions/workflows/ci.yml)
[![Documentation](https://readthedocs.org/projects/avialsync/badge/?version=latest)](https://avialsync.readthedocs.io/en/latest/)
[![Licence](https://img.shields.io/badge/licence-AGPL--3.0-blue.svg)](LICENSE)
[![Platforms](https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)](https://github.com/anzalks/avialsync/releases)

AvialSync is a desktop viewer for looking through an experiment in time.

Use it when you have video from one or more cameras together with recordings such as sensors,
electrodes, behavioural tracking, or other time-stamped measurements. It places them on one shared
timeline so you can move to an event and inspect what each recording shows at that moment.

It exists for the case where **the video and the signal have to agree on the same instant**, and the
recordings came off independently-clocked hardware. It is built for visual inspection and careful
alignment: it does not acquire recordings, it does not analyse them for you, and it never silently
changes a scientific timestamp. Your lab can add support for its own file types and workflows
through plugins.

![A one-second loop of three synchronised camera views of a head-fixed mouse with 2D pose overlays,
a triangulated 3D pose drawn as a skeleton, and a running-wheel encoder velocity trace, all
advancing together on one master
timeline.](https://raw.githubusercontent.com/anzalks/avialsync/main/docs/_static/screenshots/aol_session_overview.gif)

*A real recording session: three cameras at 230 fps with per-camera 2D pose drawn over each view,
triangulated 3D pose in a fourth column no wider than one camera view, and the running-wheel encoder
velocity below — one second of it, at the speed it was recorded, every source moving on one master
clock. The whole folder was opened by dropping it
on the window; a [session plugin](https://avialsync.readthedocs.io/en/latest/plugin-guide.html)
recognised the layout and placed each file, including the shared time base and the skeleton the 3D
pane draws. Nothing in AvialSync knows this lab's format.*

## What it gives you

- Several camera recordings playing together on one clock, with forward/reverse `J`/`K`/`L` shuttle
  and detach-to-window layouts (`View → Detach Plots / 3D View / Imaging`, per-camera detachment,
  and pop-out inspector pages) for multi-monitor rigs.
- Sensor, electrode, and tracking traces beside the video, up to 50 kHz across many channels, with
  `Ctrl`-wheel cursor zoom, `Shift`-drag panning, sticky pinned reference rows, and `Stacked`,
  `Grouped`, `Overlaid`, or 2D Viridis `Heatmap` plot modes.
- Two-photon HDF5, OME-TIFF and ScanImage stacks on the same clock, with channel overlays,
  perceptual colormaps (`Viridis`, `Magma`, `Inferno`, `Turbo`), false-colour clipping indicators,
  live pixel intensity readouts, bidirectional ROI-tile ↔ `ΔF/F` trace linking, and a centred moving
  average, read one image plane at a time.
- Alignment by offset, drift, or TTL/event evidence, with the original files left unchanged.
- Notes the acquisition system itself recorded — read out of the file, placed on the same clock,
  and kept read-only so they never mix with your own marks.
- Event marks, draggable point and range annotations (`Shift+M`), configurable `1`–`9` behavioral
  ethogram hotkeys (instant points or start/stop bouts), A/B time ranges, and exports of snapshots or
  selected spans for analysis elsewhere.
- Event-aligned grid MP4 or per-event trimmed clip export, driven by rising or active-low falling
  TTL thresholds or discrete session triggers (accepted sync pulses, trials, messages, annotations),
  with cameras above one shared trace and selectable slow-motion speed; see the
  [illustrated export demo](https://avialsync.readthedocs.io/en/latest/tutorials/annotating-and-exporting.html#export-an-event-aligned-video-grid-with-its-ttl-trace).
- Correction of a wrong pose estimate by hand — aided by low-confidence hollow rings, motion trails,
  a `5×` pixel-grid zoom loupe, calibrated multi-camera epipolar guide curves, and off-thread
  suspect-frame navigation (`Ctrl+[` / `Ctrl+]`) — saved beside the pose file and exportable either as
  corrected data or as a DeepLabCut or single-view Lightning Pose retraining set.
- Repair of a tracker that swapped two animals or left/right body parts, by accepting the crossings
  it proposes; the original pose file is never modified.
- Physical apparatus — wheels, ladders, treadmill belts and balls in one Props inspector. Ladders
  are clicked rung by rung or extrapolated from two rungs, with rails or a centre beam; belts are
  placed from four clicks in calibrated cameras or a single side view and sized by your
  measurements; motion comes from encoder, displacement or orientation channels, or from camera
  clicks. Clicks stay saved when a dimension is corrected; a mismatch is explained in Props.
- Imported data cached in one per-user folder, never beside your recordings, and cleared from
  **File → Cache**.
- Undo on every edit you make, a recovery snapshot written on quit, and no modal dialog standing
  between you and a file: a damaged recording opens as far as it can and reports the rest.

## Install

**With `pip`**, on Python 3.11 or 3.12:

```bash
python -m pip install avialsync
avialsync
```

That is the whole install. Video decoding, proxy generation, and clip export all run inside the
Python packages, so there is no media runtime to install separately and nothing to configure.

**Or download a desktop installer** from the
[Releases page](https://github.com/anzalks/avialsync/releases) — `AvialSync-Setup.exe`,
`AvialSync.dmg`, or `AvialSync.AppImage` — if you would rather not manage a Python environment.
They bundle everything, install without an administrator password, and are not yet code-signed, so
the first launch needs
[one extra click](https://avialsync.readthedocs.io/en/latest/install.html#first-launch-security-warnings).

One caveat, and it is Qt's rather than AvialSync's: **on Linux**, PySide6 needs the usual desktop
graphics libraries (`libgl1`, `libxkbcommon`, and the xcb set). Every normal desktop already has
them; bare containers and minimal server images do not. No packaging choice removes it.

Apple silicon is required for the `.dmg`, and glibc 2.39+ for the AppImage; outside those, use pip.
See [Installation](https://avialsync.readthedocs.io/en/latest/install.html) for details.

## First session

```bash
avialsync demo
```

That generates and opens a complete sample session — four cameras, sensor and ephys traces, and
tracking — so you can confirm the install and try everything before touching your own data. With
your own recordings:

1. Drag video, data, imaging, or session folders onto the window, or use **Open Videos…**,
   **Open Sensor/Ephys Data…**, **Open NWB…**, **Open Imaging…**, and **Open Session…** in the left
   panel.
2. Video appears at the top, traces below it.
3. Drag the shared time bar to inspect one moment across every recording.
4. If recordings do not line up, use the synchronization tools to align a visible event or TTL pulse.

A camera with no coverage at the selected time shows **No Footage** rather than a stale frame, and
**Data Streams** shows when each file has data.

## Documentation

Full documentation is at **[avialsync.readthedocs.io](https://avialsync.readthedocs.io/en/latest/)**
— [quickstart](https://avialsync.readthedocs.io/en/latest/quickstart.html),
[first-session tutorial](https://avialsync.readthedocs.io/en/latest/tutorials/first-session.html),
[supported formats](https://avialsync.readthedocs.io/en/latest/formats.html),
[synchronization](https://avialsync.readthedocs.io/en/latest/tutorials/synchronization.html),
[troubleshooting](https://avialsync.readthedocs.io/en/latest/troubleshooting.html),
[plugin guide](https://avialsync.readthedocs.io/en/latest/plugin-guide.html), and a
[technical reference](https://avialsync.readthedocs.io/en/latest/technical/index.html) covering
architecture, data handling, performance, and the development and release process.

## Contributing

Contributions are welcome — see
[CONTRIBUTING.md](CONTRIBUTING.md) for setup, the
four-command gate every change must pass, and the architecture rules that exist because breaking
them caused real bugs. Participation is governed by our
[Code of Conduct](CODE_OF_CONDUCT.md).

Good places to start are format and session plugins (`TimeSeriesSource`, `VideoSource`,
`ImagingSource`, and `SessionSource` — see the [plugin tutorial](https://avialsync.readthedocs.io/en/latest/plugins/index.html),
[plugin reference](https://avialsync.readthedocs.io/en/latest/plugin-guide.html), and `avialsync plugin-check`), platform
verification on real desktop displays and hardware, and the [open issues](https://github.com/anzalks/avialsync/issues).

## Licence

AvialSync is free software under the
[GNU AGPL v3 or later](LICENSE). Use it, study it,
modify it, redistribute it. The one condition is reciprocity: if you convey a modified version —
including letting others use it over a network — you publish your changes under the same licence.

Running it in your lab, modifying it for your own use, publishing results, and writing plugins for
your own rig all sit inside this and cost nothing. A plugin that uses only the documented
`TimeSeriesSource`, `VideoSource`, `ImagingSource`, and `SessionSource` interfaces is your own work
and you choose its licence, so a loader for a proprietary instrument format need not be published.

There is no dual licence and no contributor agreement — contributions are accepted under the same
AGPL, and opening a pull request is the whole process.
