flaredetector: bring it up to date

This commit is contained in:
2024-11-13 13:03:04 +01:00
parent c76fd0153a
commit 1df661815a
8 changed files with 777 additions and 24 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ def getFlareCount(filesDict):
pdcsapminPhasesBounds, pdcsapmaxPhasesBounds = getPhaseRangesNearPeak((pdcsapMinima, pdcsapMaxima), pdcsapPhase, returnPhaseValue=True)
pdcsapFoldedPeaks = []
pdcsapFoldedPeaksPhasePair = []
for peak in sapPeaks:
for peak in pdcsapPeaks:
cycle, foldedIndex = convertStarndardIndexToFoldedIndex(pdcsapFoldedLC, peak["StandardIndex"])
pdcsapFoldedPeaks.append({"Cycle: ": cycle, "Index": foldedIndex})
pdcsapFoldedPeaksPhasePair.append({"Phase": pdcsapFoldedLC.phase[pdcsapFoldedLC.cycle == cycle][foldedIndex], "Peak": peak})
+288 -9
View File
@@ -1,6 +1,6 @@
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QGridLayout,
QPushButton, QCheckBox, QLabel)
QPushButton, QCheckBox, QLabel, QLineEdit)
from matplotlib.figure import Figure
from matplotlib.backends.backend_qtagg import (
FigureCanvas, NavigationToolbar2QT as NavigationToolbar)
@@ -41,6 +41,13 @@ def sumArrayLengthsNorm(series):
sumRes += len(s)
return sumRes / len(series)
def normalizePhase(phase, phaseMin = None, phaseMax = None):
if(phaseMin is None):
phaseMin = np.abs(np.min(phase))
if(phaseMax is None):
phaseMax = np.abs(np.max(phase))
return (phase + phaseMin) / (phaseMin + phaseMax) * (2)
class FlareSummaryPlotGUI(QWidget):
def __init__(self, starFLareDictList):
@@ -87,6 +94,11 @@ class FlareSummaryPlotGUI(QWidget):
self.btShowFlaresInMinimaMaximaPerMinimaMaxima = QPushButton("Show num Flares Minima/Maxima normalized")
self.btShowFlaresInMinimaMaximaPerMinimaMaxima.clicked.connect(self.btShowFlaresInMinimaMaximaPerMinimaMaximaClicked)
self.btShowFlaresBinnedOnPhase = QPushButton("Show flares binned")
self.btShowFlaresBinnedOnPhase.clicked.connect(self.btShowFlaresBinnedOnPhaseClicked)
self.textNumBins = QLineEdit()
self.textNumBins.setText("10")
self.cbKepler = QCheckBox("Kepler")
self.cbKepler.setChecked(True)
self.cbK2 = QCheckBox("K2")
@@ -95,7 +107,7 @@ class FlareSummaryPlotGUI(QWidget):
self.cbTESS.setChecked(True)
self.cbSpTypeL = QCheckBox("L")
self.cbSpTypeL.setChecked(True)
self.cbSpTypeL.setChecked(False)
self.cbSpTypeM = QCheckBox("M")
self.cbSpTypeM.setChecked(True)
self.cbSpTypeK = QCheckBox("K")
@@ -105,7 +117,7 @@ class FlareSummaryPlotGUI(QWidget):
self.cbSpTypeF = QCheckBox("F")
self.cbSpTypeF.setChecked(True)
self.cbSpTypeUnknown = QCheckBox("Unknown")
self.cbSpTypeUnknown.setChecked(True)
self.cbSpTypeUnknown.setChecked(False)
self.cbShowSAP = QCheckBox("SAP")
self.cbShowSAP.setChecked(True)
@@ -121,6 +133,8 @@ class FlareSummaryPlotGUI(QWidget):
self.buttonGridLayout.addWidget(self.btNumMinimaMaximaNorm, 0, 6)
self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaxima, 0, 7)
self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaximaPerMinimaMaxima, 0, 8)
self.buttonGridLayout.addWidget(self.btShowFlaresBinnedOnPhase, 0, 9)
self.buttonGridLayout.addWidget(self.textNumBins, 0, 10)
self.buttonGridLayout.addWidget(QLabel("Sources: "), 1, 0)
self.buttonGridLayout.addWidget(self.cbKepler, 1, 1)
@@ -128,12 +142,12 @@ class FlareSummaryPlotGUI(QWidget):
self.buttonGridLayout.addWidget(self.cbTESS, 1, 3)
self.buttonGridLayout.addWidget(QLabel("Sp Types: "), 2, 0)
self.buttonGridLayout.addWidget(self.cbSpTypeL, 2, 1)
self.buttonGridLayout.addWidget(self.cbSpTypeM, 2, 2)
self.buttonGridLayout.addWidget(self.cbSpTypeK, 2, 3)
self.buttonGridLayout.addWidget(self.cbSpTypeG, 2, 4)
self.buttonGridLayout.addWidget(self.cbSpTypeF, 2, 5)
self.buttonGridLayout.addWidget(self.cbSpTypeUnknown, 2, 6)
#self.buttonGridLayout.addWidget(self.cbSpTypeL, 2, 1)
self.buttonGridLayout.addWidget(self.cbSpTypeM, 2, 1)
self.buttonGridLayout.addWidget(self.cbSpTypeK, 2, 2)
self.buttonGridLayout.addWidget(self.cbSpTypeG, 2, 3)
self.buttonGridLayout.addWidget(self.cbSpTypeF, 2, 4)
#self.buttonGridLayout.addWidget(self.cbSpTypeUnknown, 2, 6)
self.buttonGridLayout.addWidget(self.cbShowSAP, 3, 0)
self.buttonGridLayout.addWidget(self.cbShowPDCSAP, 3, 1)
@@ -1295,3 +1309,268 @@ class FlareSummaryPlotGUI(QWidget):
print("Total Minima: ", PDCSAPtotalMin)
print("Total Maxima: ", PDCSAPtotalMax)
def btShowFlaresBinnedOnPhaseClicked(self):
data = self.starFLareDictList
showSourceFilter = np.full(len(data), False)
try:
nBins = int(self.textNumBins.text())
except Exception as e:
print("Falling back to 10 Bins")
print(e)
nBins = 10
if(self.cbKepler.isChecked()):
showKepler = data["Source"] == "Kepler"
showSourceFilter |= showKepler
if(self.cbK2.isChecked()):
showK2 = data["Source"] == "K2"
showSourceFilter |= showK2
if(self.cbTESS.isChecked()):
showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS
finalData = pd.DataFrame()
#if(self.cbSpTypeL.isChecked()):
# Lfilter = data["SpType"].str.startswith("L")
# Lfilter &= showSourceFilter
# finalData = pd.concat([finalData, data[Lfilter]], ignore_index=True)
if(self.cbSpTypeM.isChecked()):
Mfilter = data["SpType"].str.startswith("M")
Mfilter &= showSourceFilter
finalData = pd.concat([finalData, data[Mfilter]], ignore_index=True)
if(self.cbSpTypeK.isChecked()):
Kfilter = data["SpType"].str.startswith("K")
Kfilter &= showSourceFilter
finalData = pd.concat([finalData, data[Kfilter]], ignore_index=True)
if(self.cbSpTypeG.isChecked()):
Gfilter = data["SpType"].str.startswith("G")
Gfilter &= showSourceFilter
finalData = pd.concat([finalData, data[Gfilter]], ignore_index=True)
if(self.cbSpTypeF.isChecked()):
Ffilter = data["SpType"].str.startswith("F")
Ffilter &= showSourceFilter
finalData = pd.concat([finalData, data[Ffilter]], ignore_index=True)
#if(self.cbSpTypeUnknown.isChecked()):
# Unknownfilter = data["SpType"].str.startswith("-")
# Unknownfilter &= showSourceFilter
# finalData = pd.concat([finalData, data[Unknownfilter]], ignore_index=True)
sapbinningData = []
pdcsapbinningData = []
for ind, row in finalData.reset_index().iterrows():
SAPminOrigPhase = row["sapFoldedFitPhaseStarEnd"][0]
SAPmaxOrigPhase = row["sapFoldedFitPhaseStarEnd"][1]
PDCSAPminOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][0]
PDCSAPmaxOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][1]
sapValsList = []
pdcsapValsList = []
if(len(row["sapFoldedPeaksPhasePair"]) > 0):
sapVals = pd.DataFrame(row["sapFoldedPeaksPhasePair"])
for td, peak in zip(sapVals["Phase"], sapVals["Peak"]):
sapbinningData.append({"SpType": row["SpType"][0],
"SAPNormPhase": normalizePhase(td.value, np.abs(SAPminOrigPhase), np.abs(SAPmaxOrigPhase)),
"Peak": peak["FlarePeak"]})
if(len(row["pdcsapFoldedPeaksPhasePair"]) > 0):
pdcsapVals = pd.DataFrame(row["pdcsapFoldedPeaksPhasePair"])
for td, peak in zip(pdcsapVals["Phase"], pdcsapVals["Peak"]):
pdcsapbinningData.append({"SpType": row["SpType"][0],
"PDCSAPNormPhase": normalizePhase(td.value, np.abs(PDCSAPminOrigPhase), np.abs(PDCSAPmaxOrigPhase)),
"Peak": peak["FlarePeak"]})
if(peak["FlarePeak"] > 100):
print(row["StarName"], "has over 100 peak")
sapbinningData = pd.DataFrame(sapbinningData)
SAPdataList = []
SAPlabelList = []
SAPcolorList = []
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
PDCSAPdataList = []
PDCSAPlabelList = []
PDCSAPcolorList = []
#if(self.cbSpTypeL.isChecked()):
# SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "L"]["SAPNormPhase"])
# SAPlabelList.append("L Stars")
# SAPcolorList.append("brown")
# PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "L"]["PDCSAPNormPhase"])
# PDCSAPlabelList.append("L Stars")
# PDCSAPcolorList.append("brown")
if(self.cbSpTypeM.isChecked()):
SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "M"]["SAPNormPhase"])
SAPlabelList.append("M Stars")
SAPcolorList.append("red")
PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "M"]["PDCSAPNormPhase"])
PDCSAPlabelList.append("M Stars")
PDCSAPcolorList.append("red")
if(self.cbSpTypeK.isChecked()):
SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "K"]["SAPNormPhase"])
SAPlabelList.append("K Stars")
SAPcolorList.append("orange")
PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "K"]["PDCSAPNormPhase"])
PDCSAPlabelList.append("K Stars")
PDCSAPcolorList.append("orange")
if(self.cbSpTypeG.isChecked()):
SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "G"]["SAPNormPhase"])
SAPlabelList.append("G Stars")
SAPcolorList.append("yellow")
PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "G"]["PDCSAPNormPhase"])
PDCSAPlabelList.append("G Stars")
PDCSAPcolorList.append("yellow")
if(self.cbSpTypeF.isChecked()):
SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "F"]["SAPNormPhase"])
SAPlabelList.append("F Stars")
SAPcolorList.append("greenyellow")
PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "F"]["PDCSAPNormPhase"])
PDCSAPlabelList.append("F Stars")
PDCSAPcolorList.append("greenyellow")
#if(self.cbSpTypeUnknown.isChecked()):
# SAPdataList.append(sapbinningData[sapbinningData["SpType"] == "-"]["SAPNormPhase"])
# SAPlabelList.append("Unknown Stars")
# SAPcolorList.append("gray")
# PDCSAPdataList.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "-"]["PDCSAPNormPhase"])
# PDCSAPlabelList.append("Unknown Stars")
# PDCSAPcolorList.append("gray")
self.figureAxis.clear()
import matplotlib.ticker as tck
from matplotlib.pyplot import MaxNLocator
import matplotlib.pyplot as plt
#fig, ((ax1, ax3), (ax5, ax7)) = plt.subplots(nrows=2, ncols=2)
fig1, ((ax1)) = plt.subplots(nrows=1, ncols=1)
ax1.clear()
ax1.set_title("PDCSAP Flarerate in phase")
y, binEdges, _ = ax1.hist(PDCSAPdataList, nBins, label=PDCSAPlabelList, color=PDCSAPcolorList, stacked=True)
bincenters = 0.5*(binEdges[1:]+binEdges[:-1])
if(isinstance(y[0], np.ndarray)):
y = y[-1]
print("n_i")
n_i = y
print(n_i)
print("----------------------")
print("m_i")
m_i = bincenters * np.pi
print(m_i)
print("----------------------")
print("N")
N = np.sum(n_i)
print(N)
print("----------------------")
mean = np.sum(n_i * m_i)/N
print(np.sum(n_i * m_i))
print("----------------------")
print(mean)
print("----------------------")
stdDev = np.sqrt(np.sum(((n_i - mean)**2)) / (N-1))
print(stdDev)
menStd = np.sqrt(y)
#width = 0.05
print(bincenters)
print(type(y))
ax1.bar(bincenters, y, width=0, color='r', yerr=stdDev)
ax1.set_ylabel("Num. flares")
ax1.set_xlabel("Phase")
ax1.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
ax1.xaxis.set_major_locator(MaxNLocator(5))
ax1.legend()
ax2 = ax1.twinx()
secAxisXdata = np.linspace(0, 2, num=10000)
secAxisYdata = np.cos(secAxisXdata*np.pi) + 1
ax2.plot(secAxisXdata, secAxisYdata)
ax2.set_ylim(0, 5)
fig3, ((ax3)) = plt.subplots(nrows=1, ncols=1)
ax3.clear()
ax3.set_title("PDCSAP Flare peak in phase")
if(self.cbSpTypeM.isChecked()):
Mfilter = pdcsapbinningData["SpType"] == "M"
ax3.scatter(pdcsapbinningData[Mfilter]["PDCSAPNormPhase"],
pdcsapbinningData[Mfilter]["Peak"],
label="M Stars", color="red")
if(self.cbSpTypeK.isChecked()):
ax3.scatter(pdcsapbinningData[pdcsapbinningData["SpType"] == "K"]["PDCSAPNormPhase"],
pdcsapbinningData[pdcsapbinningData["SpType"] == "K"]["Peak"],
label="K Stars", color="orange")
if(self.cbSpTypeG.isChecked()):
ax3.scatter(pdcsapbinningData[pdcsapbinningData["SpType"] == "G"]["PDCSAPNormPhase"],
pdcsapbinningData[pdcsapbinningData["SpType"] == "G"]["Peak"],
label="G Stars", color="yellow")
if(self.cbSpTypeF.isChecked()):
ax3.scatter(pdcsapbinningData[pdcsapbinningData["SpType"] == "F"]["PDCSAPNormPhase"],
pdcsapbinningData[pdcsapbinningData["SpType"] == "F"]["Peak"],
label="F Stars", color="greenyellow")
#if(self.cbSpTypeUnknown.isChecked()):
# ax3.scatter(pdcsapbinningData[pdcsapbinningData["SpType"] == "-"]["PDCSAPNormPhase"],
# pdcsapbinningData[pdcsapbinningData["SpType"] == "-"]["Peak"],
# label="Unknown Stars", color="gray")
ax3.set_ylabel("Flare peak")
ax3.set_xlabel("Phase")
ax3.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
ax3.xaxis.set_major_locator(MaxNLocator(5))
ax3.legend()
fig5, ((ax5)) = plt.subplots(nrows=1, ncols=1)
ax5.clear()
ax5.set_title("PDCSAP Flare peak in phase")
PDCSAPdataList2dhistPhase = []
PDCSAPdataList2dhistPeak = []
PDCSAPlabelList2dhist = []
PDCSAPcolorList2dhist = []
if(self.cbSpTypeM.isChecked()):
Mfilter = pdcsapbinningData["SpType"] == "M"
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[Mfilter]["PDCSAPNormPhase"])
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[Mfilter]["Peak"])
PDCSAPlabelList2dhist.append("M Stars")
PDCSAPcolorList2dhist.append("red")
if(self.cbSpTypeK.isChecked()):
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "K"]["PDCSAPNormPhase"])
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "K"]["Peak"])
PDCSAPlabelList2dhist.append("K Stars")
PDCSAPcolorList2dhist.append("orange")
if(self.cbSpTypeG.isChecked()):
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "G"]["PDCSAPNormPhase"])
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "G"]["Peak"])
PDCSAPlabelList2dhist.append("G Stars")
PDCSAPcolorList2dhist.append("yellow")
if(self.cbSpTypeF.isChecked()):
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "F"]["PDCSAPNormPhase"])
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "F"]["Peak"])
PDCSAPlabelList2dhist.append("F Stars")
PDCSAPcolorList2dhist.append("greenyellow")
#if(self.cbSpTypeUnknown.isChecked()):
# PDCSAPdataList2dhistPhase.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "-"]["PDCSAPNormPhase"])
# PDCSAPdataList2dhistPeak.append(pdcsapbinningData[pdcsapbinningData["SpType"] == "-"]["Peak"])
# PDCSAPlabelList2dhist.append("Unknown Stars")
# PDCSAPcolorList2dhist.append("gray")
xData = pd.DataFrame()
yData = pd.DataFrame()
for aX, aY in zip(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak):
xData = pd.concat([xData, aX], ignore_index=True)
yData = pd.concat([yData, aY], ignore_index=True)
print(np.shape(np.asarray(xData.values)[:,0]))
xData = np.asarray(xData.values)[:,0]
yData = np.asarray(yData.values)[:,0]
ax5.set_ylabel("Flare peak")
ax5.set_xlabel("Phase")
#h = ax5.hist2d(x=xData, y=yData, bins=[nBins, nBins], cmin=0, cmax=10)#, range=[[0, 2], [1, 4.5]])
#fig5.colorbar(h[3], ax=ax5)
H, xedges, yedges = np.histogram2d(xData, yData, bins=nBins)
cmax = 11
H_clipped = np.clip(H, None, cmax)
im = ax5.imshow(H_clipped.T, origin='lower', interpolation='nearest',
extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]],
aspect='auto', cmap='viridis')
fig5.colorbar(im, label='Counts', ax=ax5)
ax5.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
ax5.xaxis.set_major_locator(MaxNLocator(5))
#ax5.legend()
#fig.tight_layout()
plt.show()
+19 -1
View File
@@ -163,14 +163,32 @@ class StarDB():
else:
raise Exception(f"Fit type {fitType} not supported, must be one of {supportedFitTypes}")
def updateStarInfoSpType(self, mainName, spType):
self.dbCursor.execute(f"""UPDATE starInfo
SET spType = '{spType}'
WHERE mainName = '{mainName}'""")
self.connection.commit()
def getAllStars(self):
res = self.dbCursor.execute("""SELECT DISTINCT mainName FROM stars
ORDER BY mainName""")
resList = []
for s in res.fetchall():
resList.append(s[0])
print(f"Loading {len(resList)} stars")
return resList
def getAllStarsWithSpType(self, spType: str):
res = self.dbCursor.execute(f"""SELECT DISTINCT mainName
FROM stars INNER JOIN starInfo USING(mainName)
WHERE spType LIKE '{spType}%'
ORDER BY mainName""")
resList = []
for s in res.fetchall():
resList.append(s[0])
print(f"Loading {len(resList)} stars")
return resList
def getStarSequences(self, mainName):
res = self.dbCursor.execute(f"""SELECT sourceName, sequence FROM stars
WHERE mainName = \"{mainName}\"
+92 -13
View File
@@ -1,3 +1,4 @@
from types import NoneType
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QListWidgetItem
from PyQt5 import uic
@@ -8,6 +9,62 @@ from astropy.table import vstack
from ...astrodatadownloader.astrodatadownloader import (ObservationSource,
getStarObservations, downloadStarProducts)
from astroquery.simbad import Simbad
import multiprocessing
import concurrent.futures
from astropy.table import Table
def createEmptyObsTable():
table = Table()
table['obsID'] = []
table['obs_collection'] = []
table['dataproduct_type'] = []
table['obs_id'] = []
table['description'] = []
table['type'] = []
table['dataURI'] = []
table['productType'] = []
table['productGroupDescription'] = []
table['productSubGroupDescription'] = []
table['productDocumentationURL'] = []
table['project'] = []
table['prvversion'] = []
table['proposal_id'] = []
table['productFilename'] = []
table['size'] = []
table['parent_obsid'] = []
table['dataRights'] = []
table['calib_level'] = []
table['filters'] = []
table['sequence_number'] = []
table['starName'] = []
return table
def getStarObsParallel(starName, keplerKadences, k2Kadences, sources):
simbad = Simbad()
s = starName.strip()
altNames = simbad.query_objectids(s)
if(type(altNames) == NoneType):
altNames = [s]
else:
altNames = list(altNames["ID"])
print("Trying for " + ", ".join(altNames))
obs = createEmptyObsTable()
for name in altNames:
try:
obs = getStarObservations(name, keplerKadences, k2Kadences, sources)
if(len(obs) == 0):
continue;
obs['starName'] = name
break
except:
print(f"Could not find data for {name}")
return obs
def getStarObsParallelWrapper(args):
return getStarObsParallel(*args)
class NewStarDialog(QDialog):
def __init__(self):
super().__init__()
@@ -27,6 +84,8 @@ class NewStarDialog(QDialog):
QtWidgets.QMessageBox.Ok)
def btFetchData_clicked(self):
from astroquery.simbad import Simbad
simbad = Simbad()
star = self.leStarIdentifier.text()
if not star:
self.showErrorMessage("No star identifier",
@@ -51,23 +110,43 @@ class NewStarDialog(QDialog):
k2Kadences = [self.cbK2ShortCadence.isChecked(),
self.cbK2LongCadence.isChecked()]
allObs = []
#allObs = []
stars = star.split(";")
starsRet = []
self.listPreview.clear()
for s in stars:
s = s.strip()
obs = getStarObservations(s, keplerKadences, k2Kadences, sources)
if(len(obs) == 0):
self.showErrorMessage("No observations found",
"No observationnal data has been found with the current filters")
return
allObs.append(obs)
for o in obs:
self.listPreview.addItem(QListWidgetItem(f"{s} - {o['obs_collection']} - {o['sequence_number']}"))
#for s in stars:
# s = s.strip()
# altNames = simbad.query_objectids(s)
# if(type(altNames) == NoneType):
# altNames = [s]
# else:
# altNames = list(altNames["ID"])
# print("Trying for " + ", ".join(altNames))
# for name in altNames:
# try:
# obs = getStarObservations(name, keplerKadences, k2Kadences, sources)
# if(len(obs) == 0):
# self.showErrorMessage("No observations found",
# "No observationnal data has been found with the current filters")
# return
# allObs.append(obs)
#
# for o in obs:
# self.listPreview.addItem(QListWidgetItem(f"{name} - {o['obs_collection']} - {o['sequence_number']}"))
# starsRet.append(name)
# break
# except:
# print(f"Could not find data for {name}")
cpuCount = multiprocessing.cpu_count()
executor = concurrent.futures.ThreadPoolExecutor(500)
args = ((starName, keplerKadences, k2Kadences, sources) for starName in stars)
allObs = list(executor.map(getStarObsParallelWrapper, args))
obs = vstack(allObs)
for o in obs:
self.listPreview.addItem(QListWidgetItem(f"{o['starName']} - {o['obs_collection']} - {o['sequence_number']}"))
self.currentObservations = obs
self.starIdentifier = star
self.starIdentifier = ";".join(starsRet)
self.leStarIdentifier.setText(self.starIdentifier)
def btOk_clicked(self):
if self.currentObservations:
+3
View File
@@ -78,6 +78,9 @@
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>999999</number>
</property>
</widget>
</item>
<item>