Skip to main content

PYthon Radio Astronomy anaLYSis and Image Synthesis

Project description

Pyralysis logo

codecov pre-commit Documentation GitLab Contributors

Python Version PyPI Version PyPI Downloads

Docker Image Version License Documentation Status

Pipeline Status


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

  • 1. Create a Python environment (Python 3.9–3.12 recommended). Use whatever you prefer: conda, mamba, micromamba, or plain venv.

  • 2. Install from PyPI using the SKA extra index.

pip install --extra-index-url https://artefact.skao.int/repository/pypi-internal/simple pyralysis[all]

This installs Pyralysis plus the common optional dependencies (FFT and GPU‑related extras, where available). If you need a development install, specific environments, 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.py for explicit class composition.
    • *_pipeline.py for pipeline-based orchestration.
  • Current paired scripts:
    • dirtymapper_components.py / dirtymapper_pipeline.py
    • optimization_components.py / optimization_pipeline.py
    • simulation_components.py / simulation_pipeline.py

See the documentation page for quick usage patterns:


Learn more


Contributing and development


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

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

pyralysis-1.0.0.tar.gz (12.6 MB view details)

Uploaded Source

Built Distribution

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

pyralysis-1.0.0-py3-none-any.whl (918.6 kB view details)

Uploaded Python 3

File details

Details for the file pyralysis-1.0.0.tar.gz.

File metadata

  • Download URL: pyralysis-1.0.0.tar.gz
  • Upload date:
  • Size: 12.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyralysis-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0093ccb6307e47f8d72d16bd886092c7cffdcc26569c6e0aded8eb5cb0e31d5d
MD5 e1a29e26b1e6c7f1cec4eefb1346e488
BLAKE2b-256 e51c74ba3216b2af23df44190ee43d2fdca597563267a2904fb18c2a63725f61

See more details on using hashes here.

File details

Details for the file pyralysis-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyralysis-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 918.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyralysis-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 197c203adb5d76a3c03ffcc3e0be3b7a825008a94ad4e2dda20f9e6e35c49101
MD5 70a6242483760b1b174252b4185a3565
BLAKE2b-256 a99fe5212da91bf53b7985a7c15ddf1dd126ee3251ba1b0d7becdb0770ebd0b9

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