Plotting a difference image#

This example shows how to compute and plot a difference image.

import matplotlib.colors as colors
import matplotlib.pyplot as plt

from astropy.visualization import ImageNormalize, SqrtStretch


When analyzing solar imaging data it is often useful to look at the difference from one time step to the next (running difference) or the difference from the start of the sequence (base difference). In this example, we’ll use a sequence of AIA 193 cutout images taken during a flare.

First, load a series of images into a MapSequence.

Let’s take a look at each image in the sequence. Note that these images are sampled at a 6.4 minute cadence, much lower than the actual 12 s AIA cadence. We adjust the plot setting to ensure the colorbar is the same at each time step.

fig = plt.figure()
ax = fig.add_subplot(projection=m_seq.maps[0])
ani = m_seq.plot(axes=ax, norm=ImageNormalize(vmin=0, vmax=5e3, stretch=SqrtStretch()))