Skip to main content

Two-photon imaging analysis tool with a napari interface.

Project description

twopy

Two-photon imaging analysis tool for the Clark Lab output format.

twopy napari interface

Getting Started

twopy lets you open two-photon recordings, draw ROIs, plot responses in real time, process and analyze them, and save them.

When you first load a recording, twopy converts it to HDF5 files that it owns. Those files include the aligned movie, mean image, stimulus tables, photodiode signals, and recording metadata. Analysis and the GUI both work from the converted files, so the original source files remain separate from twopy's outputs. By default, converted recordings and interactive analysis outputs are cached locally under ~/.cache/twopy/recordings for speed; saving ROIs and analysis copies the changed output files back to the configured analysis_output location in the background.

Install

Examples use micromamba, but any conda-compatible environment manager should work.

micromamba create -n twopy -c conda-forge python=3.13 pip -y
micromamba run -n twopy python -m pip install twopy

Verify the install:

micromamba run -n twopy python -c 'import twopy; print(twopy.__name__)'

Create the config template in your user folder:

twopy config setup

twopy prints the config path it wrote. On macOS and Linux the default is ~/.config/twopy/config.yml; on Windows it is under %APPDATA%\twopy\config.yml. Edit that file with your database, data, and output paths before launching twopy. If you launch twopy before a config exists, twopy creates the same template, prints the path, and stops so you can edit it.

Validate the active config and show its path and file contents:

twopy config

Start

micromamba activate twopy
twopy

twopy validates the config before opening napari. It does not require lab data folders or network drives to be mounted at launch.

Open a source recording or converted recording directly:

twopy /path/to/source/recording
twopy /path/to/recording_data.h5

Basic GUI flow:

  1. Search the database or load a recording manually.
  2. Draw or edit ROIs in the rois Labels layer.
  3. Update response plots from the current ROIs.
  4. Click Save ROIs + analysis in Export when the plots look right.

When a source recording has not been converted yet, twopy converts it first. Converted data includes the aligned movie, mean image, stimulus tables, photodiode signals, and recording metadata.

Docs

Check

micromamba run -n twopy pre-commit run --all-files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twopy-0.3.5.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twopy-0.3.5-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file twopy-0.3.5.tar.gz.

File metadata

  • Download URL: twopy-0.3.5.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for twopy-0.3.5.tar.gz
Algorithm Hash digest
SHA256 222219d0b47a55a2fc0162f4b1d5baa6e6af3b2d6f2acaaadb15497ad07b0050
MD5 be0eba13999c148d6c6cc4fe0b3df8a8
BLAKE2b-256 dcc8bc12a592517a673d246b0382e0dbd4b4d7b617eaff0bde0c46349f5a7d95

See more details on using hashes here.

Provenance

The following attestation bundles were made for twopy-0.3.5.tar.gz:

Publisher: publish-to-pypi.yml on gumadeiras/twopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file twopy-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: twopy-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for twopy-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f6efed52be8eff220de65917479d987a8c8dc5557bf5a780581bf07bbfe7666e
MD5 e76de5e4c0910d1f02d3ecb18dae9e0b
BLAKE2b-256 689053ea8561fc7d96e128e1b3e288133324ff515d34666e8804b821de62c15f

See more details on using hashes here.

Provenance

The following attestation bundles were made for twopy-0.3.5-py3-none-any.whl:

Publisher: publish-to-pypi.yml on gumadeiras/twopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page