MPoL: PyTorch for Radio Imaging
MPoL: PyTorch for Radio Imaging
24 January 2025
Summary
Astronomical radio interferometers achieve exquisite angular resolution by cross-
correlating signal from a cosmic source simultaneously observed by distant pairs of
radio telescopes to produce a Fourier-type measurement called a visibility. Million
Points of Light (MPoL) is a Python library supporting feed-forward modeling of
interferometric visibility datasets for synthesis imaging and parametric Bayesian
inference, built using the autodifferentiable machine learning framework PyTorch.
Neural network components provide a rich set of modular and composable
building blocks that can be used to express the physical relationships between
latent model parameters and observed data following the radio interferometric
measurement equation. Industry-grade optimizers make it straightforward to
simultaneously solve for the synthesized image and calibration parameters using
stochastic gradient descent.
Statement of need
When an astrophysical source is observed by a radio interferometer, there are
frequently large gaps in the spatial frequency coverage. Therefore, rather than
1
perform a direct Fourier inversion, images must be synthesized from the visibility
data using an imaging algorithm; it is common for the incomplete sampling to
severely hamper image fidelity (Condon & Ransom, 2016; Thompson et al., 2017).
CLEAN is the traditional image synthesis algorithm of the radio interferometry
community (Högbom, 1974), with a modern implementation in the reduction
and analysis software CASA (CASA Team et al., 2022; McMullin et al., 2007),
the standard for current major facility operations (e.g., Hunter et al., 2023).
CLEAN excels at the rapid imaging of astronomical fields comprising unresolved
point sources (e.g. quasars) and marginally resolved sources, but may struggle
when the source morphology is not well-matched by the CLEAN basis set (e.g.,
point sources, Gaussians), a common situation with ring-like protoplanetary disk
sources (Disk Dynamics Collaboration et al., 2020, sec. 3).
High fidelity imaging algorithms for spatially resolved sources are needed to
realize the full scientific potential of groundbreaking observatories like the Ata-
cama Large Millimeter Array (ALMA; Wootten & Thompson (2009)), the Event
Horizon Telescope (Event Horizon Telescope Collaboration, et al., 2019), and
the Square Kilometer Array (Dewdney et al., 2009) as they deliver significantly
improved sensitivity and resolving power compared to previous generation in-
struments. In the field of planet formation alone, spatially resolved observations
from ALMA have rapidly advanced our understanding of protoplanetary disk
structures (Andrews, 2020), kinematic signatures of embedded protoplanets
(Pinte et al., 2018), and circumplanetary disks (Benisty et al., 2021; Casassus &
Cárcamo, 2022). Application of higher performance imaging techniques to these
groundbreaking datasets (e.g., Casassus & Cárcamo, 2022) showed great promise
in unlocking further scientific progress. Simultaneously, a flexible, open-source
platform could integrate machine learning algorithms and computational imaging
techniques from non-astronomy fields.
2
the array baselines, and the negative log likelihood to calculate a data loss.
Backpropagation (see Baydin et al., 2018 for a review) and stochastic gradient
descent (e.g., AdamW, Loshchilov & Hutter, 2017) are used to find the true-sky
model that minimizes the loss function. However, because of the aforementioned
gaps in spatial frequency coverage, there is technically an infinite number of
true-sky images fully consistent with the data likelihood, so regularization loss
terms are required. MPoL supports Regularized Maximum Likelihood (RML)
imaging with common regularizers like maximum entropy, sparsity, and others
(e.g., as used in Event Horizon Telescope Collaboration 2019); users can also
implement custom regularizers with PyTorch.
MPoL also provides several other workflows relevant to astrophysical research.
First, by seamlessly coupling with the probabilistic programming language Pyro
(Bingham et al., 2019), MPoL supports Bayesian parametric inference of astro-
nomical sources by modeling the data visibilities. Second, users can implement
additional data calibration components as their data requires, enabling fine-scale,
residual calibration physics to be parameterized and optimized simultaneously
with image synthesis (following the radio interferometric measurement equa-
tion Hamaker et al., 1996; Smirnov, 2011). Finally, the library also provides
convenience utilities like DirtyImager (including Briggs robust and UV taper)
to confirm the data has been loaded correctly. The MPoL-dev organization
also develops the MPoL-dev/visread package, which is designed to facilitate the
extraction of visibility data from CASA’s Measurement Set format for use in
alternative imaging workflows.
3
at comparable sensitivity. Dia et al. (2023) used MPoL as a reference imaging
implementation to evaluate the performance of their score-based prior algorithm.
Huang et al. (2024) used the parametric inference capabilities of MPoL to analyze
radial dust substructures in a suite of eight protoplanetary disks in the σ Orionis
stellar cluster. MPoL was selected as an imaging technology of the exoALMA
large program, where Zawadzki et al. 2024 submitted used RML imaging to
obtain high resolution image cubes of molecular line emission in protoplanetary
disks in order to identify non-Keplerian features that may trace planet-disk
interactions.
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0
Figure 1: Left: the synthesized image produced by the DSHARP ALMA Large
Program (Andrews et al., 2018) using CASA/tclean. Right: The regularized
maximum likelihood image produced using MPoL on the same data. Both images
are displayed using a sqrt stretch, with upper limit truncated to 70% and 40% of
max value for CLEAN and MPoL, respectively, to emphasize faint features. The
CLEAN algorithm permits negative intensity values, while the MPoL algorithm
enforces image positivity by construction. Each side of the image is 3 arcseconds.
Intensity units are shown in units of Jy/arcsec2 .
Similar tools
Recently, there has been significant work to design robust algorithms to image
spatially resolved sources. A non-exhaustive list includes the RESOLVE family
of algorithms (Junklewitz et al., 2016), which impose Gaussian random field
image priors, the multi-algorithm approach of the Event Horizon Telescope
Collaboration (Event Horizon Telescope Collaboration 2019) including regu-
larized maximum likelihood techniques, MaxEnt (Cárcamo et al., 2018), and
4
domain-specific non-parametric 1D approaches like frank (Jennings et al., 2020).
Several approaches have leveraged deep-learning, such as score-based priors (Dia
et al., 2023), denoising diffusion probabilistic models (Wang et al., 2023), and
residual-to-residual deep neural networks (Dabbech et al., 2024). By contrast to
many imaging software programs, MPoL is designed as a library, and so in theory
can support a variety of forward-modeling workflows.
The parametric modeling capabilities of MPoL, provided by integration with Pyro,
are similar to the emcee (Foreman-Mackey et al., 2013) + synthetic visibility
workflow provided by the Galario software (Tazzari et al., 2018). Since PyTorch
enables automatic differentiation, Pyro users can utilize HMC/NUTS sampling
(Hoffman et al., 2014; Neal, 2012) or SVI, which offer significant benefits in high
dimensional spaces compared to ensemble MCMC samplers.
Acknowledgements
We acknowledge funding from an ALMA Development Cycle 8 grant number
AST-1519126. J.H. acknowledges support by the National Science Foundation
under Grant No. 2307916. ALMA is a partnership of ESO (representing its
member states), NSF (USA) and NINS (Japan), together with NRC (Canada),
MOST and ASIAA (Taiwan), and KASI (Republic of Korea), in cooperation
with the Republic of Chile. The Joint ALMA Observatory is operated by ESO,
AUI/NRAO and NAOJ. The National Radio Astronomy Observatory is a facility
of the National Science Foundation operated under cooperative agreement by
Associated Universities, Inc.
References
Andrews, S. M. (2020). Observations of Protoplanetary Disk Structures. Annual
Review of Astronomy and Astrophysics, 58, 483–528. https://doi.org/10.114
6/annurev-astro-031220-010302
Andrews, S. M., Huang, J., Pérez, L. M., Isella, A., Dullemond, C. P., Kurtovic,
N. T., Guzmán, V. V., Carpenter, J. M., Wilner, D. J., Zhang, S., Zhu,
Z., Birnstiel, T., Bai, X.-N., Benisty, M., Hughes, A. M., Öberg, K. I., &
Ricci, L. (2018). The Disk Substructures at High Angular Resolution Project
(DSHARP). I. Motivation, Sample, Calibration, and Overview. Astrophysical
Journal Letters, 869 (2), L41. https://doi.org/10.3847/2041-8213/aaf741
Baydin, A. G., Pearlmutter, B. A., Radul, A. A., & Siskind, J. M. (2018).
Automatic differentiation in machine learning: A survey. Journal of Machine
Learning Research, 18 (153), 1–43. http://jmlr.org/papers/v18/17-468.html
Benisty, M., Bae, J., Facchini, S., Keppler, M., Teague, R., Isella, A., Kurtovic,
N. T., Pérez, L. M., Sierra, A., Andrews, S. M., Carpenter, J., Czekala, I.,
Dominik, C., Henning, T., Menard, F., Pinilla, P., & Zurlo, A. (2021). A
Circumplanetary Disk around PDS70c. The Astrophysical Journal Letters,
916 (1), L2. https://doi.org/10.3847/2041-8213/ac0f83
5
Bingham, E., Chen, J. P., Jankowiak, M., Obermeyer, F., Pradhan, N., Karalet-
sos, T., Singh, R., Szerlip, P., Horsfall, P., & Goodman, N. D. (2019). Pyro:
Deep universal probabilistic programming. J. Mach. Learn. Res., 20 (1),
973–978.
Bishop, C. M., & Bishop, H. (2023). Deep learning - foundations and concepts
(S. Cham, Ed.; 1st ed.). https://doi.org/https://doi.org/10.1007/978-3-031-
45468-4
Cárcamo, M., Román, P. E., Casassus, S., Moral, V., & Rannou, F. R. (2018).
Multi-GPU maximum entropy image synthesis for radio astronomy. Astron-
omy and Computing, 22, 16–27. https://doi.org/https://doi.org/10.1016/j.as
com.2017.11.003
CASA Team, Bean, B., Bhatnagar, S., Castro, S., Donovan Meyer, J., Emonts, B.,
Garcia, E., Garwood, R., Golap, K., Gonzalez Villalba, J., Harris, P., Hayashi,
Y., Hoskins, J., Hsieh, M., Jagannathan, P., Kawasaki, W., Keimpema, A.,
Kettenis, M., Lopez, J., . . . Kern, J. (2022). CASA, the Common Astronomy
Software Applications for Radio Astronomy. Publications of the Astronomical
Society of the Pacific, 134 (1041), 114501. https://doi.org/10.1088/1538-
3873/ac9642
Casassus, S., & Cárcamo, M. (2022). Variable structure in the PDS 70 disc and
uncertainties in radio-interferometric image restoration. 513 (4), 5790–5798.
https://doi.org/10.1093/mnras/stac1285
Condon, J. J., & Ransom, S. M. (2016). Essential Radio Astronomy.
Dabbech, A., Aghabiglou, A., Chu, C. S., & Wiaux, Y. (2024). CLEANing
Cygnus A Deep and Fast with R2D2. The Astrophysical Journal Letters,
966 (2), L34. https://doi.org/10.3847/2041-8213/ad41df
Dewdney, P. E., Hall, P. J., Schilizzi, R. T., & Lazio, T. J. L. W. (2009).
The Square Kilometre Array. IEEE Proceedings, 97 (8), 1482–1496. https:
//doi.org/10.1109/JPROC.2009.2021005
Dia, N., Yantovski-Barth, M. J., Adam, A., Bowles, M., Lemos, P., Scaife, A. M.
M., Hezaveh, Y., & Perreault-Levasseur, L. (2023). Bayesian Imaging for Ra-
dio Interferometry with Score-Based Priors. arXiv e-Prints, arXiv:2311.18012.
https://doi.org/10.48550/arXiv.2311.18012
Disk Dynamics Collaboration, Armitage, P. J., Bae, J., Benisty, M., Bergin,
E. A., Casassus, S., Czekala, I., Facchini, S., Fung, J., Hall, C., Ilee, J.
D., Keppler, M., Kuznetsova, A., Le Gal, R., Loomis, R. A., Lyra, W.,
Manger, N., Perez, S., Pinte, C., . . . Zhang, K. (2020). Visualizing the
Kinematics of Planet Formation. arXiv e-Prints, arXiv:2009.04345. https:
//doi.org/10.48550/arXiv.2009.04345
Event Horizon Telescope Collaboration. . . . (2019). First M87 Event Horizon
Telescope Results. IV. Imaging the Central Supermassive Black Hole. The
Astrophysical Journal Letters, 875 (1), L4. https://doi.org/10.3847/2041-
8213/ab0e85
Event Horizon Telescope Collaboration. . . . . (2019). First M87 Event Horizon
Telescope Results. I. The Shadow of the Supermassive Black Hole. The
Astrophysical Journal Letters, 875 (1), L1. https://doi.org/10.3847/2041-
8213/ab0ec7
6
Foreman-Mackey, D., Hogg, D. W., Lang, D., & Goodman, J. (2013). emcee:
The MCMC Hammer. 125 (925), 306. https://doi.org/10.1086/670067
Guzmán, V. V., Huang, J., Andrews, S. M., Isella, A., Pérez, L. M., Carpenter, J.
M., Dullemond, C. P., Ricci, L., Birnstiel, T., Zhang, S., Zhu, Z., Bai, X.-N.,
Benisty, M., Öberg, K. I., & Wilner, D. J. (2018). The Disk Substructures
at High Angular Resolution Program (DSHARP). VIII. The Rich Ringed
Substructures in the AS 209 Disk. 869 (2), L48. https://doi.org/10.3847/2041-
8213/aaedae
Hamaker, J. P., Bregman, J. D., & Sault, R. J. (1996). Understanding radio
polarimetry. I. Mathematical foundations. 117, 137–147.
Harris, C. R., Millman, K. J., Walt, S. J. van der, Gommers, R., Virtanen, P.,
Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R.,
Picus, M., Hoyer, S., Kerkwijk, M. H. van, Brett, M., Haldane, A., Río, J. F.
del, Wiebe, M., Peterson, P., . . . Oliphant, T. E. (2020). Array programming
with NumPy. Nature, 585 (7825), 357–362. https://doi.org/10.1038/s41586-
020-2649-2
Hoffman, M. D., Gelman, A., & others. (2014). The no-u-turn sampler: Adap-
tively setting path lengths in hamiltonian monte carlo. J. Mach. Learn. Res.,
15 (1), 1593–1623.
Högbom, J. A. (1974). Aperture Synthesis with a Non-Regular Distribution of
Interferometer Baselines. Astronomy and Astrophysics Supplement, 15, 417.
Huang, J., Andrews, S. M., Pérez, L. M., Zhu, Z., Dullemond, C. P., Isella, A.,
Benisty, M., Bai, X.-N., Birnstiel, T., Carpenter, J. M., Guzmán, V. V.,
Hughes, A. M., Öberg, K. I., Ricci, L., Wilner, D. J., & Zhang, S. (2018).
The Disk Substructures at High Angular Resolution Project (DSHARP). III.
Spiral Structures in the Millimeter Continuum of the Elias 27, IM Lup, and
WaOph 6 Disks. 869 (2), L43. https://doi.org/10.3847/2041-8213/aaf7a0
Huang, J., Ansdell, M., Birnstiel, T., Czekala, I., Long, F., Williams, J., Zhang, S.,
& Zhu, Z. (2024). High-resolution ALMA Observations of Richly Structured
Protoplanetary Disks in σ Orionis. The Astrophysical Journal, 976 (1), 132.
https://doi.org/10.3847/1538-4357/ad84df
Hunter, T. R., Indebetouw, R., Brogan, C. L., Berry, K., Chang, C.-S., Francke,
H., Geers, V. C., Gómez, L., Hibbard, J. E., Humphreys, E. M., Kent, B. R.,
Kepley, A. A., Kunneriath, D., Lipnicky, A., Loomis, R. A., Mason, B. S.,
Masters, J. S., Maud, L. T., Muders, D., . . . Yoon, I. (2023). The ALMA
Interferometric Pipeline Heuristics. 135 (1049), 074501. https://doi.org/10.1
088/1538-3873/ace216
Jennings, J., Booth, R. A., Tazzari, M., Rosotti, G. P., & Clarke, C. J. (2020).
frankenstein: protoplanetary disc brightness profile reconstruction at sub-
beam resolution with a rapid Gaussian process. Monthly Notices of the RAS,
495 (3), 3209–3232. https://doi.org/10.1093/mnras/staa1365
Junklewitz, H., Bell, M. R., Selig, M., & Enßlin, T. A. (2016). RESOLVE: A
new algorithm for aperture synthesis imaging of extended emission in radio
astronomy. 586, A76. https://doi.org/10.1051/0004-6361/201323094
Loshchilov, I., & Hutter, F. (2017). Decoupled Weight Decay Regularization.
arXiv e-Prints, arXiv:1711.05101. https://doi.org/10.48550/arXiv.1711.0510
7
1
McMullin, J. P., Waters, B., Schiebel, D., Young, W., & Golap, K. (2007). CASA
Architecture and Applications. In R. A. Shaw, F. Hill, & D. J. Bell (Eds.),
Astronomical data analysis software and systems XVI ASP conference series
(Vol. 376, p. 127).
Muckley, M. J., Stern, R., Murrell, T., & Knoll, F. (2020). TorchKbNufft: A
high-level, hardware-agnostic non-uniform fast Fourier transform.
Neal, R. M. (2012). MCMC using hamiltonian dynamics. arXiv Preprint
arXiv:1206.1901.
Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen,
T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Köpf, A., Yang, E.,
DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L.,
. . . Chintala, S. (2019). PyTorch: An Imperative Style, High-Performance
Deep Learning Library. arXiv e-Prints, arXiv:1912.01703. https://doi.org/
10.48550/arXiv.1912.01703
Pinte, C., Price, D. J., Ménard, F., Duchêne, G., Dent, W. R. F., Hill, T., de
Gregorio-Monsalvo, I., Hales, A., & Mentiplay, D. (2018). Kinematic Evidence
for an Embedded Protoplanet in a Circumstellar Disk. The Astrophysical
Journal Letters, 860 (1), L13. https://doi.org/10.3847/2041-8213/aac6dc
Smirnov, O. M. (2011). Revisiting the radio interferometer measurement equa-
tion. I. A full-sky Jones formalism. 527, A106. https://doi.org/10.1051/0004-
6361/201016082
Tazzari, M., Beaujean, F., & Testi, L. (2018). GALARIO: a GPU accelerated
library for analysing radio interferometer observations. 476, 4527–4542.
https://doi.org/10.1093/mnras/sty409
Thompson, A. R., Moran, J. M., & Swenson, Jr., George W. (2017). Interferom-
etry and Synthesis in Radio Astronomy, 3rd Edition. https://doi.org/10.100
7/978-3-319-44431-4
Wang, R., Chen, Z., Luo, Q., & Wang, F. (2023). A Conditional Denoising
Diffusion Probabilistic Model for Radio Interferometric Image Reconstruction.
arXiv e-Prints, arXiv:2305.09121. https://doi.org/10.48550/arXiv.2305.0912
1
Wootten, A., & Thompson, A. R. (2009). The Atacama Large Mil-
limeter/Submillimeter Array. IEEE Proceedings, 97 (8), 1463–1471.
https://doi.org/10.1109/JPROC.2009.2020572
Zawadzki, B., Czekala, I., Loomis, R. A., Quinn, T., Grzybowski, H., Frazier, R.
C., Jennings, J., Nizam, K. M., & Jian, Y. (2023). Regularized Maximum
Likelihood Image Synthesis and Validation for ALMA Continuum Observa-
tions of Protoplanetary Disks. Publications of the Astronomical Society of
the Pacific, 135 (1048), 064503. https://doi.org/10.1088/1538-3873/acdf84