|
| 1 | +# AstroRIM |
| 2 | +**Physics-Informed Inversion for Strong Gravitational Lensing (Conditional RIM + differentiable forward operator)** |
1 | 3 |
|
| 4 | +AstroRIM is an end-to-end pipeline for **gravitational lens inversion**: recovering an **unlensed source-plane image** from a **lensed observation** using a **Recurrent Inference Machine (RIM)** conditioned on a **learned, differentiable, physics-informed forward lensing operator**. |
| 5 | + |
| 6 | +This repository contains: |
| 7 | +- Simulation generators (Lenstronomy-based) for synthetic lens/source pairs |
| 8 | +- Inference/evaluation tooling (SSIM/MSE, FITS I/O, batch evaluation, residuals) |
| 9 | +- Real-lens preprocessing utilities (normalization, centering, enhancement) |
| 10 | +- Diagnostic/analysis tooling (mass profiles, summary figures) |
| 11 | +- Example figures/images used in the accompanying paper/report |
| 12 | + |
| 13 | +> **Author:** Jack Walsh |
| 14 | +> **Contact:** 20jwalsh@greystonescollege.ie |
| 15 | +> **School:** Greystones Community College |
| 16 | +
|
| 17 | +--- |
| 18 | + |
| 19 | +## Table of contents |
| 20 | +- [Repository layout](#repository-layout) |
| 21 | +- [Requirements](#requirements) |
| 22 | +- [Installation](#installation) |
| 23 | +- [Quickstart](#quickstart) |
| 24 | + - [1) Generate simulations](#1-generate-simulations) |
| 25 | + - [2) Run inference + evaluation](#2-run-inference--evaluation) |
| 26 | + - [3) Run diagnostics / mass-profile figures](#3-run-diagnostics--mass-profile-figures) |
| 27 | + - [4) Preprocess real-lens FITS](#4-preprocess-real-lens-fits) |
| 28 | +- [FITS format expectations](#fits-format-expectations) |
| 29 | +- [Reproducibility notes](#reproducibility-notes) |
| 30 | +- [Citing](#citing) |
| 31 | +- [License](#license) |
| 32 | +- [Contributing / Issues](#contributing--issues) |
| 33 | +- [Acknowledgements](#acknowledgements) |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Requirements |
| 40 | + |
| 41 | +### Core dependencies |
| 42 | +- Python 3.9+ (3.10+ recommended) |
| 43 | +- PyTorch (CUDA optional but recommended) |
| 44 | +- NumPy, SciPy, Matplotlib |
| 45 | +- Astropy (FITS + cosmology utilities) |
| 46 | +- scikit-image (metrics + preprocessing) |
| 47 | +- Lenstronomy (simulation / lens modeling) |
| 48 | + |
| 49 | +### Optional (used by some analysis tooling) |
| 50 | +- tqdm (progress bars) |
| 51 | +- pandas (CSV export / tables) |
| 52 | +- h5py (HDF5 export) |
| 53 | +- pyyaml (YAML config support) |
| 54 | +- joblib (caching) |
| 55 | +- scikit-learn (some utilities) |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Installation |
| 60 | + |
| 61 | +### Option A — pip + venv (simple) |
| 62 | +```bash |
| 63 | +python -m venv .venv |
| 64 | + |
| 65 | +# macOS/Linux: |
| 66 | +source .venv/bin/activate |
| 67 | + |
| 68 | +# Windows: |
| 69 | +# .venv\Scripts\activate |
| 70 | + |
| 71 | +python -m pip install --upgrade pip |
| 72 | + |
| 73 | +# Core packages |
| 74 | +pip install numpy scipy matplotlib astropy scikit-image lenstronomy |
| 75 | + |
| 76 | +# Install PyTorch (choose the correct command for your OS/CUDA) |
| 77 | +# https://pytorch.org/get-started/locally/ |
| 78 | + |
| 79 | +# Optional extras |
| 80 | +pip install tqdm pandas h5py pyyaml joblib scikit-learn |
0 commit comments