Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
normalizing radial gradient filter (`sunkit_image.radial.fnrgf`) to a sunpy map.
"""
# sphinx_gallery_thumbnail_number = 3
import matplotlib.pyplot as plt
import astropy.units as u
import sunpy.data.sample
import sunpy.map
import sunkit_image.radial as radial
from sunkit_image.utils import equally_spaced_bins
###########################################################################
# Sunpy's sample data contain a number of suitable FITS files for this purpose.
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()
###########################################################################
# Both the NRGF and FNRGF work on radial segments above their application radius.
# Here we create those segments radial segments. Each segment created will be of
# equal dimensions radially. The distance between 1 solar radii and 2 solar radii
# is divided into 100 equal parts by the following two lines.
radial_bin_edges = equally_spaced_bins()
radial_bin_edges *= u.R_sun
# The NRGF filter is applied after it.
out1 = radial.nrgf(aia_map, radial_bin_edges)
This example applies Multi-scale Gaussian Normalization
to a SunPy Map using `sunkit_image.enhance.mgn`.
"""
# sphinx_gallery_thumbnail_number = 2
import matplotlib.pyplot as plt
import sunpy.data.sample
import sunpy.map
import sunkit_image.enhance as enhance
###########################################################################
# 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()
###########################################################################
# 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 `~sunpy.map.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)