Skip to content

Commit

Permalink
adjust continuum factors
Browse files Browse the repository at this point in the history
  • Loading branch information
AWehrhahn committed Dec 8, 2022
1 parent 79ca912 commit 77d15a5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pysme/continuum_and_radial_velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,15 @@ def __call__(

# TODO: what should this be?
if self.top_factor != 0:
from scipy.ndimage import median_filter

diff = median_filter(y, 5) - y
std = 1.5 * np.median(np.abs(diff[diff != 0] - np.median(diff[diff != 0])))
snr = 1 / std
factor = 1000 + (snr - 50) * 90
factor = np.clip(factor, 100, 100_000)
mod = np.nanmedian(u) / np.nanmedian(y) * (np.nanpercentile(y, 95) - y) ** 2
u = u + self.top_factor * mod
u = u + factor * mod

deg = sme.cscale_degree
p0 = sme.cscale[segments]
Expand Down

0 comments on commit 77d15a5

Please sign in to comment.