Skip to content

Commit a6ce13b

Browse files
committed
Replace NaN with small values in spectral weights
1 parent c2a1c87 commit a6ce13b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sourcespec/ssp_build_spectra.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,10 @@ def _build_weight_from_ratio(spec, specnoise, smooth_width_decades):
502502
weight.data,
503503
min(0.25, weight.stats.delta / 4),
504504
left_taper=True)
505-
# Zero out weight below 0.2 Hz, so that it does not affect the fit
505+
# Replace NaN values with a small value
506+
weight.data[np.isnan(weight.data)] = 1e-9
507+
# Set to a small value weight below 0.2 Hz,
508+
# so that it does not affect the fit
506509
weight.data[weight.data <= 0.2] = 1e-9
507510
return weight
508511

0 commit comments

Comments
 (0)