dj-photon-codecs 0.1.0__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.
Files changed (33) hide show
  1. dj_photon_codecs-0.1.0/.github/dependabot.yml +29 -0
  2. dj_photon_codecs-0.1.0/.github/scripts/check_release_tag.sh +49 -0
  3. dj_photon_codecs-0.1.0/.github/workflows/cd.yml +139 -0
  4. dj_photon_codecs-0.1.0/.github/workflows/ci.yml +69 -0
  5. dj_photon_codecs-0.1.0/.gitignore +17 -0
  6. dj_photon_codecs-0.1.0/.readthedocs.yaml +15 -0
  7. dj_photon_codecs-0.1.0/LICENSE +191 -0
  8. dj_photon_codecs-0.1.0/PKG-INFO +158 -0
  9. dj_photon_codecs-0.1.0/README.md +131 -0
  10. dj_photon_codecs-0.1.0/docs/api/reference.md +312 -0
  11. dj_photon_codecs-0.1.0/docs/contributing.md +343 -0
  12. dj_photon_codecs-0.1.0/docs/examples/calcium-imaging.md +314 -0
  13. dj_photon_codecs-0.1.0/docs/examples/low-light.md +404 -0
  14. dj_photon_codecs-0.1.0/docs/getting-started/configuration.md +179 -0
  15. dj_photon_codecs-0.1.0/docs/getting-started/installation.md +55 -0
  16. dj_photon_codecs-0.1.0/docs/getting-started/quick-start.md +157 -0
  17. dj_photon_codecs-0.1.0/docs/index.md +69 -0
  18. dj_photon_codecs-0.1.0/docs/requirements.txt +2 -0
  19. dj_photon_codecs-0.1.0/docs/user-guide/anscombe-transform.md +184 -0
  20. dj_photon_codecs-0.1.0/docs/user-guide/best-practices.md +363 -0
  21. dj_photon_codecs-0.1.0/docs/user-guide/compression.md +186 -0
  22. dj_photon_codecs-0.1.0/docs/user-guide/overview.md +114 -0
  23. dj_photon_codecs-0.1.0/docs/user-guide/storage-structure.md +297 -0
  24. dj_photon_codecs-0.1.0/mkdocs.yml +91 -0
  25. dj_photon_codecs-0.1.0/pyproject.toml +81 -0
  26. dj_photon_codecs-0.1.0/src/dj_photon_codecs/__init__.py +6 -0
  27. dj_photon_codecs-0.1.0/src/dj_photon_codecs/_version.py +24 -0
  28. dj_photon_codecs-0.1.0/src/dj_photon_codecs/codecs.py +267 -0
  29. dj_photon_codecs-0.1.0/tests/__init__.py +0 -0
  30. dj_photon_codecs-0.1.0/tests/conftest.py +89 -0
  31. dj_photon_codecs-0.1.0/tests/test_codec.py +125 -0
  32. dj_photon_codecs-0.1.0/tests/test_package.py +20 -0
  33. dj_photon_codecs-0.1.0/uv.lock +2553 -0
@@ -0,0 +1,29 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ groups:
8
+ github-actions:
9
+ patterns:
10
+ - "*"
11
+
12
+ # pyproject.toml and uv.lock
13
+ - package-ecosystem: "uv"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ groups:
18
+ python:
19
+ patterns:
20
+ - "*"
21
+
22
+ - package-ecosystem: "pip"
23
+ directory: "/docs"
24
+ schedule:
25
+ interval: "weekly"
26
+ groups:
27
+ python:
28
+ patterns:
29
+ - "*"
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+ # Decide whether a release tag can be published.
3
+ #
4
+ # check_release_tag.sh <tag> [<branch>]
5
+ #
6
+ # Fails on a tag that is not vX.Y.Z, on a lightweight tag, and on a tag whose
7
+ # commit is not on <branch> (default: master). Succeeds without publishing on a
8
+ # tag whose message has a "Retroactive:" line: such tags record past releases.
9
+ # Writes publish=true or publish=false to $GITHUB_OUTPUT when it is set.
10
+ set -euo pipefail
11
+
12
+ tag="${1:?usage: check_release_tag.sh <tag> [<branch>]}"
13
+ branch="${2:-master}"
14
+ output="${GITHUB_OUTPUT:-/dev/null}"
15
+
16
+ fail() {
17
+ echo "::error::$1" >&2
18
+ shift
19
+ for line in "$@"; do echo "$line" >&2; done
20
+ exit 1
21
+ }
22
+
23
+ [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "$tag is not a release tag (vX.Y.Z)."
24
+
25
+ # actions/checkout can store an annotated tag as a lightweight ref, so fetch the
26
+ # tag object itself, and the branch the tag must be on.
27
+ git fetch --quiet --force origin "refs/tags/$tag:refs/tags/$tag"
28
+ git fetch --quiet --no-tags origin "+refs/heads/$branch:refs/remotes/origin/$branch"
29
+
30
+ if [[ "$(git cat-file -t "refs/tags/$tag")" != "tag" ]]; then
31
+ fail "$tag is a lightweight tag. A release tag is annotated, with the release notes as its message:" \
32
+ " git tag -d $tag" \
33
+ " git tag -a $tag <commit> --cleanup=verbatim -F notes.md" \
34
+ " git push --force origin refs/tags/$tag"
35
+ fi
36
+
37
+ commit="$(git rev-parse "refs/tags/$tag^{commit}")"
38
+ if ! git merge-base --is-ancestor "$commit" "refs/remotes/origin/$branch"; then
39
+ fail "$tag points to $commit, which is not on $branch."
40
+ fi
41
+
42
+ if git for-each-ref "refs/tags/$tag" --format='%(contents)' | grep -q '^Retroactive:'; then
43
+ echo "::notice::$tag records a past release (its message has a Retroactive: line); nothing to publish."
44
+ echo "publish=false" >> "$output"
45
+ exit 0
46
+ fi
47
+
48
+ echo "$tag is an annotated tag on $branch; publishing."
49
+ echo "publish=true" >> "$output"
@@ -0,0 +1,139 @@
1
+ name: CD
2
+
3
+ # Pull requests and pushes to main build the package. A release is an annotated
4
+ # tag vX.Y.Z on main whose message is the release notes: pushing it checks the
5
+ # tag, runs the CI workflow, publishes the package built at the tag (hatch-vcs
6
+ # takes the version from the tag), and creates the GitHub release with the
7
+ # tag's message as its notes.
8
+ #
9
+ # PyPI trusted publishing is bound to this file's name and to the pypi
10
+ # environment, so neither can be renamed without updating PyPI.
11
+ on:
12
+ workflow_dispatch:
13
+ pull_request:
14
+ push:
15
+ branches:
16
+ - main
17
+ tags:
18
+ - "v[0-9]+.[0-9]+.[0-9]+"
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ concurrency:
24
+ group: ${{ github.workflow }}-${{ github.ref }}
25
+ # A newer push replaces a build in progress; a release is never cancelled.
26
+ cancel-in-progress: ${{ github.ref_type != 'tag' }}
27
+
28
+ env:
29
+ FORCE_COLOR: 3
30
+
31
+ jobs:
32
+ dist:
33
+ name: Distribution build
34
+ runs-on: ubuntu-latest
35
+
36
+ steps:
37
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38
+ with:
39
+ fetch-depth: 0
40
+ persist-credentials: false
41
+
42
+ # v3 ships Twine 7, which understands packaging metadata 2.4/2.5 — what a
43
+ # PEP 639 SPDX license declaration produces. v2 bundles Twine 6 and fails
44
+ # `twine check --strict`.
45
+ - uses: hynek/build-and-inspect-python-package@67230f7b8410ae0052b39c1efc89d89fff43ff10 # v3.0.2
46
+
47
+ check:
48
+ name: Check the release tag
49
+ if: github.ref_type == 'tag'
50
+ runs-on: ubuntu-latest
51
+ outputs:
52
+ publish: ${{ steps.check.outputs.publish }}
53
+
54
+ steps:
55
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
56
+ with:
57
+ fetch-depth: 0
58
+ persist-credentials: false
59
+
60
+ - name: Check the tag
61
+ id: check
62
+ run: .github/scripts/check_release_tag.sh "$GITHUB_REF_NAME" main
63
+
64
+ ci:
65
+ name: CI
66
+ needs: [check]
67
+ if: needs.check.outputs.publish == 'true'
68
+ uses: ./.github/workflows/ci.yml
69
+
70
+ publish:
71
+ needs: [dist, check, ci]
72
+ name: Publish to PyPI
73
+ environment: pypi
74
+ permissions:
75
+ # Trusted publishing: PyPI verifies this workflow's OIDC identity, so no
76
+ # API token is stored anywhere. Requires a pending publisher configured on
77
+ # PyPI for this project before the first release.
78
+ id-token: write
79
+ attestations: write
80
+ contents: read
81
+ runs-on: ubuntu-latest
82
+ if: github.ref_type == 'tag' && needs.check.outputs.publish == 'true'
83
+ env:
84
+ TAG: ${{ github.ref_name }}
85
+
86
+ steps:
87
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
88
+ with:
89
+ name: Packages
90
+ path: dist
91
+
92
+ - name: Check the built version
93
+ run: |
94
+ version="${TAG#v}"
95
+ for file in dist/*; do
96
+ case "$(basename "$file")" in
97
+ "dj_photon_codecs-$version-"*.whl | "dj_photon_codecs-$version.tar.gz") ;;
98
+ *) echo "::error::$file does not carry version $version"; exit 1 ;;
99
+ esac
100
+ done
101
+
102
+ - name: Generate artifact attestation for sdist and wheel
103
+ uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
104
+ with:
105
+ subject-path: "dist/*"
106
+
107
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
108
+
109
+ release:
110
+ needs: [publish]
111
+ name: Create the GitHub release
112
+ runs-on: ubuntu-latest
113
+ permissions:
114
+ contents: write
115
+ env:
116
+ TAG: ${{ github.ref_name }}
117
+
118
+ steps:
119
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
120
+ with:
121
+ fetch-depth: 0
122
+ persist-credentials: false
123
+
124
+ - name: Fetch the tag object
125
+ # actions/checkout can store an annotated tag as a lightweight ref.
126
+ run: git fetch --force origin "refs/tags/$TAG:refs/tags/$TAG"
127
+
128
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
129
+ with:
130
+ name: Packages
131
+ path: dist
132
+
133
+ - name: Create the GitHub release
134
+ env:
135
+ GH_TOKEN: ${{ github.token }}
136
+ run: |
137
+ git for-each-ref "refs/tags/$TAG" --format='%(contents)' > "$RUNNER_TEMP/notes.md"
138
+ gh release create "$TAG" --verify-tag --title "dj-photon-codecs ${TAG#v}" \
139
+ --notes-file "$RUNNER_TEMP/notes.md" dist/*
@@ -0,0 +1,69 @@
1
+ name: CI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+ # The CD workflow runs this as the test gate of a release.
10
+ workflow_call:
11
+
12
+ concurrency:
13
+ # "CI" rather than github.workflow, which in a run called from CD is "CD":
14
+ # sharing the caller's group is a deadlock, and GitHub cancels the run.
15
+ group: CI-${{ github.ref }}
16
+ cancel-in-progress: ${{ github.ref_type != 'tag' }}
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ env:
22
+ FORCE_COLOR: 3
23
+
24
+ jobs:
25
+ lint:
26
+ name: Lint
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30
+ with:
31
+ persist-credentials: false
32
+
33
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
34
+
35
+ - name: Ruff
36
+ run: |
37
+ uvx ruff@0.17.6 check --output-format=github src tests
38
+ uvx ruff@0.17.6 format --check src tests
39
+
40
+ checks:
41
+ name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
42
+ runs-on: ${{ matrix.runs-on }}
43
+ needs: [lint]
44
+ strategy:
45
+ fail-fast: false
46
+ matrix:
47
+ python-version: ["3.11", "3.14"]
48
+ runs-on: [ubuntu-latest, windows-latest, macos-latest]
49
+
50
+ steps:
51
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52
+ with:
53
+ # hatch-vcs takes the version from the tags.
54
+ fetch-depth: 0
55
+ persist-credentials: false
56
+
57
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
58
+ with:
59
+ python-version: ${{ matrix.python-version }}
60
+
61
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
62
+
63
+ - name: Install package
64
+ run: uv sync --locked
65
+
66
+ # The database test runs where Docker runs Linux containers (Ubuntu) and
67
+ # skips elsewhere.
68
+ - name: Test package
69
+ run: uv run pytest -ra --durations=20
@@ -0,0 +1,17 @@
1
+ # Generated by the hatch-vcs build hook — the git tag is the source of truth
2
+ src/**/_version.py
3
+
4
+ # Build artifacts
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+ __pycache__/
9
+ *.py[cod]
10
+ .venv/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .mypy_cache/
14
+
15
+ # Test coverage
16
+ .coverage
17
+ coverage.xml
@@ -0,0 +1,15 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.10"
7
+
8
+ mkdocs:
9
+ configuration: mkdocs.yml
10
+
11
+ python:
12
+ install:
13
+ - requirements: docs/requirements.txt
14
+ - method: pip
15
+ path: .
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2026 DataJoint Inc.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.5
2
+ Name: dj-photon-codecs
3
+ Version: 0.1.0
4
+ Summary: DataJoint codec for photon-limited movies with Anscombe transformation and compression
5
+ Project-URL: Homepage, https://github.com/datajoint/dj-photon-codecs
6
+ Project-URL: Repository, https://github.com/datajoint/dj-photon-codecs
7
+ Project-URL: Documentation, https://dj-photon-codecs.readthedocs.io/
8
+ Project-URL: Bug Tracker, https://github.com/datajoint/dj-photon-codecs/issues
9
+ Author-email: Dimitri Yatsenko <dimitri@datajoint.com>, Davis Bennett <davis.v.bennett@gmail.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: anscombe,codec,datajoint,imaging,photon
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: anscombe-transform>=1.0
23
+ Requires-Dist: datajoint>=2.3.4
24
+ Requires-Dist: numpy>=1.25
25
+ Requires-Dist: zarr>=3.1.2
26
+ Description-Content-Type: text/markdown
27
+
28
+ # dj-photon-codecs
29
+
30
+ DataJoint codec for photon-limited movies with Anscombe variance stabilization and compressed Zarr storage.
31
+
32
+ [![PyPI version](https://badge.fury.io/py/dj-photon-codecs.svg)](https://pypi.org/project/dj-photon-codecs/)
33
+ [![Documentation](https://readthedocs.org/projects/dj-photon-codecs/badge/?version=latest)](https://dj-photon-codecs.readthedocs.io/)
34
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
35
+
36
+ ## Overview
37
+
38
+ This codec enables efficient storage of photon-limited imaging data (calcium imaging, fluorescence microscopy) by:
39
+
40
+ 1. **Variance stabilization** - Anscombe transformation converts Poisson noise to constant variance
41
+ 2. **High compression** - Blosc/Zstd achieves 3-5x compression on stabilized data
42
+ 3. **Efficient access** - Zarr format with temporal chunking for frame-by-frame processing
43
+
44
+ ## Quick Start
45
+
46
+ ### Installation
47
+
48
+ ```bash
49
+ pip install dj-photon-codecs
50
+ ```
51
+
52
+ ### Basic Usage
53
+
54
+ ```python
55
+ import datajoint as dj
56
+ import numpy as np
57
+
58
+ # Configure object storage
59
+ dj.config['stores'] = {
60
+ 'imaging': {
61
+ 'protocol': 's3',
62
+ 'bucket': 'my-data',
63
+ }
64
+ }
65
+
66
+ # Define table
67
+ schema = dj.Schema('calcium_imaging')
68
+
69
+ @schema
70
+ class Recording(dj.Manual):
71
+ definition = """
72
+ recording_id : int32
73
+ ---
74
+ movie : <photon@imaging> # Photon-limited movie
75
+ """
76
+
77
+ # Insert raw photon counts (non-negative integers up to 32767)
78
+ movie = np.random.poisson(lam=10, size=(1000, 512, 512)).astype(np.uint16)
79
+ Recording.insert1({'recording_id': 1, 'movie': movie})
80
+
81
+ # Fetch returns a read-only Zarr array; reading it applies the inverse transform
82
+ zarr_array = (Recording & {'recording_id': 1}).fetch1('movie')
83
+ frame = zarr_array[100] # photon counts of one frame
84
+ ```
85
+
86
+ The movie is stored as a Zarr array whose chunks pass through the
87
+ [anscombe-transform](https://github.com/datajoint/anscombe-transform) filter
88
+ before Blosc/Zstd compression. The filter re-quantizes the counts with a step
89
+ below the photon shot noise, so the fetched counts match the inserted ones
90
+ within that step.
91
+
92
+ Requires `datajoint>=2.3.4` and Python 3.11 or later.
93
+
94
+ ## Features
95
+
96
+ - **Automatic variance stabilization** using Anscombe transformation
97
+ - **3-5x compression** with Blosc/Zstd on variance-stabilized data
98
+ - **Temporal chunking** optimized for sequential frame access
99
+ - **Schema-addressed paths** mirroring database structure
100
+ - **Lazy loading** - access frames without loading entire movie
101
+ - **Transparent inverse** - fetched arrays read back as photon counts
102
+
103
+ ## When to Use
104
+
105
+ ✅ **Use for:**
106
+ - Photon-limited imaging (calcium imaging, fluorescence microscopy)
107
+ - Data where Poisson shot noise dominates
108
+ - Large movies requiring efficient storage
109
+ - Sequential frame processing workflows
110
+
111
+ ❌ **Don't use for:**
112
+ - Preprocessed/normalized data (ΔF/F, z-scored)
113
+ - Data with negative values
114
+ - Non-Poisson noise dominates
115
+
116
+ ## Documentation
117
+
118
+ 📚 **[Full Documentation](https://dj-photon-codecs.readthedocs.io/)**
119
+
120
+ - [Installation Guide](https://dj-photon-codecs.readthedocs.io/en/latest/getting-started/installation/)
121
+ - [Quick Start Tutorial](https://dj-photon-codecs.readthedocs.io/en/latest/getting-started/quick-start/)
122
+ - [User Guide](https://dj-photon-codecs.readthedocs.io/en/latest/user-guide/overview/)
123
+ - [API Reference](https://dj-photon-codecs.readthedocs.io/en/latest/api/reference/)
124
+ - [Examples](https://dj-photon-codecs.readthedocs.io/en/latest/examples/calcium-imaging/)
125
+
126
+ ## Contributing
127
+
128
+ Contributions are welcome! See our [Contributing Guide](https://dj-photon-codecs.readthedocs.io/en/latest/contributing/).
129
+
130
+ ```bash
131
+ # Development setup
132
+ git clone https://github.com/datajoint/dj-photon-codecs.git
133
+ cd dj-photon-codecs
134
+ uv sync
135
+
136
+ # Run tests (the database test needs Docker and skips without it)
137
+ uv run pytest
138
+
139
+ # Build docs
140
+ uv run --group docs mkdocs serve
141
+ ```
142
+
143
+ ## Support
144
+
145
+ - 📖 [Documentation](https://dj-photon-codecs.readthedocs.io/)
146
+ - 💬 [GitHub Discussions](https://github.com/datajoint/dj-photon-codecs/discussions) - Questions and community
147
+ - 🐛 [GitHub Issues](https://github.com/datajoint/dj-photon-codecs/issues) - Bug reports and feature requests
148
+
149
+ ## Related Projects
150
+
151
+ - [DataJoint](https://datajoint.com) - Scientific data pipeline framework
152
+ - [anscombe-transform](https://github.com/datajoint/anscombe-transform) - Variance stabilization library
153
+ - [dj-zarr-codecs](https://github.com/datajoint/dj-zarr-codecs) - General Zarr array codec
154
+ - [Zarr](https://zarr.dev/) - Chunked, compressed array storage
155
+
156
+ ## License
157
+
158
+ Apache License 2.0. Copyright (c) 2026 DataJoint Inc.