Skip to content

Commit 4a8a066

Browse files
committed
tweak find_wavelet_peaks() S/N calculation to make it more accurate
1 parent fc2fa84 commit 4a8a066

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

geminidr/ghost/parameters_ghost_spect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class determineWavelengthSolutionConfig(config.Config):
5252
flat = config.ListField("Flat field", (str, ad), None,
5353
optional=True, single=True)
5454
min_snr = config.RangeField("Minimum S/N for peak detection",
55-
float, 20, min=10)
55+
float, 25, min=10)
5656
sigma = config.RangeField("Number of standard deviations for rejecting lines",
5757
float, 3, min=1)
5858
max_iters = config.RangeField("Maximum number of iterations", int, 1, min=1)

gempy/library/peak_finding.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,13 @@ def find_wavelet_peaks(data, widths=None, mask=None, variance=None, min_snr=1, m
675675
peaks = sorted([x[1][0] for x in filtered])
676676

677677
# Estimate the SNR from the wavelet-transformed data to remove continuum
678-
# Multiply by sqrt(2) to account for the fact that the wavelet has
678+
# Multiply by 1.25 to account for the fact that the wavelet has
679679
# increased the width of a feature (and hence reduced its height) by
680-
# approximately that factor.
680+
# approximately that factor (since the narrowest Ricker filter has 3/4
681+
# the width and 1.0^ + 0.75^2 = 1.25^2).
681682
snr = np.divide(wavelet_transformed_data[0], np.sqrt(variance),
682683
out=np.zeros_like(data, dtype=np.float32),
683-
where=variance > 0) * np.sqrt(2)
684+
where=variance > 0) * 1.25
684685

685686
peaks = [x for x in peaks if snr[x] > min_snr]
686687

0 commit comments

Comments
 (0)