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

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 plain venv.

  • 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.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.1.0.tar.gz (12.5 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.1.0-py3-none-any.whl (908.4 kB view details)

Uploaded Python 3

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

Hashes for pyralysis-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ff0bbf8718576fdc58dcf18eb175075723cf671112e997183097a8259054602d
MD5 6f490e101a284608ba766c709f696c85
BLAKE2b-256 61b20c376f28f9ff15e59a8fc4f28e0a30fa557964b09c0a1870770a359a4c22

See more details on using hashes here.

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

Hashes for pyralysis-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c3a562ae4d22bf6327f9550c6a9571163987c2ee04214dd06a37d0d2ef8da53
MD5 0f4077099d425c43eccaed6de2c151d8
BLAKE2b-256 a7d30c903ea24cb97db85fe5dc19a35af738a962ab293ab0629f4631d06344b0

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