Monica G. Bobra
Hansen Experimental Physics Laboratory, Stanford University, Stanford, CA 94305
SDO is six years old now, which means that there is half a solar cycle of data available to study. When SDO launched, most of the solar physics community was using IDL for data analysis. Since then, many people have switched to Python. Python is a powerful, object-oriented language with several advantages over IDL: it is open-source, has a larger user and developer community (which means that it is easier to find and fix mistakes in source code), offers many more scientific and mathematical libraries, is faster (in general), and is easily integrable with other languages (e.g. C, C++, Fortran, Java). The astronomical community widely supports python, with the Astropy1 and SunPy2 libraries coming online in 2011 and expanding considerably since then. In this Nugget, we will feature some of the python codes developed by the HMI team to analyze its many magnetic field data products.
Figure 1 | All four panels show NOAA Active Regions 11429 and 11430 on March 6, 2012 at 23:00 TAI. The first row shows SHARP data for the Br component of the vector magnetic field; the second row shows AIA data in 1600 Å. The first column shows data in native CCD coordinates; the second column shows data in CEA coordinates. To map the CEA data to the AIA data, we first convert the latitude and longitude at the center of the patch from the Carrington Heliographic coordinate system, which has units of degrees, to Helioprojective Cartesian coordinates, which has units of arcsecond.
In addition to the full-disk vector magnetic field data3, the HMI team released a derivative data product called Space-weather Active Region Patches4, or SHARPs, which contain patches of HMI data that encapsulate automatically-detected active regions. These are available in one of two coordinate systems: native CCD coordinates or Cylindrical Equal-Area coordinates. In the latter system, each pixel is of equal area. We have received questions about how to translate between the two coordinate systems and how to cut a SHARP-sized patch out of AIA data, so we developed some code to do so[S1] (Fig. 1).
Figure 2 | This interactive plot shows the total unsigned flux contained in NOAA Active Region 11158 over a one-day period beginning on February 14, 2011 at 02:00 TAI. The home, pan, and zoom buttons on the lower left-hand corner of the plot allow you to explore the data.
The SHARP data also contain 18 FITS header keywords that parameterize the vector magnetic field within the strong field regions. These parameterizations include measurements of physical quantities, such as the magnetic flux; they also include proxies of physical quantities, such as the current helicity, which cannot be measured in its entirety within a single plane. Between 2010 May 1 and 2015 May 1, the HMI data processing pipeline automatically detected 3023 strong field regions and computed 18 parameterizations of each region at every 720-second interval throughout its lifetime, resulting in 36 million unique data points. We have developed some code to easily create interactive plots of SHARP, or, for that matter, any HMI keywords[S2] by using a JSON API to query the SDO database without having to download any images at all (interactive Fig. 2).
Figure 3 | This vector field visualization is for NOAA Active Region 11158, which produced an X2.2-class are at on February 15, 2011 at 01:56:00 TAI. The red and blue colors indicate negative and positive polarities, respectively; the intensity of the color is proportional to the magnitude of the magnetic field. The brown lines indicate the direction of the field vector. Each vector varies from brown to yellow as a function of height.
It’s not easy to visualize the vector magnetic field, but we have tried to make it easier by developing code to generate movies of SHARP data[S3] and aesthetically-pleasing 3D visualizations of the magnetic field[S4]. In the latter code, we compute the observables based on the perspective of a viewer at a distance r and an angle (θ, φ) looking upon an active region (Fig. 3).
The HMI team also released a polar field data series5,[S5], which contains varies indices and four 180-element segments (e.g., the mean value of Br in each of the 1° latitudinal bins) every 720 seconds. We have developed code to interactively plot the mean value of Br above 60° latitude[S6] as well as generate a super-large butterfly diagram using both MDI and HMI data[S7] — which spans 20 years of nearly continuous observation!
 Astropy Collaboration: Robitaille, T. P., Tollerud, E. J., et al., 2013, A&A, 558, A33
 SunPy Community: T., Mumford, S. J., Christe, S., et al., 2015, Comp. Sci. & Discov., 8, 014009
 Schou, J., Scherrer, P.H., Bush, R.I.; Wachter, R., et al., 2012, SoPh, 275, 229
 Bobra, M. G., Sun, X., Hoeksema, J. T., et al., 2014, SoPh, 289, 3549
 Sun, X., Hoeksema, J. T., Liu, Y., & Zhao, J., 2015, ApJ, 798, 114
Example Python Software