1010from sunkit_image .utils import bin_edge_summary , equally_spaced_bins , find_pixel_radii , get_radial_intensity_summary
1111
1212__all__ = [
13- "fit_polynomial_to_log_radial_intensity" ,
14- "calculate_fit_radial_intensity" ,
15- "normalize_fit_radial_intensity" ,
13+ "fnrgf" ,
1614 "intensity_enhance" ,
17- "nrgf" ,
1815 "set_attenuation_coefficients" ,
19- "fnrgf " ,
16+ "nrgf " ,
2017]
2118
2219
23- def fit_polynomial_to_log_radial_intensity (radii , intensity , degree ):
20+ def _fit_polynomial_to_log_radial_intensity (radii , intensity , degree ):
2421 """
2522 Fits a polynomial of a given degree to the log of the radial intensity.
2623
@@ -43,7 +40,7 @@ def fit_polynomial_to_log_radial_intensity(radii, intensity, degree):
4340 return np .polyfit (radii .to (u .R_sun ).value , np .log (intensity ), degree )
4441
4542
46- def calculate_fit_radial_intensity (radii , polynomial ):
43+ def _calculate_fit_radial_intensity (radii , polynomial ):
4744 """
4845 Calculates the fit value of the radial intensity at the values ``radii``.
4946
@@ -68,7 +65,7 @@ def calculate_fit_radial_intensity(radii, polynomial):
6865 return np .exp (np .poly1d (polynomial )(radii .to (u .R_sun ).value ))
6966
7067
71- def normalize_fit_radial_intensity (radii , polynomial , normalization_radius ):
68+ def _normalize_fit_radial_intensity (radii , polynomial , normalization_radius ):
7269 """
7370 Normalizes the fitted radial intensity to the value at the normalization
7471 radius.
@@ -93,7 +90,7 @@ def normalize_fit_radial_intensity(radii, polynomial, normalization_radius):
9390 An array with the same shape as radii which expresses the fitted
9491 intensity value normalized to its value at the normalization radius.
9592 """
96- return calculate_fit_radial_intensity (radii , polynomial ) / calculate_fit_radial_intensity (
93+ return _calculate_fit_radial_intensity (radii , polynomial ) / _calculate_fit_radial_intensity (
9794 normalization_radius ,
9895 polynomial ,
9996 )
@@ -192,14 +189,14 @@ def intensity_enhance(
192189
193190 # Fits a polynomial function to the natural logarithm of an estimate of
194191 # the intensity as a function of radius.
195- polynomial = fit_polynomial_to_log_radial_intensity (
192+ polynomial = _fit_polynomial_to_log_radial_intensity (
196193 radial_bin_summary [fit_here ],
197194 radial_intensity [fit_here ],
198195 degree ,
199196 )
200197
201198 # Calculate the enhancement
202- enhancement = 1 / normalize_fit_radial_intensity (map_r , polynomial , normalization_radius )
199+ enhancement = 1 / _normalize_fit_radial_intensity (map_r , polynomial , normalization_radius )
203200 enhancement [map_r < normalization_radius ] = 1
204201
205202 # Return a map with the intensity enhanced above the normalization radius
@@ -374,11 +371,8 @@ def fnrgf(
374371 order ,
375372 attenuation_coefficients ,
376373 ratio_mix = [15 , 1 ],
377- scale = None ,
378374 intensity_summary = np .nanmean ,
379- intensity_summary_kwargs = {},
380375 width_function = np .std ,
381- width_function_kwargs = {},
382376 application_radius = 1 * u .R_sun ,
383377 number_angular_segments = 130 ,
384378):
@@ -417,20 +411,12 @@ def fnrgf(
417411 A one dimensional array of shape ``[2, 1]`` with values equal to ``[K1, K2]``.
418412 The ratio in which the original image and filtered image are mixed.
419413 Defaults to ``[15, 1]``.
420- scale : `None` or `astropy.units.Quantity`, optional
421- The radius of the Sun expressed in map units. For example, in typical
422- helioprojective Cartesian maps the solar radius is expressed in units
423- of arcseconds. If `None` (the default), then the map scale is used.
424414 intensity_summary :`function`, optional
425415 A function that returns a summary statistic of the radial intensity.
426416 Default is `numpy.nanmean`.
427- intensity_summary_kwargs : `None`, `~dict`
428- Keywords applicable to the summary function.
429417 width_function : `function`
430418 A function that returns a summary statistic of the distribution of intensity, at a given radius.
431419 Defaults to `numpy.std`.
432- width_function_kwargs : `function`
433- Keywords applicable to the width function.
434420 application_radius : `astropy.units.Quantity`
435421 The FNRGF is applied to emission at radii above the application_radius.
436422 Defaults to 1 solar radii.
@@ -558,17 +544,17 @@ def fnrgf(
558544 phi_matrix = angles [annulus ].reshape ((1 , angles [annulus ].shape [0 ]))
559545 angles_of_pixel = K_matrix * phi_matrix
560546
561- # Get the approxiamted value of mean
547+ # Get the approximated value of mean
562548 mean_approximated = np .matmul (fourier_coefficients_a_k , np .cos (angles_of_pixel ))
563549 mean_approximated += np .matmul (fourier_coefficients_b_k , np .sin (angles_of_pixel ))
564550 mean_approximated += fourier_coefficient_a_0 / 2
565551
566- # Get the approxiamted value of standard deviation
552+ # Get the approximated value of standard deviation
567553 std_approximated = np .matmul (fourier_coefficients_c_k , np .cos (angles_of_pixel ))
568554 std_approximated += np .matmul (fourier_coefficients_d_k , np .sin (angles_of_pixel ))
569555 std_approximated += fourier_coefficient_c_0 / 2
570556
571- # Normailize the data
557+ # Normalize the data
572558 # Refer equation (7) in the paper
573559 std_approximated = np .where (std_approximated == 0.00 , 1 , std_approximated )
574560 data [annulus ] = np .ravel ((smap .data [annulus ] - mean_approximated ) / std_approximated )
0 commit comments