For many years now we know that our star the Sun influences the Earth in many different ways, via the total solar irradiance, solar energetic particles and coronal mass ejections. Understanding the influence of the Sun on the Earth requires many different types of measurements. For example, NASA’s Solar Dynamics Observatory (SDO) spacecraft, produces over 1 terabyte of data per day (Pesnell et al., 2012), the bulk of it in the form of 4096 by 4096 pixel images in multiple bandpasses. The Parker Solar Probe (launched 12 August 2018) will fly closer to the Sun than any previous spacecraft, exploring the Sun’s corona, the solar wind and source and transport of space weather phenomena, by taking both in situ and remote measurements. Understanding the underlying physics requires sophisticated data analysis and modelling of multiple differing physical domains.
Managing and analyzing these heterogeneous data to answer evolving scientific needs and questions requires increasingly sophisticated software tools. These tools should be robust, easy to use and modify, have a transparent development history, and conform to modern software-engineering standards. The SunPy Project (SunPy Community et al., 2015) aims to provide a free and open source software package with these qualities for the analysis and visualisation of solar data. SunPy is built on Python, a free, general-purpose, powerful, and easy-to-learn programming language. Python is widely used in many scientific fields, and has found applications in data analytics, machine learning and educational environments. SunPy brings solar physics in to the scientific Python ecosystem.
Organization and description of the code
SunPy focuses on providing access to online repositories of solar physics data, and objects that make it easy to manipulate and display those data. SunPy is built using other open source Python projects, notably Astropy, numpy, SciPy, pandas and matplotlib. For example, many solar datasets are two-dimensional images, represented in SunPy by a Map object. Maps use SunPy’s coordinate transformation framework, an extension of Astropy’s powerful coordinates package, thereby enabling support for transforming between all Astropy and SunPy coordinate systems. SunPy was used to overlay ground based images of the solar corona taken during the total solar eclipse of August 21, 2017, and space based-images taken by SDO (Figure 1)
SunPy’s also provides the TimeSeries object for manipulating and displaying time-ordered scalar data. Also, all public-facing SunPy functionality is unit-aware, meaning that physical units must be specified as required. SunPy provides code snippets to get users started (Figure 2), and project members are active in teaching the community about SunPy. SunPy is used by researchers working at NASA, European Space Agency (ESA), and the US National Solar Observatory Daniel K. Inouye Solar Telescope. SunPy can also be used for modelling work: Figure 3 shows an example of using SunPy’s coordinate and mapping abilities to model the emission from an arcade of solar coronal loops.
Governance and development model
SunPy was born at the 2010 Solar Image Processing Workshop in Les Diablerets, Switzerland. It is run by a small volunteer board of scientists that sets SunPy’s goals. The Lead Developer (currently Dr. Stuart Mumford) is responsible for the implementation of SunPy’s goals. Contributions can be made by anyone. The project is managed at github.com/sunpy/sunpy, and unit testing, continuous integration, and community review of contributions are implemented to reduce bugs and maintain quality. Students supported by the Google Summer of Code and the ESA Summer of Code in Space programs have made substantial contributions to SunPy. The SunPy project is also a member of NumFOCUS, a US-based nonprofit organization that promotes sustainable high-level programming languages, open code development, and reproducible scientific research.
SunPy gives users access to the ever widening scientific Python ecosystem. SunPy 1.0 is under development for release later on this year. This version will use Astropy’s representation of time, bringing improved precision and leap second support to SunPy. The usability of SunPy’s data acquisition infrastructure will also be improved. SunPy 1.0 will also drop support for the Python 2 series and require Python 3.6 or higher. SunPy is also developing NDCube, a multi-dimensional, physically aware data object that can represent more complex multi-dimensional datasets, such as that from NASA’s Interface Region Imaging Spectrometer (IRIS) and other spectrometer instruments. Finally, SunPy’s affiliated package program encourages the development of SunPy-based code that performs specific scientific tasks such as analyzing solar radio spectra.
SunPy Community, S.J. Mumford, S. Christe, et al. 2015, Computational Science and Discovery, 8, 014009.
D. Pesnell, B. J. Thompson, and P. C. Chamberlin. The solar dynamics observatory (SDO). Solar Physics, 275:3–15, Ja
This blogpost is written by Jack Ireland from the SunPy Community