SunMap: A Solar Image Processing Software for Obtaining Synoptic Maps

A new open-source software, called SunMap, has been developed to obtain synoptic maps in an easy and quick way from multiple full-disc solar images. Our objective is to provide a free and straightforward application for heliophysicists and geophysicists interested in generating solar synoptic maps. SunMap allows comparison of structures and patterns of solar activity over various periods. Thus, the short- and long-term evolution of solar regions of interest can be studied. To reach this goal, different solar images taken day by day are stored in a single map that uses a sequence of images and allows the positioning of each observable element on it. A simple comparison between a synoptic map generated by SunMap and another previously constructed map is presented to show the versatility of this new available software.

used as an astronomical instrument. In 1609, Galileo Galilei stated a new era of discoveries in the history of astronomy when he applied the first refractive telescope to observe the stars. This marked the beginning of a new research focused on the Sun (Galilei and Scheiner, 2010).
The first systematic records of features of the solar photosphere with the telescope were made by Harriot, Galileo, Scheiner, and other astronomers of that time, who provided information on sunspots and faculae in their drawings (Arlt et al., 2016;Arlt and Vaquero, 2020;Carrasco, Gallego, and Vaquero, 2020;Vokhmyanin, Arlt, and Zolotova, 2020). Other outstanding methods to record solar phenomena throughout history were, for example, the solar photography introduced in the 19th century (De Vaucouleurs, 1961), the butterfly diagram by Maunder (1904), and solar images taken in multiple wavelengths by telescopes on board of modern spacecraft, such as the Solar and Heliospheric Observatory (SOHO) and Solar Dynamics Observatory (SDO) (Domingo, Fleck, and Poland, 1995;Pesnell, Thompson, and Chamberlin, 2012).
Solar synoptic maps can be generated using these modern images. These representations allow us to study the temporal evolution of solar phenomena and compare them in different periods of time. Several authors have used the synoptic maps in order to study the Sun; for example, Hamada, Asikainen, and Mursula (2019) published a homogeneous dataset of solar synoptic maps from images taken by SOHO and SDO. Other surveys also used solar synoptic maps to investigate the solar wind, coronal holes, and photospheric magnetic fields (Balachandran, 2000;Karna et al., 2015;Virtanen and Mursula, 2016;Hamada et al., 2018).
In order to address this issue, we have created a software (SunMap) to obtain synoptic maps automatically from optical images of celestial bodies, in this particular case, from the Sun. The outline of the article is as follows: Section 2 describes how a synoptic map is generated. The Section 3 is devoted to the presentation of the main features of the program, including a short guide to using it. Section 4 presents a case study of a synoptic map obtained by SunMap and a comparison with that made in other works using the same observation set. Finally, Section 5 shows the main conclusions of this paper with some remarks and hints at possible directions of future research.

Composition of Synoptic Maps
Solar synoptic maps known as Thilo diagrams can be considered the first ones in solar physics history. Thilo (1828) published these diagrams representing the sunspots recorded by Soemmering in Frankfurt from 1 July 1826 to 21 June 1827 according to their heliographic coordinates on vertical and horizontal lines. The main purpose of these solar synoptic maps is to carry out a global representation of the Sun. Moreover, these maps can be also applied to other representations of astronomical objects, such as images of the Earth and Mars.
The first step in creating a solar synoptic map is to obtain the files that include the observations of interest. In this work, we have used as an example the modern solar images provided by SDO 1 (Pesnell, Thompson, and Chamberlin, 2012). Then, our software allows for initial image preprocessing. For example, the image contrast can be modified by linear brightness by percentile, gamma and logarithmic adjustments, and filtering regional maxima (van der Walt et al., 2014). Moreover, image equalization by contrast stretching and global, adaptive, and rank equalization (Soille, 2002;Reza, 2004;González and Woods, 2018) can be applied to the images, as well as smoothing algorithms, such as convolutional median and Gaussian filters (Chandel and Gupta, 2013), using kernels with default size of 5 × 5 pixels.
Once that step is completed, the image is oriented using a coordinate system and projected onto a two-dimensional system. For this projection, we use the Fernández-Guasti Squircle (FGS) representation (Fernández-Guasti, 1992). We thus obtain an intermediate figure between a circle and square in a uniform way reducing the projection error as much as possible. The polar equation for a squircle form is given by Fernández-Guasti et al. (2005): where r and θ are the polar coordinates, and s is the squareness parameter. Note that s = 1 depicts a square with side equal to 2k, and s = 0 represents a circle with radius equal to k. Substituting 4x 2 y 2 = r 4 sin 2 (2θ) gives the Cartesian equation (Fernández-Guasti et al., 2005): As an example, the resulting transformation using the FGS representation from the solar image taken by SDO on 2 January 2016 is shown in Figure 1.
In cylindrical projections, such as the projection used in this work to create synoptic maps, the points are expanded depending on their locations. The differential rotation in the expanded image is mostly reduced to a constant rotation that does not depend on the latitude. This constant period is represented as the Carrington period in which a synoptic map will represent 360 • in longitude when 27.2753 days are composed in images. Therefore, the Carrington rotation will be represented as an integer representing 27.2753 days.
When two images of the Sun are taken in a certain period of time, part of the image corresponding to the oldest observation can overlap with the most recent image due to the Sun's rotation ( Figure 2). Note that repeated pixels cannot appear in different areas in a synoptic map. Thus, it is necessary to calculate how many pixels are required between observations as a function of that period. For this calculation, we must consider, in addition to that period, the proportion of the image to be studied and the solar rotation and its dependence on the heliographic latitude. We assume that the speed of the differential rotation (ω) is (Snodgrass and Ulrich, 1990): where φ is the solar latitude. Then, it is possible to know how many pixels are equivalent to the difference in angle as a function of the latitude (λ(φ)) from the equation: where ξ is the number of degrees the solar image rotates in the studied period (it is function of the latitude φ), and δ is a scale factor in units of degrees/pixel. For more details on the previous explanations and mathematical developments involved in these calculations, see García (2020) and references therein. Note that when there is some observational gap, the software takes a large number of pixels of the most recent image to complete the synoptic map, although we acknowledge this fact can introduce larger errors. In case of overlapping of observations, the software overlaps the two most recent observations to create the map. Once the synoptic map is obtained, the user can apply a convolutional filter to smooth the changes in the brightness of the overlapping observations. The last step to obtain the synoptic map is to merge horizontally and chronologically all the vertical strips created from the observations, similar to the previously explained. One example of solar synoptic map, using data from SDO with a wavelength of 211 Å for the period spanning from 6 January to 2 February 2020, corresponding to the Carrington rotation 2226, can be seen in Figure 3.

Description of the Software
This software has been designed to ease the study and comparison of different solar characteristics that occur on different dates. We use Python as the main programming language because it is a multiparadigm, multiplatform, simple, and flexible language. Furthermore, Anaconda suite, PyCharm 2 (IDE for Python developers) and GitHub (public repositories platform to store our software under the name SunMap 3 ) have been used. In addition, several libraries such as Numpy (scientific calculation), Matplotlib (tool to generate graphs), Numba (compiler to optimize operations on types and structures of the NumPy library), SunPy (used to download, process, and store the files), and PyQt (library to develop the interface) have been integrated into our project under a Model-view-controller (MVC) pattern (as shown in Figure 4, top panel).
The information system is initiated with an order or command introduced by the user from the interface or terminal, named as "view" in Figure 4 (top panel). The information sequence, generated by the user-view interaction, will be made up of the event identifier and the necessary parameters to query the model. Once the controller issues the command, the content is formatted generating a list whose first element is the event identifier, and the following elements are the query parameters. Then, the controller uses the parser object to obtain the event linked to the identifier. The application uses two types of parsers (Figure 4, bottom panel): one parser for the events with a list of objects and events from the parser (see "FitsParseEvents" in blue in Figure 4, bottom panel) and other, more general parser, that is the node of the different parsers for events allowing greater modularization (see "ParseEvents" in green in Figure 4, bottom panel). Once the controller has the appropriate event object for the command, the parameters and the event object can be used in the model. The functionality of the events of the application will be divided into a series of modules in which each one will contain a series of events grouped by theme and a parser that allows access to them.
In order to provide a summary guide to creating a solar synoptic map, we first use the Fido object from the SunPy library, which allows us to consult the information on multiple   Table 1, where 31 files fulfilling the search criteria can be found. Once the query has been made, the corresponding files will be downloaded in FITS format. Thus, they can be used in the application. After downloading the images and initializing the interface, an image can be loaded (or image sequence) by clicking "File -Load image". Thus, the interface is seen such as in Figure 5. In case a sequence of several images is loaded, all the images will be chronologically shown in the interface. Then, after loading the images, the solar synoptic map is generated by clicking on "Transforms -Synoptic Map". As an example, we have shown in Figure 3 the solar synoptic map from a sequence of images taken by the instrument AIA on board SDO between 6 January and 2 February 2020 (Carrington rotation 2226) at 211 Å.
In addition to showing the creation of synoptic maps, several postprocessing options have been included in the interface to improve the usefulness of SunMap. For example, we can zoom in or out, edit the information of the axes, and modify the design and size of the final image. Some options allow overlapping different elements on the image. In this case, we can grid the image as support to know the coordinates of a region of interest. A black circle can be applied on the solar disc to visualize only the chromosphere and corona. The solar limb can be highlighted by a white circumference, and the outlines of the brightest regions, such as active regions, can be also outlined (these are determined by binarization and thresholds). We can obtain histograms from the images as a function of the pixel hue, as well as diagrams using Fourier transforms, which are useful, for example, to check if the image has noise. Moreover, the image sequence can be saved in GIF format, and a long list of pseudocolors (more than 100) can be applied to the image to see the certain regions of interest in various ways. More detailed explanations of the different capabilities of SunMap can be found in García (2020). All the programming codes related to this project, as well as the installation setup of SunMap and a user guide, can be downloaded from https://github. com/gabgarar/SunMap. Changes and future improvements implemented in the software will also be made available through this link.

A Preliminary Comparison of Synoptic Maps
As a case study, we have selected one daily image taken by the instrument AIA on board SDO with a wavelength channel of 193 Å from 26 August to 22 September 2011. The result is shown in Figure 6 (top panel). Thus, we have obtained the solar synoptic map from SunMap following the method outlined above.
We have made a preliminary comparison between our final synoptic map with that obtained by Hamada, Asikainen, and Mursula (2019) using the same dataset. These kind of maps can be made in many ways. Different types of projections and pseudocolors can be chosen, obtaining a variety of maps from one study to another. This fact can also be seen from the comparison between the synoptic map obtained in this work ( Figure 6, top panel) and that of Hamada, Asikainen, and Mursula (2019) (Figure 6, bottom panel) using data corresponding to the Carrington rotation 2114 (from 26 August to 22 September 2011). Note that, in both cases, the y-axis of the maps is represented as a function of the sine of latitude.
One difference between both synoptic maps is that Hamada, Asikainen, and Mursula (2019) used a linearly varying weighting function to determine the value of each pixel from overlapping observations, whereas it is not used in our map. In this case, we decided not to apply the smoothing filter in order to detect more clearly the details (such as loops in the solar atmosphere of magnetic origin) that such a wavelength provides. Note also that the maps provided by Hamada, Asikainen, and Mursula (2019) from SOHO and SDO were constructed in a standardized intensity scale. Moreover, although the pseudocolor is slightly different between both synoptic maps, we have selected one as similar as possible to that of Hamada, Asikainen, and Mursula (2019). Another difference is that our software does not use Carrington longitudes (it will be available in future versions), contrary to Hamada, Asikainen, and Mursula (2019). SunMap takes as reference the center of the image supposing a georeferenced system.
A darker stripe in the image in Figure 6 (top panel) can be observed around 10 • longitude. That part corresponds to the observation of 8 September 2011 when the image used from SDO was darker than usual. Moreover, the value of 0 in the x-axis can be represented both in the center and in the intersection with the y-axis. Although we acknowledge that a visual check is a simple method to compare both synoptic maps, it can be seen from this preliminary comparison shown in Figure 6 that both works have similar results.

Conclusions
We present a program (SunMap) for obtaining synoptic maps automatically from solar images. On the one hand, the proposed software have been implemented using Python over an intuitive interface, allowing to be used with different optical imaging instruments, where band-pass techniques can be exploited. In the interface of the software, a set of images can be selected to obtain the synoptic map in an easy way. Several pre-and post-processing techniques can be used to improve the final result. The advantage of our software is that users do