Skip to content

Commit b083afa

Browse files
Update radial.py to include "none" as an option for rhef (#266)
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
1 parent 4be11b2 commit b083afa

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

changelog/266.breaking.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Changed the default rank method for `sunkit_image.radial.rhef` from 'numpy' to 'scipy'.

changelog/266.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added a method called "none" to `sunkit_image.radial.rhef` to allow for the bypassing of the radial filter.

sunkit_image/radial.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,20 @@ def _percentile_ranks_numpy_inplace(arr):
118118
arr[sorted_indices] = np.arange(1, len(arr) + 1)
119119
return arr / float(len(arr))
120120

121-
# Select the sort method
121+
def _pass_without_filtering(arr):
122+
return arr
123+
124+
method = method.lower()
122125
if method == "inplace":
123126
ranking_func = _percentile_ranks_numpy_inplace
124127
elif method == "numpy":
125128
ranking_func = _percentile_ranks_numpy
126129
elif method == "scipy":
127130
ranking_func = _percentile_ranks_scipy
131+
elif method == "none":
132+
ranking_func = _pass_without_filtering
128133
else:
129-
msg = f"{method} is invalid. Allowed values are 'inplace', 'numpy', 'scipy'"
134+
msg = f"{method} is invalid. Allowed values are 'inplace', 'numpy', 'scipy', or 'none'"
130135
raise NotImplementedError(msg)
131136
return ranking_func
132137

@@ -651,7 +656,7 @@ def rhef(
651656
radial_bin_edges=None,
652657
application_radius=0 * u.R_sun,
653658
upsilon=0.35,
654-
method="numpy",
659+
method="scipy",
655660
vignette=None,
656661
progress=False,
657662
fill=np.nan,

0 commit comments

Comments
 (0)