flaredetector: convert MaskedArrays to numpy arrays
MaskedArrays can not be pickled, and cause a crash when moving the data back to the main thread
This commit is contained in:
@@ -2,7 +2,6 @@ import numpy as np
|
||||
from scipy.optimize import curve_fit
|
||||
from .util import *
|
||||
|
||||
|
||||
def GaussExpo(x, Peak, l, w):
|
||||
sigma = 1/w
|
||||
res1 = Peak * np.exp(-(x**2)/(2 * sigma**2))
|
||||
@@ -39,7 +38,7 @@ def calculateFitForFlare(lightcurve, peakIndex):
|
||||
pcovDiag = np.diag(pcov)
|
||||
fit = GaussExpo(flareFitDataPoints, Peak, *popt)
|
||||
flareFitDataPoints = flareFitDataPoints + peakIndex
|
||||
return Peak+1, flareFitDataPoints, fit+1
|
||||
return np.array(Peak+1), flareFitDataPoints, np.array(fit+1)
|
||||
|
||||
def calculateFlareFitsForLightcurve(lightcurve, num=100, distance=1, height=0.05):
|
||||
maxIndices = findMaxIndices(lightcurve, num, distance=distance, height=height, sortByHighest=True)
|
||||
@@ -55,7 +54,7 @@ def calculateFlareFitsForLightcurve(lightcurve, num=100, distance=1, height=0.05
|
||||
fits.append({"FlareFit": fit,
|
||||
"FlareFitTime": lightcurve.time[flareFitDataPoints],
|
||||
"StandardIndex": flareFitDataPoints,
|
||||
"Quality": lightcurve.quality[flareFitDataPoints]})
|
||||
"Quality": lightcurve.quality[flareFitDataPoints]})
|
||||
except Exception as error:
|
||||
pass
|
||||
#print("Flare fit exception: ", error)
|
||||
|
||||
Reference in New Issue
Block a user