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

import sunpy.data.sample
import sunpy.map

import sunkit_image.enhance as enhance
Files Downloaded:   0%|          | 0/30 [00:00<?, ?file/s]



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




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





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




AIA20110607_063302_0171_lowres.fits:  32%|###1      | 310k/973k [00:00<00:00, 3.10MB/s]



AIA20110607_063301_0131_lowres.fits:  80%|########  | 771k/962k [00:00<00:00, 6.32MB/s]





Files Downloaded:   3%|3         | 1/30 [00:00<00:14,  1.96file/s]









AIA20110607_063302_0211_lowres.fits:  97%|#########6| 954k/988k [00:00<00:00, 9.46MB/s]








HMI20110607_063211_los_lowres.fits:   0%|          | 0.00/8.40M [00:00<?, ?B/s]


HMI20110607_063211_los_lowres.fits:  54%|#####3    | 4.53M/8.40M [00:00<00:00, 43.8MB/s]



Files Downloaded:  13%|#3        | 4/30 [00:00<00:04,  6.20file/s]




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



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





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





Files Downloaded:  17%|#6        | 5/30 [00:00<00:03,  6.83file/s]



AIA20110607_063305_0094_lowres.fits:  88%|########8 | 858k/971k [00:00<00:00, 8.45MB/s]









AIA20110607_063305_1600_lowres.fits:  63%|######2   | 584k/930k [00:00<00:00, 5.82MB/s]






Files Downloaded:  23%|##3       | 7/30 [00:00<00:02,  9.59file/s]


AIA20110607_063307_0193_lowres.fits:   0%|          | 0.00/1.00M [00:00<?, ?B/s]




aiacalibim5.fits:   0%|          | 0.00/13.2M [00:00<?, ?B/s]



AIA20110607_063307_0193_cutout.fits:   0%|          | 0.00/1.45M [00:00<?, ?B/s]

aiacalibim5.fits:  28%|##7       | 3.62M/13.2M [00:00<00:00, 35.2MB/s]





AIA20110607_063931_0193_cutout.fits:   0%|          | 0.00/1.45M [00:00<?, ?B/s]

aiacalibim5.fits:  77%|#######7  | 10.2M/13.2M [00:00<00:00, 52.9MB/s]




aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1_lowres.fits:   0%|          | 0.00/2.55M [00:00<?, ?B/s]





AIA20110607_063307_0193_cutout.fits:   0%|          | 1.02k/1.45M [00:00<03:39, 6.61kB/s]
Files Downloaded:  30%|###       | 9/30 [00:01<00:03,  6.76file/s]





AIA20110607_063931_0193_cutout.fits:   0%|          | 1.02k/1.45M [00:00<03:33, 6.82kB/s]








aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1_lowres.fits:  80%|########  | 2.04M/2.55M [00:00<00:00, 15.6MB/s]








AIA20110607_064555_0193_cutout.fits:   0%|          | 0.00/1.45M [00:00<?, ?B/s]





Files Downloaded:  40%|####      | 12/30 [00:01<00:01,  9.85file/s]


AIA20110607_064555_0193_cutout.fits:  96%|#########6| 1.40M/1.45M [00:00<00:00, 14.0MB/s]




AIA20110607_065219_0193_cutout.fits:   0%|          | 0.00/1.46M [00:00<?, ?B/s]



AIA20110607_065843_0193_cutout.fits:   0%|          | 0.00/1.45M [00:00<?, ?B/s]




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


Files Downloaded:  47%|####6     | 14/30 [00:01<00:01,  8.82file/s]








AIA20110607_065843_0193_cutout.fits:  84%|########3 | 1.22M/1.45M [00:00<00:00, 12.2MB/s]









eit_l1_20110607_203753.fits:   0%|          | 0.00/8.40M [00:00<?, ?B/s]


BIR_20110607_062400_10.fit:   0%|          | 0.00/760k [00:00<?, ?B/s]





eit_l1_20110607_203753.fits:  37%|###7      | 3.12M/8.40M [00:00<00:00, 31.1MB/s]


BIR_20110607_062400_10.fit:  80%|########  | 609k/760k [00:00<00:00, 4.79MB/s]



Files Downloaded:  57%|#####6    | 17/30 [00:02<00:01,  9.86file/s]










20110607_EVE_L0CS_DIODES_1m.txt:   0%|          | 0.00/243k [00:00<?, ?B/s]

swap_lv1_20110607_063329.fits:   0%|          | 0.00/2.11M [00:00<?, ?B/s]





Files Downloaded:  63%|######3   | 19/30 [00:02<00:01, 10.29file/s]

swap_lv1_20110607_063329.fits: 100%|#########9| 2.11M/2.11M [00:00<00:00, 21.1MB/s]




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



lyra_20110607-000000_lev3_std.fits:   0%|          | 0.00/63.4k [00:00<?, ?B/s]



Files Downloaded:  70%|#######   | 21/30 [00:02<00:00, 10.29file/s]









glg_cspec_n5_110607_v00.pha:   0%|          | 0.00/5.53M [00:00<?, ?B/s]

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




hsi_obssumm_20110607_025.fits:   0%|          | 0.00/1.55M [00:00<?, ?B/s]

tca110607.fits:  82%|########1 | 49.4k/60.5k [00:00<00:00, 465kB/s]





glg_cspec_n5_110607_v00.pha:  60%|######    | 3.32M/5.53M [00:00<00:00, 29.0MB/s]


Files Downloaded:  77%|#######6  | 23/30 [00:02<00:00, 10.44file/s]




hsi_obssumm_20110607_025.fits:  80%|########  | 1.24M/1.55M [00:00<00:00, 12.2MB/s]









20110607SRS.txt:   0%|          | 0.00/854 [00:00<?, ?B/s]









Files Downloaded:  87%|########6 | 26/30 [00:02<00:00, 13.73file/s]


LOFAR_70MHZ_20190409_131136.fits:   0%|          | 0.00/2.57M [00:00<?, ?B/s]




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


Files Downloaded:  93%|#########3| 28/30 [00:02<00:00, 12.22file/s]





20120601_000530_n4eua.fits:   0%|          | 0.00/2.06M [00:00<?, ?B/s]




20120601_000530_n4eub.fits:   0%|          | 0.00/1.91M [00:00<?, ?B/s]











Files Downloaded: 100%|##########| 30/30 [00:03<00:00, 12.28file/s]
Files Downloaded: 100%|##########| 30/30 [00:03<00:00,  9.70file/s]

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

aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)

# The original image is plotted to showcase the difference.
fig = plt.figure()
ax = plt.subplot(projection=aia_map)
aia_map.plot()
AIA $171 \; \mathrm{\mathring{A}}$ 2011-06-07 06:33:02
<matplotlib.image.AxesImage object at 0x7f5e5fbd2880>

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(aia_map.data)

# The value returned is also a numpy.ndarray so we convert it back to
# a  sunpy.map.GenericMap.
out = sunpy.map.Map(out, aia_map.meta)

The resulting map is plotted.

fig = plt.figure()
ax = plt.subplot(projection=out)
out.plot()

# All the plots are plotted at the end
plt.show()
AIA $171 \; \mathrm{\mathring{A}}$ 2011-06-07 06:33:02

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

Gallery generated by Sphinx-Gallery