Stretch linear astro data for easier visualization.
Project description
Auto Stretch
Automatically stretch linear astronomical images for easy visualization.
Auto Stretch applies a PixInsight-style Screen Transfer Function (STF) midtones transfer to linear astronomical images stored as numpy arrays. It automatically computes the optimal stretch parameters from the image data so that faint detail becomes visible without manual histogram adjustment.
| linear (no stretch) | arcsin stretch | auto-stretch (using this library) |
|---|---|---|
Installation
pip install auto-stretch
Quickstart
import numpy as np
from auto_stretch import apply_stretch, Stretch
image = np.array([[0.1, 0.25], [0.8, 0.3]], dtype=np.float64)
stretched = apply_stretch(image)
# or with custom parameters:
stretched = Stretch(target_bkg=0.25, shadows_clip=-1.25).stretch(image)
Input contract
- Input must be a 2D numpy array. 1D and 3D arrays raise
ValueError. - Input is coerced to float64 internally; the caller's array is never mutated.
- NaN pixels propagate through the stretch unchanged.
- Output is float64 with values clamped to
[0, 1].
Parameters
| Parameter | Default | Description |
|---|---|---|
target_bkg |
0.25 | Target median brightness after stretch |
shadows_clip |
-1.25 | Shadow clipping point in units of median absolute deviation below the median |
The underlying algorithm follows the PixInsight Histogram Transformation STF method.
Dependencies
- Python >= 3.10
- numpy >= 1.20
Credit
Based on the PixInsight Screen Transfer Function (STF) algorithm developed by Pleiades Astrophoto.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_stretch-1.0.0.tar.gz.
File metadata
- Download URL: auto_stretch-1.0.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfd054e1567f4145f1e444841491f45b19ce82438d10f92ee56f946c1b5de549
|
|
| MD5 |
0c62900dca8d9b5d17aa945987befb20
|
|
| BLAKE2b-256 |
38fb0a36871bfd0d15f59dd0a18c31668cae77d5e10fb50d08387d8474cd54eb
|
Provenance
The following attestation bundles were made for auto_stretch-1.0.0.tar.gz:
Publisher:
publish.yml on LCOGT/auto_stretch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
auto_stretch-1.0.0.tar.gz -
Subject digest:
bfd054e1567f4145f1e444841491f45b19ce82438d10f92ee56f946c1b5de549 - Sigstore transparency entry: 1392639483
- Sigstore integration time:
-
Permalink:
LCOGT/auto_stretch@afa5df178c7ce23ef7aa1e0ceabcb5398ac62041 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/LCOGT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afa5df178c7ce23ef7aa1e0ceabcb5398ac62041 -
Trigger Event:
push
-
Statement type:
File details
Details for the file auto_stretch-1.0.0-py3-none-any.whl.
File metadata
- Download URL: auto_stretch-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d811dc8719a30719dfafd67553e7431ef4b51768ea3bd77835f9be5514a8481
|
|
| MD5 |
b34a4a7d3a298d8f0fc8f42a61d53d85
|
|
| BLAKE2b-256 |
01b376505a6384360923c563e0b595a422fbe11bdacba930d0d07d97e8ef1328
|
Provenance
The following attestation bundles were made for auto_stretch-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on LCOGT/auto_stretch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
auto_stretch-1.0.0-py3-none-any.whl -
Subject digest:
9d811dc8719a30719dfafd67553e7431ef4b51768ea3bd77835f9be5514a8481 - Sigstore transparency entry: 1392639493
- Sigstore integration time:
-
Permalink:
LCOGT/auto_stretch@afa5df178c7ce23ef7aa1e0ceabcb5398ac62041 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/LCOGT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afa5df178c7ce23ef7aa1e0ceabcb5398ac62041 -
Trigger Event:
push
-
Statement type: