Skip to main content

A Python package for exoplanet data processing, featuring an implementation of the fundamental KLIP algorithm using PyTorch.

Project description

torchKLIP

torchKLIP is a PyTorch implementation of the PCA-based Karhunen–Loève Image Projection (KLIP) algorithm for point spread function (PSF) subtraction in the direct imaging of exoplanets.

Set-Up

Choose one of the following methods depending on your workflow.

Recommended: Create an isolated environment first to avoid dependency conflicts. For example, using conda:

conda create -n torchklip python=3.11
conda activate torchklip

Install from PyPI

Install the stable version with:

pip install torchKLIP

Install from GitHub

Install the latest code directly from the repository:

pip install git+ssh://git@github.com/astrochialinko/torchKLIP.git

Development Mode

If you plan to contribute or customize the code, fork the repository on GitHub and clone your fork:

# Fork on GitHub, then:
git clone git@github.com:<your-github-username>/torchKLIP.git
cd torchKLIP

If you're hacking locally without contributing back, you can clone the main repo directly:

git clone git@github.com:astrochialinko/torchKLIP.git
cd torchKLIP

Install in editable mode:

pip install -r requirements.txt
python setup.py develop

Jupyter Notebook

If you plan to use Jupyter Notebook, as recommended, install a Jupyter kernel from this environment:

python3 -m ipykernel install --user --name "torchklip" --display-name "torchklip"

Quick Start

Open the example notebook and choose the torchklip kernel:

jupyter notebook notebooks/tutorial_betaPic.ipynb

Project Structure

.
├── LICENSE                          # License information
├── README.md                        # This overview file
├── data/                            # (Optional) Example data or staging area
├── docs/                            # Documentation sources (Sphinx/ReadTheDocs)
├── logs/                            # Runtime logs and profiler output
├── notebooks/                       # Jupyter notebooks for tutorials and experiments
│   └── tutorial_betaPic.ipynb       # Demo notebook on Beta Pictoris dataset
├── pyproject.toml                   # Build configuration and metadata
├── src/torchklip/                   # Core package source code
│   ├── __init__.py                  # Package entry point
│   ├── algos/                       # KLIP algorithm implementations
│   │   ├── __init__.py
│   │   └── klip/                    # SVD, Eign, and PCA solver for KLIP
│   │       ├── __init__.py
│   │       ├── eigh.py              # Eigensolver using SciPy
│   │       ├── klip_base.py         # Base KLIP class and common logic
│   │       ├── pca.py               # PCA-based projection implementation
│   │       └── svd.py               # SVD-based projection variant
│   ├── config.py                    # Configuration management and defaults
│   ├── dataproc/                    # Data loading and preprocessing
│   │   ├── __init__.py
│   │   ├── data_loader.py           # Dataloader for FITS or image stacks
│   │   └── data_preprocessor.py     # Centering, scaling, and cropping routines
│   └── utils/                       # Utility functions and helpers
│       ├── __init__.py
│       ├── image_plot.py            # Plotting routines for results
│       ├── logging_utils.py         # Setup for structured logging
│       ├── metrics_renderer.py      # metric computations
│       ├── profiler.py              # Timing and performance profiling
│       └── snr.py                   # Signal-to-noise ratio calculations
└── tests/                           # Unit tests

Citation

If you use torchKLIP in your research, please cite Ko et al. (2024)

C.-L. Ko, E. S. Douglas, and J. Hom. A pytorch benchmark for high- contrast imaging post processing. In Applications of Machine Learning 2024, vol. 13138, pp. 229–236. SPIE, 2024. [doi:10.1117/12.3027407]

Acknowledgments

  • Thanks the Code/Astro Workshop for providing valuable training in the development of open-source software packages

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchklip-0.1.0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchklip-0.1.0-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file torchklip-0.1.0.tar.gz.

File metadata

  • Download URL: torchklip-0.1.0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for torchklip-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3b31426ef782b7ecec01227961700d19cc55165a9b55d61bde5ec772400db8c
MD5 b1852d421070ec5a0bfcecc1d02667b7
BLAKE2b-256 11b2575aca8e5d23604452f2f3146d1cd720169fe19db7c7758611e7154e82eb

See more details on using hashes here.

File details

Details for the file torchklip-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: torchklip-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for torchklip-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5d64ccdd0eaaa25b9b79f1479c23441bc1292327eead8aa365701764f95f2a8
MD5 f566d09d9e34e00b7d96a989a520a98f
BLAKE2b-256 ae71eb82d1e3923e6334d7e81253bbbee4e365c26b14ab5252d1b805cc8aef1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page