Multi-scale Gaussian Normalization#

This example applies Multi-scale Gaussian Normalization to a SunPy Map using sunkit_image.enhance.mgn.

import matplotlib.pyplot as plt
from astropy import units as u
from matplotlib import colors

import sunkit_image.enhance as enhance

SunPy sample data contains a number of suitable images, which we will use here.

aia_map =

# The original image is plotted to showcase the difference.
fig = plt.figure()
ax = plt.subplot(projection=aia_map)
aia_map.plot(clip_interval=(1, 99.99) * u.percent)
AIA $171 \; \mathrm{\mathring{A}}$ 2011-06-07 06:33:02
Files Downloaded:   0%|          | 0/1 [00:00<?, ?file/s]

AIA20110607_063302_0171_lowres.fits:   0%|          | 0.00/973k [00:00<?, ?B/s]

Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  5.10file/s]
Files Downloaded: 100%|██████████| 1/1 [00:00<00:00,  5.08file/s]

<matplotlib.image.AxesImage object at 0x7fbda81c96f0>

Applying Multi-scale Gaussian Normalization on a solar image. The sunkit_image.enhance.mgn function takes a numpy.ndarray as a input so we will pass only the data part of GenericMap

out = enhance.mgn(
# The value returned is also a numpy.ndarray so we convert it back to
# a
out =, aia_map.meta)

Now we will plot the final result.

fig = plt.figure()
ax = plt.subplot(projection=out)
AIA $171 \; \mathrm{\mathring{A}}$ 2011-06-07 06:33:02

Total running time of the script: (0 minutes 5.954 seconds)

Gallery generated by Sphinx-Gallery