flaredetector: util: add function to convert normal index to folded index/cycle pair

This commit is contained in:
2024-06-13 14:48:36 +02:00
parent d66df44bea
commit b5479b5dc1
+11
View File
@@ -69,3 +69,14 @@ def plotFlareFits(ax, fits):
def markFlare(ax, fits, flux):
for fit in fits:
ax.plot(fit["FlareFitTime"], flux[fit["StandardIndex"]], color="red")
def convertStarndardIndexToFoldedIndex(foldedLc, standardIndex):
foldedIndex = standardIndex; cycle = 0
for i in range(max(foldedLc.cycle)+1):
if(foldedIndex - len(foldedLc.phase[foldedLc.cycle == i]) >= 0):
foldedIndex = foldedIndex - len(foldedLc.phase[foldedLc.cycle == i])
else:
cycle = i
break
return cycle, foldedIndex