Sun display from official catalogs and instruments with Sunpy.

Data comparison

Let's take as an example a recent observation of the Sun made by C. Buil, le 29 november 2020 with a Sol'Ex 1 :

http://www.astrosurf.com/topic/142367-solex-un-instrument-solaire-%C3%A0-petit-prix/

It can be interesting to compare and illustrate the results of the observation in other wavelengths or types of visualization.

The examples presented here are based on the official documentation of the module : https://sunpy.org/.

1 - The Sun seen by the Sol'Ex

To display the initial image, we can use the Pillow library which, as its description indicates, allows us to manipulate and process images.

Pillow : https://pillow.readthedocs.io/en/stable/

The Python Imaging Library adds image processing capabilities to your Python interpreter."

2 - Retrieval of an image of the Sun taken with the SDO AIA instrument at the same time

2.1 - Installation and import of the Sunpy library

Depending on the use, it is necessary to install the full version of the library, as below.

2.2 -Quick view of a map

For a first use, a data sample package is provided with the library to discover its functioning and to carry out tests. We can import this data sample with "import sunpy.data.sample". Thus, we have for example a data set of the AIA instrument for the wavelength 171 with sunpy.data.sample.AIA_171_IMAGE

To display this data, Sunpy provides a map object. These maps are matrices of spatial data, which are thus declined for a 2D image, a temporal series of 2D images, or 2D images aligned in time. (https://docs.sunpy.org/en/stable/guide/tour.html)

We will be able to create a new map by passing a file name or a list of file names as parameters. As always, we have to start with the import.

The call of the peek() method applicable on the aia object allows here to have a fast and easy graphical display. This saves us from having to prepare and configure a matplotlib graph. The latter is accessible on all Sunpy base objects.

However, what we are interested in is to access the data of a certain date.

2.3 - Consultation and retrieval of available data

In order to check if there are data available at the date we are interested in and to download them, we can use Fido. The latter allows us to search and retrieve data, providing a unified interface and allowing the interrogation of several sources simultaneously (https://iopscience.iop.org/article/10.3847/1538-4357/ab4f7a/pdf).

The fido object takes various parameters, for example in our case :

2.3.1 - Consultation

2.3.2 - Retrieve data

2.4 - Display

As mentioned before, we can display the data thanks to the map object of the library, which takes as parameters the elements we have just downloaded. This time by preparing a graph using matplotlib.

3 - Superposition of images taken by two instruments : AIA and HMI

We can go even further by downloading images from two different instruments to superimpose them, with AIA and the HMI (Helioseismic and Magnetic Imager) instrument which maps the magnetic field and the velocity of the surface of the Sun.

To perform this overlay, we need the Reproject library.

3.1 - Reproject

The reproject library, when displaying two FITS images, allows to crop the display with the same celestial projection, based on the WCS data of the header, with the possibility to change the orientation, the coordinate system, etc.

3.2 - Consultation and download of available data

3.3 - Plot preparation

3.4 - Display Plot

3.5 - Re-projection of the HMI magnetogram in the right direction for supperposition with the image AIA

The function used here for reprojection, reproject_interp, takes as parameter in our case:

3.6 - Superposition of the two graphs

Recall of the initial image

To go further

This example is only an introduction, the Sunpy library contains many features and data types. Here is for example the list of available instruments, knowing that each instrument has several accessible configurations !