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:
2024-05-16 16:10:46 +02:00
parent 38aa08fcd0
commit d5f93f8f12
+1 -2
View File
@@ -2,7 +2,6 @@ import numpy as np
from scipy.optimize import curve_fit from scipy.optimize import curve_fit
from .util import * from .util import *
def GaussExpo(x, Peak, l, w): def GaussExpo(x, Peak, l, w):
sigma = 1/w sigma = 1/w
res1 = Peak * np.exp(-(x**2)/(2 * sigma**2)) res1 = Peak * np.exp(-(x**2)/(2 * sigma**2))
@@ -39,7 +38,7 @@ def calculateFitForFlare(lightcurve, peakIndex):
pcovDiag = np.diag(pcov) pcovDiag = np.diag(pcov)
fit = GaussExpo(flareFitDataPoints, Peak, *popt) fit = GaussExpo(flareFitDataPoints, Peak, *popt)
flareFitDataPoints = flareFitDataPoints + peakIndex 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): def calculateFlareFitsForLightcurve(lightcurve, num=100, distance=1, height=0.05):
maxIndices = findMaxIndices(lightcurve, num, distance=distance, height=height, sortByHighest=True) maxIndices = findMaxIndices(lightcurve, num, distance=distance, height=height, sortByHighest=True)