Skip to content

Commit 9a4d741

Browse files
committed
protect against overflow to ceil
1 parent f053f39 commit 9a4d741

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/continuum_rassine_like.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@ function calc_continuum(λ::AV1, f_obs::AV2, var_obs::AV3, anchors::AV5; λout::
649649
mean_snr_per_pix = calc_mean_snr(f_obs,var_obs)
650650
#smoothing_half_width = (mean_snr_per_pix >= 30) ? smoothing_half_width : 40
651651
if mean_snr_per_pix < 30
652-
smoothing_half_width = min(100, ceil(Int64,6*(30/mean_snr_per_pix)^2))
652+
smoothing_half_width_float = 6*(30/mean_snr_per_pix)^2)
653+
smoothing_half_width = smoothing_half_width_float>100 ? 100 : ceil(Int64,smoothing_half_width_float)
653654
end
654655
f_smooth = Continuum.smooth(f_obs, half_width=smoothing_half_width)
655656
if length(anchors) < 4

0 commit comments

Comments
 (0)