PYthon Radio Astronomy anaLYSis and Image Synthesis
Project description
Pyralysis
Pyralysis is an open-source Python library for radio astronomy imaging, simulation, and optimization. It is designed to be easy to install, learn, and use for modern radio interferometry workflows.
For full documentation, tutorials, and API reference, see the Pyralysis documentation on ReadTheDocs:
Install in three steps
Stable releases are published on PyPI (pin pyralysis==X.Y.Z when you need a fixed version).
For commits not yet released, install from GitLab (see the installation guide).
-
1. Create a Python environment (Python 3.9–3.12 recommended). Use whatever you prefer:
conda,mamba,micromamba, or plainvenv. -
2. Install from PyPI using the SKA extra index (needed so pip can resolve some dependencies).
pip install --extra-index-url https://artefact.skao.int/repository/pypi-internal/simple pyralysis[all]
This installs the latest published PyPI release plus common optional dependencies (FFT, notebooks, tests). For CuPy / GPU, use pyralysis[all,cupy] or pyralysis[cupy] only.
For editable installs, conda env files, or Docker images, see:
Minimal example
Start by simulating a small dataset and then add thermal noise:
from pyralysis.io.antenna_config_io import AntennaConfigurationIo
from pyralysis.simulation import Simulator
from pyralysis.models.sky import PointSource
from pyralysis.injectors import ThermalNoiseInjector
# Load array configuration
interferometer = AntennaConfigurationIo(input_name="path/to/array.cfg").read()
interferometer.configure_observation(
min_frequency_hz=1e9, max_frequency_hz=1.1e9, frequency_step_hz=1e7,
right_ascension="12:00:00", declination="45:00:00",
integration_time=10, observation_time="1h"
)
# Define a source and simulate
source = PointSource(
reference_intensity=1.0,
sky_position="12:00:00 45:00:00",
reference_frequency=1e9,
)
sim = Simulator(interferometer=interferometer, sources=source)
dataset = sim.simulate(create_dataset=True)
# Add thermal noise
thermal = ThermalNoiseInjector(system_temperature=50, integration_time=10, channel_bandwidth=1e6)
noisy_dataset = thermal.apply(dataset)
For more simulation examples (arrays, sky models, injectors, and data access), see:
Reconstruction example
Next, reconstruct an image from the (noisy) visibilities using an objective function and L‑BFGS:
from pyralysis.reconstruction import Image
from pyralysis.optimization import ObjectiveFunction
from pyralysis.optimization.terms import ChiSquared, L1Norm
from pyralysis.optimization.optimizer import LBFGS
from pyralysis.measurement import ModelVisibility
# Create initial image (e.g. empty sky model)
image = Image.empty(imsize=(512, 512), cellsize=0.001) # adjust to your case
# Build model visibility from dataset and image
model_visibility = ModelVisibility(dataset=noisy_dataset, image=image)
# Define objective function: data fidelity + simple L1 regularization
terms = [
ChiSquared(model_visibility=model_visibility, penalization_factor=1.0),
L1Norm(penalization_factor=0.01),
]
objective = ObjectiveFunction(term_list=terms, image=image, persist_gradient=True)
# Run L-BFGS reconstruction
optimizer = LBFGS(objective_function=objective, parameter=image)
reconstructed_image = optimizer.optimize()
For detailed reconstruction workflows (measurement operator, regularizers, optimizers), see:
Examples in this repository
- Jupyter notebooks are in
examples/notebooks/. - CLI scripts are in
examples/scripts/, split by style:*_components.pyfor explicit class composition.*_pipeline.pyfor pipeline-based orchestration.
- Current paired scripts:
dirtymapper_components.py/dirtymapper_pipeline.pyoptimization_components.py/optimization_pipeline.pysimulation_components.py/simulation_pipeline.py
See the documentation page for quick usage patterns:
Learn more
- User guide and tutorials: https://pyralysis.readthedocs.io/en/latest/
- API reference: https://pyralysis.readthedocs.io/en/latest/api/index.html
- Data model and measurement operator: https://pyralysis.readthedocs.io/en/latest/data_model.html
- Versioning policy: https://pyralysis.readthedocs.io/en/latest/versioning.html
Contributing and development
- Versioning and releases (SemVer, tags, setuptools-scm): Versioning
- Running tests and quality: Testing & QA
- Issue tracker: https://gitlab.com/clirai/pyralysis/-/issues
Citation and license
If you use Pyralysis in your research, please consider citing:
@software{carcamo2021pyralysis,
author = {Miguel Cárcamo},
title = {Pyralysis: A Python framework for radio interferometric imaging and simulation},
year = {2021},
url = {https://gitlab.com/clirai/pyralysis},
note = {https://pyralysis.readthedocs.io}
}
Pyralysis is distributed under the terms of the GNU General Public License version 3 (GPLv3).
See LICENSE for details.
Contact
- Documentation: https://pyralysis.readthedocs.io
- Issues: https://gitlab.com/clirai/pyralysis/-/issues
- Lead developer: miguel.carcamo@usach.cl
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 pyralysis-1.1.0.tar.gz.
File metadata
- Download URL: pyralysis-1.1.0.tar.gz
- Upload date:
- Size: 12.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff0bbf8718576fdc58dcf18eb175075723cf671112e997183097a8259054602d
|
|
| MD5 |
6f490e101a284608ba766c709f696c85
|
|
| BLAKE2b-256 |
61b20c376f28f9ff15e59a8fc4f28e0a30fa557964b09c0a1870770a359a4c22
|
File details
Details for the file pyralysis-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyralysis-1.1.0-py3-none-any.whl
- Upload date:
- Size: 908.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c3a562ae4d22bf6327f9550c6a9571163987c2ee04214dd06a37d0d2ef8da53
|
|
| MD5 |
0f4077099d425c43eccaed6de2c151d8
|
|
| BLAKE2b-256 |
a7d30c903ea24cb97db85fe5dc19a35af738a962ab293ab0629f4631d06344b0
|