Metadata-Version: 2.4
Name: pyHyperRI
Version: 1.0.1
Summary: Python package for hyperspectral radio interferometric imaging in astronomy.
Author: Chao Tang, Adrian Jackson
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/ChaoTang0330/py-hyper-ri
Project-URL: Documentation, https://chaotang0330.github.io/py-hyper-ri/
Project-URL: Source, https://github.com/ChaoTang0330/py-hyper-ri
Project-URL: Tracker, https://github.com/ChaoTang0330/py-hyper-ri/issues
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.3.5
Requires-Dist: h5py>=3.15.1
Requires-Dist: scipy>=1.17.0
Requires-Dist: astropy>=7.2.0
Requires-Dist: torch>=2.10.0
Requires-Dist: onnx2torch>=1.5.15
Requires-Dist: ptwt>=1.0.1
Requires-Dist: scikit-image>=0.26.0
Requires-Dist: torchkbnufft>=1.5.2
Requires-Dist: pytorch-finufft>=0.1.0
Provides-Extra: cuda
Requires-Dist: cufinufft>=2.2.0; extra == "cuda"
Provides-Extra: ms
Requires-Dist: python-casacore>=3.6.0; extra == "ms"
Provides-Extra: notebook
Requires-Dist: ipykernel; extra == "notebook"
Requires-Dist: jupyterlab; extra == "notebook"
Requires-Dist: matplotlib; extra == "notebook"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx==7.2.6; extra == "docs"
Requires-Dist: pytorch-sphinx-theme2==0.4.9; extra == "docs"
Requires-Dist: sphinxcontrib-katex==0.9.11; extra == "docs"
Requires-Dist: sphinx-copybutton==0.5.0; extra == "docs"
Requires-Dist: sphinx-design==0.6.1; extra == "docs"
Requires-Dist: myst-parser==4.0.1; extra == "docs"
Requires-Dist: myst-nb==1.3.0; extra == "docs"
Provides-Extra: all
Requires-Dist: cufinufft>=2.2.0; extra == "all"
Requires-Dist: python-casacore>=3.6.0; extra == "all"
Requires-Dist: ipykernel; extra == "all"
Requires-Dist: jupyterlab; extra == "all"
Requires-Dist: matplotlib; extra == "all"
Requires-Dist: pytest>=7.0; extra == "all"
Requires-Dist: black; extra == "all"
Requires-Dist: ruff; extra == "all"
Requires-Dist: build; extra == "all"
Requires-Dist: twine; extra == "all"
Requires-Dist: sphinx==7.2.6; extra == "all"
Requires-Dist: pytorch-sphinx-theme2==0.4.9; extra == "all"
Requires-Dist: sphinxcontrib-katex==0.9.11; extra == "all"
Requires-Dist: sphinx-copybutton==0.5.0; extra == "all"
Requires-Dist: sphinx-design==0.6.1; extra == "all"
Requires-Dist: myst-parser==4.0.1; extra == "all"
Requires-Dist: myst-nb==1.3.0; extra == "all"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/ChaoTang0330/py-hyper-ri/main/docs/_images/logo/pyHyperRI_logo_text_black.svg"
       alt="pyHyperRI" height="96">
</p>

[![python](https://img.shields.io/badge/Python-3.11+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![pytorch](https://img.shields.io/badge/PyTorch-enabled-EE4C2C.svg?style=flat&logo=pytorch)](https://pytorch.org)
[![PyPI version](https://img.shields.io/pypi/v/pyHyperRI.svg)](https://pypi.org/project/pyHyperRI/)
[![license](https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg)](https://github.com/ChaoTang0330/py-hyper-ri/blob/main/LICENSE)
[![CI](https://github.com/ChaoTang0330/py-hyper-ri/actions/workflows/ci.yml/badge.svg)](https://github.com/ChaoTang0330/py-hyper-ri/actions/workflows/ci.yml)
[![docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://chaotang0330.github.io/py-hyper-ri/)

<!-- TODO: Add DOI once available. -->

pyHyperRI is a PyTorch-based platform for developing, testing, and
benchmarking radio-interferometric (RI) imaging algorithms. The current package
focuses on intensity imaging, with workflows for both monochromatic and
distributed hyperspectral reconstruction.

The package is installed as `pyHyperRI` and imported in Python as `hyri`.

## Key Features

- Modular components for RI algorithm development: measurement operators,
  regularisers, denoisers, and optimisers.
- Intensity imaging workflows for monochromatic and hyperspectral data.
- Implemented algorithms: [uSARA](https://doi.org/10.1093/mnras/stac2672),
  [AIRI](https://doi.org/10.1093/mnras/stac2672),
  [cAIRI](https://doi.org/10.1093/mnras/staf022),
  [Hyper-uSARA](https://doi.org/10.3847/1538-4365/ae3149), and
  [HyperAIRI](https://doi.org/10.3847/1538-4365/ae3149).
- PyTorch-native device support across CPU, CUDA, MPS, and XPU where available.
- Distributed hyperspectral imaging through `torch.distributed`.
- NUFFT measurement operators with FINUFFT and TorchKbNUFFT backends.

## Installation

Install PyTorch first by following the
[official PyTorch installation guide](https://pytorch.org/get-started/locally/),
because the correct build depends on the operating system and target device.

Then install pyHyperRI:

```bash
pip install pyHyperRI
```

If CUDA devices are available, install the CUDA optional dependency group:

```bash
pip install "pyHyperRI[cuda]"
```

Measurement Set dependency is available through the `ms` optional
dependency group:

```bash
pip install "pyHyperRI[ms]"
```

Use this option mainly on Linux. On other systems, the
prerequisite `casacore` usually needs to be installed separately before installing
`python-casacore`. See the documentation for detailed installation guide.

For a source install:

```bash
git clone https://github.com/ChaoTang0330/py-hyper-ri.git
cd py-hyper-ri
pip install -e .
```

For development on Linux with CUDA devices, install all optional dependencies:

```bash
pip install -e ".[all]"
```

To verify the installation, run

```bash
hyri --help
```

We provide two Docker image variants with CUDA 12.8: development and runtime.
The development image includes editable source code, all optional dependencies,
tests, notebooks and documentation tools. The runtime image provides the installed
package with CUDA and Measurement Set dependencies for running imaging workflows.
Both images are available from
[GitHub Container Registry](https://github.com/ChaoTang0330/py-hyper-ri/pkgs/container/py-hyper-ri).
See the [Docker Images](https://chaotang0330.github.io/py-hyper-ri/installation.html#docker-images)
section of the installation guide for image details and customisation, and
[Run in a Container](https://chaotang0330.github.io/py-hyper-ri/usage.html#run-in-a-container)
for container usage.

## Minimal Example

Example measurements are available in the repository's
[`3c353_sim_vla_meas_hs`](https://github.com/ChaoTang0330/py-hyper-ri/tree/main/data/3c353_sim_vla_meas_hs)
folder. Place this folder under `./data` in your working directory, then run:

```bash
hyri imaging \
  --algorithm usara \
  --superresolution 1.5 \
  --data_file ./data/3c353_sim_vla_meas_hs
```

Use `hyri imaging --help` to inspect available command-line options.

## Documentation

Full documentation: [pyHyperRI documentation](https://chaotang0330.github.io/py-hyper-ri/).

The documentation covers the input data format, general usage, configuration
files, tutorials, and the API reference.

To build the documentation locally, the packages under the dependency group `docs` are required.

```bash
pip install -e ".[docs]"
make docs
```

## Citation

If you use pyHyperRI, please cite this software repository using the metadata in
[`CITATION.cff`](https://github.com/ChaoTang0330/py-hyper-ri/blob/main/CITATION.cff). If you use specific implemented methods, please
also cite the relevant method papers listed in the documentation.

## License

pyHyperRI is distributed under the [BSD 3-Clause License](https://github.com/ChaoTang0330/py-hyper-ri/blob/main/LICENSE).

## Dependencies

pyHyperRI builds on several external packages. The full dependency list is declared in
[`pyproject.toml`](https://github.com/ChaoTang0330/py-hyper-ri/blob/main/pyproject.toml). Main dependencies and their associated references are listed below.

| Package | Reference |
| --- | --- |
| [Astropy](https://www.astropy.org/) | Astropy Collaboration et al., [The Astropy Project: Sustaining and Growing a Community-oriented Open-source Project and the Latest Major Release](https://doi.org/10.3847/1538-4357/ac7c74), *The Astrophysical Journal*, 2022. |
| [casacore](https://casacore.github.io/casacore/) and [python-casacore](https://casacore.github.io/python-casacore/) | van Diepen, [Casacore Table Data System and its use in the MeasurementSet](https://doi.org/10.1016/j.ascom.2015.06.002), *Astronomy and Computing*, 2015. |
| [FINUFFT](https://finufft.readthedocs.io/) and [cuFINUFFT](https://finufft.readthedocs.io/en/latest/c_gpu.html) | Barnett et al., [A Parallel Nonuniform Fast Fourier Transform Library Based on an Exponential of Semicircle Kernel](https://doi.org/10.1137/18M120885X), *SIAM Journal on Scientific Computing*, 2019; Shih et al., [cuFINUFFT: a load-balanced GPU library for general-purpose nonuniform FFTs](https://doi.org/10.1109/IPDPSW52791.2021.00105), *IPDPSW*, 2021. |
| [h5py](https://github.com/h5py/h5py) | Andrew Collette and contributors, [h5py](https://github.com/h5py/h5py), BSD 3-Clause licensed software, 2008. |
| [NumPy](https://numpy.org/) | Harris et al., [Array programming with NumPy](https://doi.org/10.1038/s41586-020-2649-2), *Nature*, 2020. |
| [onnx2torch](https://github.com/ENOT-AutoDL/onnx2torch) | ENOT developers et al., [onnx2torch](https://github.com/ENOT-AutoDL/onnx2torch), Apache-2.0 licensed software, 2021. |
| [PyTorch](https://pytorch.org/) | Paszke et al., [PyTorch: An Imperative Style, High-Performance Deep Learning Library](https://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library), NeurIPS 2019. |
| [PyTorch Wavelet Toolbox](https://pytorch-wavelet-toolbox.readthedocs.io/en/latest/) | Wolter et al., [ptwt - The PyTorch Wavelet Toolbox](https://www.jmlr.org/papers/v25/23-0636.html), *Journal of Machine Learning Research*, 2024. |
| [scikit-image](https://scikit-image.org/) | van der Walt et al., [scikit-image: image processing in Python](https://doi.org/10.7717/peerj.453), *PeerJ*, 2014. |
| [SciPy](https://scipy.org/) | Virtanen et al., [SciPy 1.0: fundamental algorithms for scientific computing in Python](https://doi.org/10.1038/s41592-019-0686-2), *Nature Methods*, 2020. |
| [TorchKbNUFFT](https://torchkbnufft.readthedocs.io/en/stable/) | Muckley et al., [TorchKbNufft: A High-Level, Hardware-Agnostic Non-Uniform Fast Fourier Transform](https://mmuckley.github.io/assets/publications/2020muckleytorchkbnufft.pdf), *ISMRM Workshop on Data Sampling \& Image Reconstruction*, 2020. |
