stiminterp 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stiminterp-0.1/.github/workflows/docs_build_and_deploy.yml +42 -0
- stiminterp-0.1/.github/workflows/test_and_deploy.yml +61 -0
- stiminterp-0.1/.gitignore +83 -0
- stiminterp-0.1/.pre-commit-config.yaml +49 -0
- stiminterp-0.1/LICENSE +28 -0
- stiminterp-0.1/MANIFEST.in +13 -0
- stiminterp-0.1/PKG-INFO +114 -0
- stiminterp-0.1/README.md +68 -0
- stiminterp-0.1/pyproject.toml +133 -0
- stiminterp-0.1/setup.cfg +4 -0
- stiminterp-0.1/stiminterp/__init__.py +11 -0
- stiminterp-0.1/stiminterp/load_data/custom_data_loader.py +124 -0
- stiminterp-0.1/stiminterp/load_data/scanimage_metadata.py +159 -0
- stiminterp-0.1/stiminterp/pipeline.py +51 -0
- stiminterp-0.1/stiminterp/plotting_hooks/sanity_check.py +81 -0
- stiminterp-0.1/stiminterp/stim_interpolate.py +372 -0
- stiminterp-0.1/stiminterp.egg-info/PKG-INFO +114 -0
- stiminterp-0.1/stiminterp.egg-info/SOURCES.txt +19 -0
- stiminterp-0.1/stiminterp.egg-info/dependency_links.txt +1 -0
- stiminterp-0.1/stiminterp.egg-info/requires.txt +24 -0
- stiminterp-0.1/stiminterp.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Build Sphinx docs and deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
# Generate the documentation on all merges to main, all pull requests, or by
|
|
4
|
+
# manual workflow dispatch. The build job can be used as a CI check that the
|
|
5
|
+
# docs still build successfully. The deploy job only runs when a tag is
|
|
6
|
+
# pushed and actually moves the generated html to the gh-pages branch
|
|
7
|
+
# (which triggers a GitHub pages deployment).
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
tags:
|
|
13
|
+
- '*'
|
|
14
|
+
pull_request:
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
linting:
|
|
20
|
+
# scheduled workflows should not run on forks
|
|
21
|
+
if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: neuroinformatics-unit/actions/lint@v2
|
|
25
|
+
|
|
26
|
+
build_sphinx_docs:
|
|
27
|
+
name: Build Sphinx Docs
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: neuroinformatics-unit/actions/build_sphinx_docs@v2
|
|
31
|
+
|
|
32
|
+
deploy_sphinx_docs:
|
|
33
|
+
name: Deploy Sphinx Docs
|
|
34
|
+
needs: build_sphinx_docs
|
|
35
|
+
permissions:
|
|
36
|
+
contents: write
|
|
37
|
+
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@v2
|
|
41
|
+
with:
|
|
42
|
+
secret_input: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- '*'
|
|
7
|
+
tags:
|
|
8
|
+
- '*'
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
linting:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: neuroinformatics-unit/actions/lint@v2
|
|
16
|
+
|
|
17
|
+
manifest:
|
|
18
|
+
name: Check Manifest
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: neuroinformatics-unit/actions/check_manifest@v2
|
|
22
|
+
|
|
23
|
+
test:
|
|
24
|
+
needs: [linting, manifest]
|
|
25
|
+
name: ${{ matrix.os }} py${{ matrix.python-version }}
|
|
26
|
+
runs-on: ${{ matrix.os }}
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
# Run all supported Python versions on linux
|
|
30
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
31
|
+
os: [ubuntu-latest]
|
|
32
|
+
# Include one windows and macos run
|
|
33
|
+
include:
|
|
34
|
+
- os: macos-latest
|
|
35
|
+
python-version: "3.13"
|
|
36
|
+
- os: windows-latest
|
|
37
|
+
python-version: "3.13"
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
# Run tests
|
|
41
|
+
- uses: neuroinformatics-unit/actions/test@v2
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
|
|
45
|
+
build_sdist_wheels:
|
|
46
|
+
name: Build source distribution
|
|
47
|
+
needs: [test]
|
|
48
|
+
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: neuroinformatics-unit/actions/build_sdist_wheels@v2
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
upload_all:
|
|
55
|
+
name: Publish build distributions
|
|
56
|
+
needs: [build_sdist_wheels]
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
steps:
|
|
59
|
+
- uses: neuroinformatics-unit/actions/upload_pypi@v2
|
|
60
|
+
with:
|
|
61
|
+
secret-pypi-key: ${{ secrets.TWINE_API_KEY }}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
|
|
48
|
+
# Translations
|
|
49
|
+
*.mo
|
|
50
|
+
*.pot
|
|
51
|
+
|
|
52
|
+
# Django stuff:
|
|
53
|
+
*.log
|
|
54
|
+
local_settings.py
|
|
55
|
+
|
|
56
|
+
# Flask instance folder
|
|
57
|
+
instance/
|
|
58
|
+
|
|
59
|
+
# Sphinx documentation
|
|
60
|
+
docs/_build/
|
|
61
|
+
|
|
62
|
+
# MkDocs documentation
|
|
63
|
+
/site/
|
|
64
|
+
|
|
65
|
+
# PyBuilder
|
|
66
|
+
target/
|
|
67
|
+
|
|
68
|
+
# Pycharm and VSCode
|
|
69
|
+
.idea/
|
|
70
|
+
venv/
|
|
71
|
+
.vscode/
|
|
72
|
+
|
|
73
|
+
# IPython Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# pyenv
|
|
77
|
+
.python-version
|
|
78
|
+
|
|
79
|
+
# OS
|
|
80
|
+
.DS_Store
|
|
81
|
+
|
|
82
|
+
# written by setuptools-scm
|
|
83
|
+
**/_version.py
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
exclude: 'conf.py'
|
|
2
|
+
|
|
3
|
+
# Configuring https://pre-commit.ci/
|
|
4
|
+
ci:
|
|
5
|
+
autoupdate_schedule: monthly
|
|
6
|
+
|
|
7
|
+
repos:
|
|
8
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
9
|
+
rev: v6.0.0
|
|
10
|
+
hooks:
|
|
11
|
+
- id: check-docstring-first
|
|
12
|
+
- id: check-executables-have-shebangs
|
|
13
|
+
- id: check-merge-conflict
|
|
14
|
+
- id: check-toml
|
|
15
|
+
- id: end-of-file-fixer
|
|
16
|
+
- id: mixed-line-ending
|
|
17
|
+
args: [--fix=lf]
|
|
18
|
+
- id: requirements-txt-fixer
|
|
19
|
+
- id: trailing-whitespace
|
|
20
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
|
+
rev: v0.14.14
|
|
22
|
+
hooks:
|
|
23
|
+
- id: ruff
|
|
24
|
+
args: [ --config=pyproject.toml ]
|
|
25
|
+
- id: ruff-format
|
|
26
|
+
args: [ --config=pyproject.toml ]
|
|
27
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
28
|
+
rev: v1.13.0
|
|
29
|
+
hooks:
|
|
30
|
+
- id: mypy
|
|
31
|
+
additional_dependencies:
|
|
32
|
+
- types-setuptools
|
|
33
|
+
- repo: https://github.com/mgedmin/check-manifest
|
|
34
|
+
rev: "0.50"
|
|
35
|
+
hooks:
|
|
36
|
+
- id: check-manifest
|
|
37
|
+
args: [--no-build-isolation]
|
|
38
|
+
additional_dependencies:
|
|
39
|
+
- setuptools>=77
|
|
40
|
+
- wheel
|
|
41
|
+
- setuptools-scm[toml]>=8
|
|
42
|
+
- repo: https://github.com/codespell-project/codespell
|
|
43
|
+
# Configuration for codespell is in pyproject.toml
|
|
44
|
+
rev: v2.4.1
|
|
45
|
+
hooks:
|
|
46
|
+
- id: codespell
|
|
47
|
+
exclude: \.ipynb$
|
|
48
|
+
additional_dependencies:
|
|
49
|
+
- tomli
|
stiminterp-0.1/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2026, Sumiya Kuroda
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
* Neither the name of stiminterp nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include *.yaml
|
|
4
|
+
recursive-include * *.yaml
|
|
5
|
+
recursive-include * *.yml
|
|
6
|
+
recursive-include images *.png
|
|
7
|
+
|
|
8
|
+
recursive-exclude * __pycache__
|
|
9
|
+
recursive-exclude * *.py[co]
|
|
10
|
+
recursive-exclude docs *
|
|
11
|
+
recursive-exclude tests *
|
|
12
|
+
recursive-exclude examples *
|
|
13
|
+
recursive-include stiminterp *.py
|
stiminterp-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stiminterp
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Photostimulation artifact removal via interpolation
|
|
5
|
+
Author-email: Sumiya Kuroda <s.kuroda@ucl.ac.uk>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/SainsburyWellcomeCentre/stiminterp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/SainsburyWellcomeCentre/stiminterp/issues
|
|
9
|
+
Project-URL: Source Code, https://github.com/SainsburyWellcomeCentre/stiminterp
|
|
10
|
+
Project-URL: User Support, https://github.com/SainsburyWellcomeCentre/stiminterp/issues
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
19
|
+
Requires-Python: >=3.10.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Requires-Dist: tifffile
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
|
+
Requires-Dist: scipy
|
|
26
|
+
Requires-Dist: PyYAML
|
|
27
|
+
Requires-Dist: fancylog
|
|
28
|
+
Requires-Dist: matplotlib
|
|
29
|
+
Requires-Dist: pandas
|
|
30
|
+
Requires-Dist: tqdm
|
|
31
|
+
Requires-Dist: scikit-learn
|
|
32
|
+
Requires-Dist: scikit-image
|
|
33
|
+
Requires-Dist: scanimage-tiff-reader
|
|
34
|
+
Requires-Dist: h5py
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
38
|
+
Requires-Dist: coverage; extra == "dev"
|
|
39
|
+
Requires-Dist: tox; extra == "dev"
|
|
40
|
+
Requires-Dist: black; extra == "dev"
|
|
41
|
+
Requires-Dist: mypy; extra == "dev"
|
|
42
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff; extra == "dev"
|
|
44
|
+
Requires-Dist: setuptools_scm; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
[](https://pypi.org/project/stiminterp)
|
|
49
|
+
[](https://pypi.org/project/stiminterp)
|
|
51
|
+
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
52
|
+
|
|
53
|
+
# stiminterp
|
|
54
|
+
|
|
55
|
+
**stiminterp** provides an 1D-interpolation-based solution for removing
|
|
56
|
+
photostimulation artefacts from multiphoton calcium imaging data.
|
|
57
|
+
|
|
58
|
+
The holographic stimulation saturates the PMTs and causes data loss. By identifying lines with the stimulation artefacts, this pipeline can replace the pixel rows containing the stimulation artefacts with the average values from corresponding rows in the preceding and following frames.
|
|
59
|
+
|
|
60
|
+
------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
Create a fresh environment and install via pip:
|
|
65
|
+
|
|
66
|
+
conda create -n stiminterp-env python=3.12
|
|
67
|
+
conda activate stiminterp-env
|
|
68
|
+
pip install stiminterp
|
|
69
|
+
|
|
70
|
+
------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
## Overview
|
|
73
|
+
|
|
74
|
+
Understanding the causal role of brain dynamics is one of the fundamental questions in systemns neuroscience. Multiphoton holographic optogenetics, combined with multiphoton calcium imaging, enables causal testing of circuit models at single-cell resolution. However, photostimulation can saturate PMTs, producing line artefacts in the imaging data.
|
|
75
|
+
|
|
76
|
+
With `stiminterp` you can:
|
|
77
|
+
|
|
78
|
+
- Detect artefact-contaminated lines from HDF5 generated by ScanImage
|
|
79
|
+
- Perform spatiotemporal 1D-interpolation using `scipy.interpolate`
|
|
80
|
+
- Recover calcium imaging movies that can be fed into standard analysis pipelines such as `suite2p`
|
|
81
|
+
------------------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
## Data Source & Funding
|
|
84
|
+
|
|
85
|
+
Sample data used for examples will be publicly available in the near future.
|
|
86
|
+
|
|
87
|
+
All microscopy data has been acquired using a custom two-photon microscope by [Sumiya Kuroda](https://github.com/sumiya-kuroda) in the [Mrsic-Flogel Lab](https://www.sainsburywellcome.org/web/groups/mrsic-flogel-lab) and Dale Elgar from [COSYS Ltd.](https://www.cosys.org.uk/).
|
|
88
|
+
|
|
89
|
+
This work represents a joint collaboration between Stanford University and the Sainsbury Wellcome Centre for Neural Circuits and Behaviour, University College London, supported by the Gatsby Charitable Foundation.
|
|
90
|
+
|
|
91
|
+
------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
## References
|
|
94
|
+
|
|
95
|
+
Previous work on artefact removal of all-optical imaging movies:
|
|
96
|
+
- [Drinnenberg et al, 2025, bioRxiv](https://www.biorxiv.org/content/10.1101/2025.10.21.683734v1)
|
|
97
|
+
- [Attinger et al, 2025, bioRxiv](https://www.biorxiv.org/content/10.1101/2025.10.21.683723v1)
|
|
98
|
+
|
|
99
|
+
This package was inspired by [previous calcium imaging analysis pipeline at Deisseroth lab](https://github.com/deisseroth-lab/two-photon/tree/main).
|
|
100
|
+
|
|
101
|
+
This repo was made using [neuroinformatics-unit/python-cookiecutter](https://github.com/neuroinformatics-unit/python-cookiecutter). See [here](https://python-cookiecutter.neuroinformatics.dev/) for more info.
|
|
102
|
+
|
|
103
|
+
------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
## Contributing
|
|
106
|
+
|
|
107
|
+
Contributions are welcome. Please open an issue or submit a pull request
|
|
108
|
+
on GitHub.
|
|
109
|
+
|
|
110
|
+
------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
BSD-3-Clause
|
stiminterp-0.1/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[](https://pypi.org/project/stiminterp)
|
|
3
|
+
[](https://pypi.org/project/stiminterp)
|
|
5
|
+
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
6
|
+
|
|
7
|
+
# stiminterp
|
|
8
|
+
|
|
9
|
+
**stiminterp** provides an 1D-interpolation-based solution for removing
|
|
10
|
+
photostimulation artefacts from multiphoton calcium imaging data.
|
|
11
|
+
|
|
12
|
+
The holographic stimulation saturates the PMTs and causes data loss. By identifying lines with the stimulation artefacts, this pipeline can replace the pixel rows containing the stimulation artefacts with the average values from corresponding rows in the preceding and following frames.
|
|
13
|
+
|
|
14
|
+
------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Create a fresh environment and install via pip:
|
|
19
|
+
|
|
20
|
+
conda create -n stiminterp-env python=3.12
|
|
21
|
+
conda activate stiminterp-env
|
|
22
|
+
pip install stiminterp
|
|
23
|
+
|
|
24
|
+
------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
Understanding the causal role of brain dynamics is one of the fundamental questions in systemns neuroscience. Multiphoton holographic optogenetics, combined with multiphoton calcium imaging, enables causal testing of circuit models at single-cell resolution. However, photostimulation can saturate PMTs, producing line artefacts in the imaging data.
|
|
29
|
+
|
|
30
|
+
With `stiminterp` you can:
|
|
31
|
+
|
|
32
|
+
- Detect artefact-contaminated lines from HDF5 generated by ScanImage
|
|
33
|
+
- Perform spatiotemporal 1D-interpolation using `scipy.interpolate`
|
|
34
|
+
- Recover calcium imaging movies that can be fed into standard analysis pipelines such as `suite2p`
|
|
35
|
+
------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
## Data Source & Funding
|
|
38
|
+
|
|
39
|
+
Sample data used for examples will be publicly available in the near future.
|
|
40
|
+
|
|
41
|
+
All microscopy data has been acquired using a custom two-photon microscope by [Sumiya Kuroda](https://github.com/sumiya-kuroda) in the [Mrsic-Flogel Lab](https://www.sainsburywellcome.org/web/groups/mrsic-flogel-lab) and Dale Elgar from [COSYS Ltd.](https://www.cosys.org.uk/).
|
|
42
|
+
|
|
43
|
+
This work represents a joint collaboration between Stanford University and the Sainsbury Wellcome Centre for Neural Circuits and Behaviour, University College London, supported by the Gatsby Charitable Foundation.
|
|
44
|
+
|
|
45
|
+
------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
## References
|
|
48
|
+
|
|
49
|
+
Previous work on artefact removal of all-optical imaging movies:
|
|
50
|
+
- [Drinnenberg et al, 2025, bioRxiv](https://www.biorxiv.org/content/10.1101/2025.10.21.683734v1)
|
|
51
|
+
- [Attinger et al, 2025, bioRxiv](https://www.biorxiv.org/content/10.1101/2025.10.21.683723v1)
|
|
52
|
+
|
|
53
|
+
This package was inspired by [previous calcium imaging analysis pipeline at Deisseroth lab](https://github.com/deisseroth-lab/two-photon/tree/main).
|
|
54
|
+
|
|
55
|
+
This repo was made using [neuroinformatics-unit/python-cookiecutter](https://github.com/neuroinformatics-unit/python-cookiecutter). See [here](https://python-cookiecutter.neuroinformatics.dev/) for more info.
|
|
56
|
+
|
|
57
|
+
------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
Contributions are welcome. Please open an issue or submit a pull request
|
|
62
|
+
on GitHub.
|
|
63
|
+
|
|
64
|
+
------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
BSD-3-Clause
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "stiminterp"
|
|
3
|
+
authors = [{name = "Sumiya Kuroda", email= "s.kuroda@ucl.ac.uk"}]
|
|
4
|
+
description = "Photostimulation artifact removal via interpolation"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10.0"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
|
|
9
|
+
license = {text = "BSD-3-Clause"}
|
|
10
|
+
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
13
|
+
"Programming Language :: Python",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"License :: OSI Approved :: BSD License",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
dependencies = [
|
|
23
|
+
"numpy",
|
|
24
|
+
"tifffile",
|
|
25
|
+
"matplotlib",
|
|
26
|
+
"scipy",
|
|
27
|
+
"PyYAML",
|
|
28
|
+
"fancylog",
|
|
29
|
+
"matplotlib",
|
|
30
|
+
"pandas",
|
|
31
|
+
"tqdm",
|
|
32
|
+
"scikit-learn",
|
|
33
|
+
"scikit-image",
|
|
34
|
+
"scanimage-tiff-reader",
|
|
35
|
+
"h5py",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
"Homepage" = "https://github.com/SainsburyWellcomeCentre/stiminterp"
|
|
40
|
+
"Bug Tracker" = "https://github.com/SainsburyWellcomeCentre/stiminterp/issues"
|
|
41
|
+
|
|
42
|
+
"Source Code" = "https://github.com/SainsburyWellcomeCentre/stiminterp"
|
|
43
|
+
"User Support" = "https://github.com/SainsburyWellcomeCentre/stiminterp/issues"
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
dev = [
|
|
47
|
+
"pytest",
|
|
48
|
+
"pytest-cov",
|
|
49
|
+
"coverage",
|
|
50
|
+
"tox",
|
|
51
|
+
"black",
|
|
52
|
+
"mypy",
|
|
53
|
+
"pre-commit",
|
|
54
|
+
"ruff",
|
|
55
|
+
"setuptools_scm",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[build-system]
|
|
59
|
+
requires = [
|
|
60
|
+
"setuptools>=45",
|
|
61
|
+
"wheel",
|
|
62
|
+
"setuptools_scm[toml]>=6.2",
|
|
63
|
+
]
|
|
64
|
+
build-backend = "setuptools.build_meta"
|
|
65
|
+
|
|
66
|
+
[tool.setuptools]
|
|
67
|
+
include-package-data = true
|
|
68
|
+
|
|
69
|
+
[tool.setuptools.packages.find]
|
|
70
|
+
include = ["stiminterp*"]
|
|
71
|
+
exclude = ["tests", "docs*"]
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
addopts = "--cov=stiminterp"
|
|
75
|
+
filterwarnings = [
|
|
76
|
+
"error",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.setuptools_scm]
|
|
80
|
+
|
|
81
|
+
[tool.check-manifest]
|
|
82
|
+
ignore = [
|
|
83
|
+
".yaml",
|
|
84
|
+
"tox.ini",
|
|
85
|
+
"tests/",
|
|
86
|
+
"tests/test_unit/",
|
|
87
|
+
"tests/test_integration/",
|
|
88
|
+
"docs/",
|
|
89
|
+
"docs/source/",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[tool.ruff]
|
|
93
|
+
line-length = 79
|
|
94
|
+
exclude = ["__init__.py", "build", ".eggs"]
|
|
95
|
+
lint.select = [
|
|
96
|
+
"E", # pycodestyle errors
|
|
97
|
+
"F", # Pyflakes
|
|
98
|
+
"I", # isort
|
|
99
|
+
# You can see what all the rules do here: https://docs.astral.sh/ruff/rules/
|
|
100
|
+
# Some additional ruff rules that might be useful (uncomment to enable)
|
|
101
|
+
#"UP", # pyupgrade
|
|
102
|
+
#"B", # flake8 bugbear
|
|
103
|
+
#"SIM", # flake8 simplify
|
|
104
|
+
#"C90", # McCabe complexity
|
|
105
|
+
]
|
|
106
|
+
fix = true
|
|
107
|
+
|
|
108
|
+
[tool.ruff.format]
|
|
109
|
+
docstring-code-format = true # Also format code in docstrings (e.g. examples)
|
|
110
|
+
|
|
111
|
+
[tool.tox]
|
|
112
|
+
legacy_tox_ini = """
|
|
113
|
+
[tox]
|
|
114
|
+
envlist = py{310,311,312}
|
|
115
|
+
isolated_build = True
|
|
116
|
+
|
|
117
|
+
[gh-actions]
|
|
118
|
+
python =
|
|
119
|
+
3.10: py310
|
|
120
|
+
3.11: py311
|
|
121
|
+
3.12: py312
|
|
122
|
+
|
|
123
|
+
[testenv]
|
|
124
|
+
extras =
|
|
125
|
+
dev
|
|
126
|
+
commands =
|
|
127
|
+
pytest -v --color=yes --cov={{cookiecutter.module_name}} --cov-report=xml
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
[tool.codespell]
|
|
131
|
+
skip = '.git'
|
|
132
|
+
ignore-words-list = "ptd"
|
|
133
|
+
check-hidden = true
|
stiminterp-0.1/setup.cfg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
__version__ = version("stiminterp")
|
|
5
|
+
except PackageNotFoundError:
|
|
6
|
+
# package is not installed
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
from .stim_interpolate import remove_photostim_artefacts, StimInterpConfig
|
|
10
|
+
from .load_data.scanimage_metadata import ScanImageMetadata
|
|
11
|
+
from .pipeline import run_stiminterp
|