@@ -2899,21 +2899,21 @@ def medfilt1d(self, data, npt_rad=1024, npt_azim=512,
2899
2899
return result
2900
2900
2901
2901
def sigma_clip_legacy (self , data , npt_rad = 1024 , npt_azim = 512 ,
2902
- correctSolidAngle = True , polarization_factor = None ,
2903
- radial_range = None , azimuth_range = None ,
2904
- dark = None , flat = None ,
2905
- method = "splitpixel" , unit = units .Q ,
2906
- thres = 3 , max_iter = 5 , dummy = None , delta_dummy = None ,
2907
- mask = None , normalization_factor = 1.0 , metadata = None ):
2902
+ correctSolidAngle = True , polarization_factor = None ,
2903
+ radial_range = None , azimuth_range = None ,
2904
+ dark = None , flat = None ,
2905
+ method = ("full" , "histogram" , "cython" ), unit = units .Q ,
2906
+ thres = 3 , max_iter = 5 , dummy = None , delta_dummy = None ,
2907
+ mask = None , normalization_factor = 1.0 , metadata = None ,
2908
+ safe = True , ** kwargs ):
2908
2909
"""Perform first a 2D integration and then an iterative sigma-clipping
2909
2910
filter along each row. See the doc of scipy.stats.sigmaclip for the
2910
2911
options `thres` and `max_iter`.
2911
2912
2912
2913
:param data: input image as numpy array
2913
- :param npt_rad: number of radial points
2914
+ :param npt_rad: number of radial points (alias: npt)
2914
2915
:param npt_azim: number of azimuthal points
2915
- :param bool correctSolidAngle: correct for solid angle of each pixel
2916
- if True
2916
+ :param bool correctSolidAngle: correct for solid angle of each pixel when set
2917
2917
:param float polarization_factor: polarization factor between -1 (vertical)
2918
2918
and +1 (horizontal).
2919
2919
@@ -2928,17 +2928,22 @@ def sigma_clip_legacy(self, data, npt_rad=1024, npt_azim=512,
2928
2928
:param ndarray flat: flat field image
2929
2929
:param unit: unit to be used for integration
2930
2930
:param method: pathway for integration and sort
2931
- :param thres: cut-off for n*sigma: discard any values with `|I-<I>|/sigma > thres`.
2931
+ :param thres: cut-off for n*sigma: discard any values with `|I-<I>| > thres*σ `.
2932
2932
The threshold can be a 2-tuple with sigma_low and sigma_high.
2933
2933
:param max_iter: maximum number of iterations
2934
2934
:param mask: masked out pixels array
2935
2935
:param float normalization_factor: Value of a normalization monitor
2936
2936
:param metadata: any other metadata,
2937
2937
:type metadata: JSON serializable dict
2938
+ :param safe: unset to save some checks on sparse matrix shape/content.
2938
2939
:return: Integrate1D-like result
2939
2940
2940
2941
Nota: The initial 2D-integration requires pixel splitting
2941
2942
"""
2943
+ #compatibility layer with sigma_clip_ng
2944
+ if "npt" in kwargs :
2945
+ npt_rad = kwargs ["npt" ]
2946
+
2942
2947
# We use NaN as dummies
2943
2948
if dummy is None :
2944
2949
dummy = numpy .NaN
@@ -2966,7 +2971,7 @@ def sigma_clip_legacy(self, data, npt_rad=1024, npt_azim=512,
2966
2971
dummy = dummy , delta_dummy = delta_dummy ,
2967
2972
correctSolidAngle = correctSolidAngle ,
2968
2973
polarization_factor = polarization_factor ,
2969
- normalization_factor = normalization_factor )
2974
+ normalization_factor = normalization_factor , safe = safe )
2970
2975
image = res2d .intensity
2971
2976
if (method .impl_lower == "opencl" ):
2972
2977
if (method .algo_lower == "csr" ) and \
@@ -3079,7 +3084,7 @@ def sigma_clip_ng(self, data,
3079
3084
3080
3085
Keep only pixels with intensty:
3081
3086
3082
- ``|I - <I>| < thres * std (I)``
3087
+ ``|I - <I>| < thres * σ (I)``
3083
3088
3084
3089
This enforces a symmetric, bell-shaped distibution (i.e. gaussian-like) and is very good at extracting
3085
3090
background or amorphous isotropic scattering out of Bragg peaks.
0 commit comments