flaredetector: util: findMaxIndices: return a -1 array of size num if no valid lc type was given
This commit is contained in:
@@ -9,6 +9,8 @@ def findMaxIndices(lc, num=3, distance=100):
|
|||||||
data = lc.power
|
data = lc.power
|
||||||
elif(isinstance(lc, LightCurve)):
|
elif(isinstance(lc, LightCurve)):
|
||||||
data = lc.flux
|
data = lc.flux
|
||||||
|
else:
|
||||||
|
return np.zeros(num)-1
|
||||||
peak_indices, peak_dict = find_peaks(data, height=(None, None), distance=distance)
|
peak_indices, peak_dict = find_peaks(data, height=(None, None), distance=distance)
|
||||||
peak_heights = peak_dict["peak_heights"]
|
peak_heights = peak_dict["peak_heights"]
|
||||||
maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]
|
maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]
|
||||||
|
|||||||
Reference in New Issue
Block a user