@@ -177,7 +177,7 @@ def __init__(self, peak_width_limits=(0.5, 12.0), max_n_peaks=np.inf, min_peak_h
177177 self ._bw_std_edge = 1.0
178178 # Degree of overlap between gaussians for one to be dropped
179179 # This is defined in units of gaussian standard deviation
180- self ._gauss_overlap_thresh = 1.5
180+ self ._gauss_overlap_thresh = 0.75
181181 # Parameter bounds for center frequency when fitting gaussians, in terms of +/- std dev
182182 self ._cf_bound = 1.5
183183 # The maximum number of calls to the curve fitting function
@@ -1029,14 +1029,18 @@ def _drop_peak_overlap(self, guess):
10291029 the lowest height guess guassian is dropped.
10301030 """
10311031
1032- # Sort the peak guesses, so can check overlap of adjacent peaks
1032+ # Sort the peak guesses by increasing frequency, so adjacenent peaks can
1033+ # be compared from right to left.
10331034 guess = sorted (guess , key = lambda x : float (x [0 ]))
10341035
10351036 # Calculate standard deviation bounds for checking amount of overlap
1037+ # The bounds are the gaussian frequncy +/- gaussian standard deviation
10361038 bounds = [[peak [0 ] - peak [2 ] * self ._gauss_overlap_thresh ,
10371039 peak [0 ] + peak [2 ] * self ._gauss_overlap_thresh ] for peak in guess ]
10381040
10391041 # Loop through peak bounds, comparing current bound to that of next peak
1042+ # If the left peak's upper bound extends pass the right peaks lower bound,
1043+ # Then drop the guassian with the lower height.
10401044 drop_inds = []
10411045 for ind , b_0 in enumerate (bounds [:- 1 ]):
10421046 b_1 = bounds [ind + 1 ]
0 commit comments