astrodatagui: FlaredetectorWidget: properly set flux error too
This commit is contained in:
@@ -48,6 +48,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
self.mainLayout.addWidget(self.periodogramInfoGroupBox)
|
||||
|
||||
self.fluxType = "sap_flux"
|
||||
self.fluxErrType = "sap_flux_err"
|
||||
self.NormalizeState = {"Enabled": False, "Scale": "unscaled"}
|
||||
self.RemoveOutliersState = {"Enabled": False, "Sigma": 5.0}
|
||||
self.RemoveNansState = {"Enabled": False}
|
||||
@@ -90,7 +91,16 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
if(fluxType not in ["sap_flux", "pdcsap_flux"]):
|
||||
print(f"FluxType not supported: {fluxType}, setting default sap_flux")
|
||||
fluxType = "sap_flux"
|
||||
fluxErrType = "sap_flux_err"
|
||||
|
||||
match fluxType:
|
||||
case "sap_flux":
|
||||
fluxErrType = "sap_flux_err"
|
||||
case "pdcsap_flux":
|
||||
fluxErrType = "pdcsap_flux_err"
|
||||
|
||||
self.fluxType = fluxType
|
||||
self.fluxErrType = fluxErrType
|
||||
self.updatePlot()
|
||||
|
||||
def setNormalizeState(self, enabled: bool, scale: str):
|
||||
@@ -173,11 +183,13 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
|
||||
def normalizeStichedLightCurve(self, lc):
|
||||
lc.flux = lc[self.fluxType]
|
||||
lc.flux_err = lc[self.fluxErrType]
|
||||
return lc.normalize(unit=self.NormalizeState["Scale"])
|
||||
|
||||
def updateFit(self):
|
||||
lc = self.currentLC
|
||||
lc.flux = lc[self.fluxType]
|
||||
lc.flux_err = lc[self.fluxErrType]
|
||||
self.currentFlattenLC = lc.flatten(window_length=self.FlattenState["WindowLength"],
|
||||
polyorder=self.FlattenState["PolynomialOrder"])
|
||||
self.peaks, self.fits = calculateFlareFitsForLightcurve(self.currentFlattenLC, num=100)
|
||||
@@ -186,6 +198,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
lc = self.currentLC
|
||||
label = f"{self.currentMainName}"
|
||||
lc.flux = lc[self.fluxType]
|
||||
lc.flux_err = lc[self.fluxErrType]
|
||||
|
||||
if(self.NormalizeState["Enabled"]):
|
||||
if(self.currentLCCollection is None):
|
||||
|
||||
Reference in New Issue
Block a user