Source-linked AI summary
SunPy - Python for Solar Physics
The SunPy Community, Stuart J Mumford, Steven Christe, David Pérez-Suárez, Jack Ireland, Albert Y Shih, Andrew R Inglis, Simon Liedtke, Russell J Hewett, Florian Mayer, Keith Hughitt, Nabil Freij, Tomas Meszaros, Samuel M Bennett, Michael Malocha, John Evans, Ankit Agrawal, Andrew J Leonard, Thomas P Robitaille, Benjamin Mampaey, Jose Iván Campos-Rozo, Michael S Kirk
TL;DR
Solar physics workflows must handle growing volumes and varied formats, instruments, and access methods. SunPy provides Python data structures and tools for solar data, alongside access to solar-data services. Its classes support images, time series, and spectra, while some features remain only partially implemented.
Problem
Solar analysis must handle rapidly growing data volumes and workflows that combine heterogeneous instruments, formats, and access methods.
Source: §1 · p. 3Method
SunPy provides Python data structures for solar images, time series, and spectra, and integrates with the VSO to query and download data.
Source: §2 · p. 4, §3.1 · p. 13Results
SunPy’s core classes provide common representations for images, time series, and spectra, while its VSO interface supports constrained queries and downloads.
Source: §2 · p. 4, §3.1 · p. 13Takeaways & Limitations
SunPy offers a shared interface for handling solar data from multiple sources, simplifying workflows across those sources.
Source: §2 · p. 4Only Map and LightCurve currently have the metadata feature fully implemented.
Source: §2 · p. 4
Abstract
from arXiv · showhide
This paper presents SunPy (version 0.5), a community-developed Python package for solar physics. Python, a free, cross-platform, general-purpose, high-level programming language, has seen widespread adoption among the scientific community, resulting in the availability of a large number of software packages, from numerical computation (NumPy, SciPy) and machine learning (scikit-learn) to visualisation and plotting (matplotlib). SunPy is a data-analysis environment specialising in providing the software necessary to analyse solar and heliospheric data in Python. SunPy is open-source software (BSD licence) and has an open and transparent development workflow that anyone can contribute to. SunPy provides access to solar data through integration with the Virtual Solar Observatory (VSO), the Heliophysics Event Knowledgebase (HEK), and the HELiophysics Integrated Observatory (HELIO) webservices. It currently supports image data from major solar missions (e.g., SDO, SOHO, STEREO, and IRIS), time-series data from missions such as GOES, SDO/EVE, and PROBA2/LYRA, and radio spectra from e-Callisto and STEREO/SWAVES. We describe SunPy's functionality, provide examples of solar data analysis in SunPy, and show how Python-based solar data-analysis can leverage the many existing tools already available in Python. We discuss the future goals of the project and encourage interested users to become involved in the planning and development of SunPy.
1. Introduction
Solar data growth and the diversity of analysis workflows increase the need for robust, accessible software. SunPy aims to meet this need with an open-source Python package for solar-data analysis, and the paper overviews its capabilities, development, community, and plans.
1. Introduction
- SDO produces over 1 TB of data per day, and growing data volumes and variety call for robust, usable, modifiable tools with transparent development.The paper frames these qualities as a foundation for community needs as data volumes grow and scientific questions evolve.Source: §1 · p. 3
- Solar physics workflows range from studying a few events with heterogeneous data and access methods to analyzing large samples with more files but lower heterogeneity.The first workflow combines data from multiple instruments and formats; the second seeks population-level information.Source: §1 · pp. 3–4
- SunPy aims to provide simple, well-structured, open-source tools for common solar-data operations as a free, modern alternative to IDL-dependent SolarSoft.SolarSoft is described as open source and freely available, but reliant on the proprietary IDL environment.Source: §1 · p. 4
- SunPy builds on Python’s scientific-package ecosystem, and this paper surveys its current capabilities, development model, community, and future plans.The ecosystem includes numerical, visualization, astronomy, time-series, and image-processing packages.Source: §1 · pp. 3–4
2. Core Data Types
SunPy provides common data structures and analysis tools for solar images, time series, and spectra. Its classes standardize access across sources while offering data-type-specific operations and visualization.
2. Core Data Types
- Map, LightCurve, Spectrum, and Spectrogram provide consistent core types for images, time series, and spectra despite differences in source-data formats.For example, Map objects express observation times consistently across instruments; only Map and LightCurve have the metadata feature fully implemented.Source: §2 · p. 4
2.1. Map
- Map wraps 2D spatial data with coordinates and metadata, and supports operations such as rotation, resampling, and visualization.GenericMap specializations are created through a factory; CompositeMap overlays aligned data, while MapCube supports animation of Map series.Source: §2.1 · pp. 5, 7
2.2. Lightcurve
- LightCurve uses a pandas DataFrame to handle time-ordered series consistently, with instrument-specific subclasses and source-specific data retrieval.Supported sources include GOES XRS, NoRH, PROBA2/LYRA, RHESSI, and SDO/EVE; only specified OCS-level and average CSV EVE files are implemented.Source: §2.2 · pp. 9–10
2.3. Spectra
- Spectrum and Spectrogram represent 1D frequency data and 2D time-frequency data, with Spectrogram tools for merging ranges, background subtraction, visualization, and sampling.Spectrogram support covers e-Callisto and STEREO/SWAVES radio data; the example linearizes uneven frequency spacing and subtracts a constant background per channel.Source: §2.3 · p. 11
3. Solar Data Search and Retrieval
SunPy’s net and database tools connect users to remote solar data and event catalogues, support image composition and retrieval, and organize downloaded and local files. The subsections cover VSO, HEK, HELIO, Helioviewer, and a local file database.
3.1. VSO
- The VSO module constructs queries from data attributes, supports combining conditions, and downloads matching files into paths organized using file metadata.Attributes can constrain observation time, instrument, or wavelength; multiple query arguments are combined with logical AND, while the pipe operator combines attributes with OR.Source: §3.1 · p. 13
3.2. HEK
- HEK queries filter event records, and H2VClient translates HEK results into VSO data queries for downloading observations.Optional feature attributes vary by feature recognition method; when an optional attribute is unavailable, the module returns None.Source: §3.2 · pp. 15–16
3.3. HELIO
- SunPy’s hec module accesses 84 HELIO Event Catalogue catalogues, whose VOTable results include query and provenance metadata.The example queries multiple CME catalogues.Source: §3.3 · pp. 16–17
3.4. Helioviewer
- Helioviewer archives compressed, high-fidelity JPEG2000 images that SunPy can retrieve and use for visualization.SunPy also uses Helioviewer in production servers to manage downloading and ingesting JPEG2000 files.Source: §3.4 · p. 18
3.4.1. Download a PNG file
- The Helioviewer PNG download method composes image layers from multiple sources using source positioning metadata.The method selects images closest to the requested time and allows layer visibility and opacity to be specified.Source: §3.4.1 · pp. 18–19
3.4.2. Download a JPEG2000 file
- Retrieved Helioviewer JPEG2000 files can be converted into SunPy Map objects and manipulated like maps created from FITS data.Reading JPEG2000 files requires OpenJPEG and Glymur; these dependencies are not needed for PNG downloads.Source: §3.4.2 · p. 20
3.5. The File Database
- The file database organizes local data files and metadata, searches local files together with VSO results to reduce repeat downloads, and supports undo and redo.The database can store data readable through SunPy’s io subpackage and can be integrated directly with VSO.Source: §3.5 · p. 21
4. Additional Functionality
SunPy adds solar-specific coordinate transformations, constants, units, and instrument functions to its analysis environment. The implemented coordinate transformations cover commonly used solar imaging coordinates and depend on observer information.
4.1. World Coordinate System (WCS) Coordinates
- SunPy’s WCS utilities convert between Helioprojective-Cartesian and Heliographic coordinates through Heliocentric-Cartesian coordinates.The observer location is generally taken from image headers and assumed to be Earth when absent; the two Heliographic standards are Stonyhurst and Carrington.Source: §4.1 · pp. 22–23
4.2. Solar Constants and units
- SunPy uses Astropy Quantity objects to associate values with units and provides solar constants as Constant objects with provenance and uncertainty.Quantity integration across the code base was still in progress; time-dependent solar ephemerides are also available.Source: §4.2 · pp. 23–24
4.3. Instruments
- The instr subpackage provides instrument-specific functions for GOES, LYRA, RHESSI, and IRIS, with support for additional missions planned.The paper anticipates that missions needing extensive software tools will ultimately be supported through separately maintained affiliated packages.Source: §4.3 · p. 24
5. Development and Community
SunPy’s open development model combines public code, collaborative review, documentation, and community governance. The project uses established tools and acceptance practices to support code quality and ongoing participation.
5. Development and Community
- SunPy’s source code is publicly available under the permissive 2-clause BSD licence, and anyone can contribute through its open development process.The project uses GitHub and Git for development and version control.Source: §5 · p. 25
- Code acceptance requires style consistency, documentation, tests, and community consensus; continuous integration runs tests and alerts contributors to failures.Unit-test coverage is monitored separately.Source: §5 · p. 25
- SunPy documents its code with Sphinx and uses IRC, a mailing list, GitHub, and scientific-meeting outreach for community communication.The documentation is automatically built and hosted on Read the Docs.Source: §5 · pp. 25–26
- An elected community board oversees SunPy, elects the lead developer, and votes on community-proposed Python-style Enhancement proposals.These proposals set the project’s overall direction.Source: §5 · p. 26
6. Future of SunPy
SunPy’s future development centers on interoperable data types, a unified coordinate architecture, and deeper integration with Astropy and additional data services.
6. Future of SunPy
- SunPy plans interchangeable data types built on a unified coordinate architecture, so operations can return related types and preserve awareness of physical data.For example, slicing a MapCube spatially could return a LightCurve over its time range.Source: §6 · p. 26
- A unified coordinate system is intended to enable coordinate- and solar-rotation-aware overplotting of HELIO and HEK results onto maps.Source: §6 · p. 26
- SunPy plans to integrate new data providers and services, including HELIO services, for seamless interaction with other services and tools.Source: §6 · p. 26
- Ongoing collaboration and joint development with Astropy is expected to let SunPy incorporate many new features with little effort.Source: §6 · p. 26
7. Summary
The paper presents SunPy v0.5 and reviews its data-analysis capabilities, service integrations, development model, community, and future plans. It invites researchers to use the package and contribute to its development.
7. Summary
- SunPy v0.5 provides core data types including Map, LightCurve, and Spectrogram for solar-physics analysis.Source: §7 · p. 26
- SunPy supports data and event retrieval through VSO, HEK, and HELIO, and includes a tool for organizing data files.Source: §7 · p. 27
- The paper describes SunPy’s community, development model, and future plans, and invites researchers to use it, report bugs, and share new functionality.Source: §7 · p. 27