Skip to content

Commit 6b5ff5c

Browse files
committed
Catch ValueError before implementing a fix
1 parent f42ee8a commit 6b5ff5c

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

fink_science/rubin/random_forest_snia/processor.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,21 @@ def extract_features_rainbow(
137137
# if 3 or more filters exist, minum 3 should be rising
138138
nrising_filters = max(2, min(3, unique_bands.shape[0]))
139139

140-
features = fit_rainbow(
141-
midpointMjdTai[mask],
142-
band[mask],
143-
cpsfFlux[mask],
144-
cpsfFluxErr[mask],
145-
band_wave_aa=band_wave_aa,
146-
with_baseline=with_baseline,
147-
min_data_points=min_data_points,
148-
list_filters=band_wave_aa.keys(),
149-
nrising_filters=nrising_filters,
150-
low_bound=low_bound,
151-
)
140+
try:
141+
features = fit_rainbow(
142+
midpointMjdTai[mask],
143+
band[mask],
144+
cpsfFlux[mask],
145+
cpsfFluxErr[mask],
146+
band_wave_aa=band_wave_aa,
147+
with_baseline=with_baseline,
148+
min_data_points=min_data_points,
149+
list_filters=band_wave_aa.keys(),
150+
nrising_filters=nrising_filters,
151+
low_bound=low_bound,
152+
)
153+
except ValueError:
154+
return np.zeros(len(RAINBOW_FEATURES_NAMES), dtype=float)
152155

153156
return features[1:]
154157

0 commit comments

Comments
 (0)