Skip to content

Commit

Permalink
Merge pull request #21 from JaneliaSciComp/use-hatch
Browse files Browse the repository at this point in the history
Use hatch
  • Loading branch information
d-v-b authored Jul 24, 2024
2 parents 3946b05 + eaebdc7 commit 9bcaf10
Show file tree
Hide file tree
Showing 29 changed files with 709 additions and 1,913 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ pip-wheel-metadata

# numba
*/__pycache__/*

# docs
site
31 changes: 21 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autofix_prs: false
default_stages: [commit, push]
default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 22.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.5.4'
hooks:
- id: black
language_version: python3.9
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["-L", "ba,ihs,kake,nd,noe,nwo,te,fo,zar", "-S", "fixture"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.245'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: mypy
files: src
additional_dependencies:
- numpy
- typing_extensions
# Tests
- pytest
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# xarray-multiscale

Simple tools for creating multiscale representations of large images.

## Installation

`pip install xarray-multiscale`

## Motivation

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.

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.


## Usage

Generate a multiscale representation of a numpy array:

```python
from xarray_multiscale import multiscale, windowed_mean
import numpy as np

data = np.arange(4)
print(*multiscale(data, windowed_mean, 2), sep='\n')
"""
<xarray.DataArray 's0' (dim_0: 4)> Size: 32B
array([0, 1, 2, 3])
Coordinates:
* dim_0 (dim_0) float64 32B 0.0 1.0 2.0 3.0
<xarray.DataArray 's1' (dim_0: 2)> Size: 16B
array([0, 2])
Coordinates:
* dim_0 (dim_0) float64 16B 0.5 2.5
"""
```

read more in the [project documentation](https://JaneliaSciComp.github.io/xarray-multiscale/).
144 changes: 0 additions & 144 deletions README.rst

This file was deleted.

19 changes: 0 additions & 19 deletions docs/Makefile

This file was deleted.

1 change: 1 addition & 0 deletions docs/api/chunks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: xarray_multiscale.chunks
1 change: 1 addition & 0 deletions docs/api/multiscale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: xarray_multiscale.multiscale
1 change: 1 addition & 0 deletions docs/api/reducers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: xarray_multiscale.reducers
1 change: 1 addition & 0 deletions docs/api/util.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: xarray_multiscale.util
63 changes: 0 additions & 63 deletions docs/conf.py

This file was deleted.

Loading

0 comments on commit 9bcaf10

Please sign in to comment.