also discard uncertain peaks

This commit is contained in:
Valentin Boettcher 2024-06-12 16:12:58 -04:00
parent 17abcf5ce9
commit 03c125582d
2 changed files with 10 additions and 1 deletions

View file

@ -1 +0,0 @@
hiro@Phillips.106575:1718131872

View file

@ -0,0 +1 @@
hiro@Phillips.106575:1718131872

View file

@ -183,12 +183,17 @@ def find_peaks(
)
def refine_peaks(peaks: RingdownPeakData, params: RingdownParams):
def refine_peaks(
peaks: RingdownPeakData, params: RingdownParams, uncertainty_threshold: float = 0.1
):
"""
Refine the peak positions and frequencies by fitting Lorentzians.
:param peaks: The peak data.
:param params: The ringdown parameters.
:param uncertainty_threshold: The maximum allowed uncertainty in
the mode frequencies in units of
:any:`ringdown_params.fΩ_guess`.
"""
peaks = dataclasses.replace(peaks)
@ -224,6 +229,10 @@ def refine_peaks(peaks: RingdownPeakData, params: RingdownParams):
)
perr = np.sqrt(np.diag(pcov))
if perr[1] > uncertainty_threshold * params.fΩ_guess:
deleted_peaks.append(i)
continue
new_freqs.append(popt[1])
Δfreqs.append(perr[1])