flaredetector: catch exception if we cant fit the flare

This commit is contained in:
2024-04-17 09:33:21 +02:00
parent 126195fdb3
commit f19dba985c
+10 -7
View File
@@ -30,13 +30,16 @@ def calculateFlareFitsForLightcurve(lightcurve, num=100, distance=1, height=0.05
peaks = [] peaks = []
fits = [] fits = []
for index in maxIndices: for index in maxIndices:
Peak, flareFitDataPoints, fit = calculateFitForFlare(lightcurve, index) try:
peaks.append({"FlarePeak": Peak, Peak, flareFitDataPoints, fit = calculateFitForFlare(lightcurve, index)
"FlarePeakTime": lightcurve.time[index], peaks.append({"FlarePeak": Peak,
"StandardIndex": index}) "FlarePeakTime": lightcurve.time[index],
fits.append({"FlareFit": fit, "StandardIndex": index})
"FlareFitTime": lightcurve.time[flareFitDataPoints], fits.append({"FlareFit": fit,
"StandardIndex": flareFitDataPoints}) "FlareFitTime": lightcurve.time[flareFitDataPoints],
"StandardIndex": flareFitDataPoints})
except Exception as error:
print("Flare fit exception: ", error)
return peaks, fits return peaks, fits