def test_nrgf(map_test1, map_test2, radial_bin_edges): result = np.zeros_like(map_test1.data) expect = rad.nrgf(map_test1, radial_bin_edges, application_radius=0.001 * u.R_sun) assert np.allclose(expect.data.shape, map_test1.data.shape) assert np.allclose(expect.data, result) # Hand calculated result = [ [0.0, 1.0, 0.0, -1.0, 0.0], [1.0, 0.0, 0.0, 0.0, -1.0], [0.0, 0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0, -1.0], [0.0, 1.0, 0.0, -1.0, 0.0], ] expect = rad.nrgf(map_test2, radial_bin_edges, application_radius=0.001 * u.R_sun) assert np.allclose(expect.data.shape, map_test2.data.shape) assert np.allclose(expect.data, result)
def test_fig_nrgf(smap): radial_bin_edges = utils.equally_spaced_bins() radial_bin_edges *= u.R_sun out = rad.nrgf(smap, radial_bin_edges) out.plot()
# 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) # The NRGF filtered map is plotted. # The image seems a little washed out so you may need to change some plotting settings # for a clearer output. fig = plt.figure() ax = plt.subplot(projection=out1) out1.plot() ########################################################################### # We will need to work out a few parameters for the FNRGF. # Order is the number of Fourier coefficients to be used in the approximation. # The attentuation coefficient are calculated to be linearly decreasing, you should # choose them according to your requirements. order = 20 attenuation_coefficients = radial.set_attenuation_coefficients(order)