Skip to content

Commit 9bcaf10

Browse files
authored
Merge pull request #21 from JaneliaSciComp/use-hatch
Use hatch
2 parents 3946b05 + eaebdc7 commit 9bcaf10

29 files changed

+709
-1913
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ pip-wheel-metadata
4242

4343
# numba
4444
*/__pycache__/*
45+
46+
# docs
47+
site

.pre-commit-config.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
ci:
22
autoupdate_commit_msg: "chore: update pre-commit hooks"
33
autofix_commit_msg: "style: pre-commit fixes"
4+
autofix_prs: false
45
default_stages: [commit, push]
56
default_language_version:
67
python: python3
78
repos:
8-
- repo: https://github.com/psf/black
9-
rev: 22.12.0
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: 'v0.5.4'
1011
hooks:
11-
- id: black
12-
language_version: python3.9
12+
- id: ruff
13+
args: ["--fix", "--show-fixes"]
14+
- id: ruff-format
15+
- repo: https://github.com/codespell-project/codespell
16+
rev: v2.3.0
17+
hooks:
18+
- id: codespell
19+
args: ["-L", "ba,ihs,kake,nd,noe,nwo,te,fo,zar", "-S", "fixture"]
1320
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: v4.4.0
21+
rev: v4.6.0
1522
hooks:
1623
- id: check-yaml
17-
- repo: https://github.com/charliermarsh/ruff-pre-commit
18-
# Ruff version.
19-
rev: 'v0.0.245'
24+
- repo: https://github.com/pre-commit/mirrors-mypy
25+
rev: v1.11.0
2026
hooks:
21-
- id: ruff
22-
args: [--fix, --exit-non-zero-on-fix]
27+
- id: mypy
28+
files: src
29+
additional_dependencies:
30+
- numpy
31+
- typing_extensions
32+
# Tests
33+
- pytest

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# xarray-multiscale
2+
3+
Simple tools for creating multiscale representations of large images.
4+
5+
## Installation
6+
7+
`pip install xarray-multiscale`
8+
9+
## Motivation
10+
11+
Many image processing applications benefit from representing images at multiple scales (also known as [image pyramids] (https://en.wikipedia.org/wiki/Pyramid_(image_processing)). This package provides tools for generating lazy multiscale representations of N-dimensional data using [`xarray`](http://xarray.pydata.org/en/stable/) to ensure that the downsampled images have the correct axis coordinates.
12+
13+
Why are coordinates important for this application? Because a downsampled image is typically scaled and *translated* relative to the source image. Without a coordinate-aware representation of the data, the scaling and translation information is easily lost.
14+
15+
16+
## Usage
17+
18+
Generate a multiscale representation of a numpy array:
19+
20+
```python
21+
from xarray_multiscale import multiscale, windowed_mean
22+
import numpy as np
23+
24+
data = np.arange(4)
25+
print(*multiscale(data, windowed_mean, 2), sep='\n')
26+
"""
27+
<xarray.DataArray 's0' (dim_0: 4)> Size: 32B
28+
array([0, 1, 2, 3])
29+
Coordinates:
30+
* dim_0 (dim_0) float64 32B 0.0 1.0 2.0 3.0
31+
32+
<xarray.DataArray 's1' (dim_0: 2)> Size: 16B
33+
array([0, 2])
34+
Coordinates:
35+
* dim_0 (dim_0) float64 16B 0.5 2.5
36+
"""
37+
```
38+
39+
read more in the [project documentation](https://JaneliaSciComp.github.io/xarray-multiscale/).

README.rst

Lines changed: 0 additions & 144 deletions
This file was deleted.

docs/Makefile

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/api/chunks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: xarray_multiscale.chunks

docs/api/multiscale.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: xarray_multiscale.multiscale

docs/api/reducers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: xarray_multiscale.reducers

docs/api/util.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: xarray_multiscale.util

docs/conf.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)