The following post was written by Steven Christe of SunPy.

A Rare Opportunity to View the Solar Corona

A solar eclipse presents a unique opportunity for us to view the solar corona or solar atmosphere. In visible light, the corona is about one million times fainter than the sun, or about as bright as the moon. Hence, the solar corona is nearly impossible to observe when the solar disk is visible. Don’t be fooled by what looks like rays extending from the Sun that you might see during the day—that is actually sunlight scattered by our earth’s atmosphere. When the moon gets right in front of the sun and blocks out the solar disk, we can then see something very different: the sun’s light scattering off of its own atmosphere! Unlike Earth’s atmosphere, the Sun’s is very dynamic and shows off the complex structure of the Sun’s magnetic field. Understanding it and its evolution is still an area of active study.

Align & Compare Photos of the Solar Eclipse using Python

This year, the United States is very lucky because a total solar eclipse crosses the entire country on August 21st. Many people will be able to see the beauty of the solar corona with their own eyes and many are likely to take photos. Many citizen science projects are have been organized to provide advice and to gather those photos including the Eclipse Megamovie Project. With so many photos likely to be taken, it will be a challenge to align them to each other to compare them.

One way to do this might be to find their relative alignment by comparing coronal structures. This might be done by cross correlation. This technique has its limitations though, what if the structures don’t match or you’d like to compare to a picture of the solar disk taken by a satellite such as the AIA imager on the Solar Dynamics Observatory which will not be in eclipse? What is required then is a determination of the absolute coordinates of your photograph. The primary coordinate system for solar observations is helioprojective coordinates. This is a coordinate system whose origin is at the center of the solar disk with the y axis aligned with the solar north pole. The units of the coordinates are angles usually expressed in arcseconds. As viewed from the earth, the sun is a little more than half a degree or 1900 arcseconds across, so the rightmost edge of the sun is at about 980 arcseconds (or half of the width of your little finger at arm’s length). The exact value varies throughout the year as the earth moves through its elliptical orbit around the sun.

Diagram of the sun

A diagram of the Sun with constant helioprojective coordinates overlaid (Thompson, 2006).

We first need two important pieces of information about your photograph, namely (1) where the center of the sun is, which is the center of the helioprojective coordinates, and (2) how big is the sun, which determines how big each pixel is projected on the sky. As mentioned in a previous blog post, Python is a great language for science and astronomy. Finding the Sun is equivalent to finding a circle, and this can be done straightforwardly by first taking the derivative of the photograph by using the Sobel filter in scipy.ndimage. This gives us the edge of the Sun and then we can use the Hough transform (provided by scikit-image) to fit the circle. We then have the radius of the Sun and its location in pixels.

finding the sun

An example of this method applied to an eclipse photograph.

We next need some information about the sun. SunPy is a Python package whose purpose is to support retrieving and analyzing solar data. We have just released a major new version (0.8 Expected Eclipse) with major updates to the sunpy.coordinates package which is designed for exactly this problem. We need the distance between the earth and the sun so that we can calculate how big it should be appear in the sky. This is provided by sunpy.coordinates.get_sunearth_distance. On the day of the eclipse the sun’s radius will appear to be 948.0 arcsec.

Next we need to determine the solar rotation angle, which tells us how the solar north pole is oriented. This is trickier, as it depends on where you are located on the earth. If you are on the earth’s equator you will see the Sun at a 90 degree angle relative to a friend of yours observing the sun from the North Pole. Again, SunPy (with help from Astropy) makes this easy through the sunpy.coordinates.get_sun_orientation function combined with a properly defined EarthLocation.

plotting the sun

An example plot using a past eclipse photograph (taken by Henk Bril from Salum, Egypt on March 29, 2006) but with the parameters for the August 21st, 2017 eclipse as observed from Idaho. Here we’ve gone one step further and added the position of the star Regulus.

One final piece of information is needed and that is the B0 angle which represents the tilt of the Sun as viewed from Earth. The Sun’s equator does not lie in Earth’s orbital plane, so we can see the north pole of the sun for half of the year and the south pole of the sun for the other half.  This value is provided by sunpy.coordinates.get_sun_B0. With all of this information, we can create a properly filled out header to initialize a SunPy Map using your photograph. We can then easily create the following plot (in addition to doing all kinds of other fun things).

With this workflow, any two photographs of the eclipse can be compared to each other as well as to scientific images of the sun. All of these steps are implemented and provided in a Jupyter notebook inside a GitHub repository. If you have any suggestions for improvements, please submit an issue or pull request! We plan on adding more tools and workflows over time.

Have fun, and share your solar eclipse photos with us on Twitter @SunPyProject and @NumFOCUS!

Support SunPy by becoming a NumFOCUS member or making a donation to the project.