diff --git a/gcn_test.py b/gcn_test.py index 793ce967455064dbe0fe1bf522fd46a83c3968eb..895425876bd84e265632e8426e50c40ecfd615a6 100644 --- a/gcn_test.py +++ b/gcn_test.py @@ -73,8 +73,6 @@ def process_gcn(payload, root): for elem in root.iterfind('.//Param')} descs = [elem.text for elem in root.iterfind('.//Description')] - if params['Group'] != 'CBC': - return #prepare path for localization skymap, then download and produce the map in png format #filepath = params['skymap_fits'] @@ -156,6 +154,10 @@ def process_gcn(payload, root): pass h5file.close() return + + if params['Group'] != 'CBC': + return + if sim == False: try: table = h5file.create_table(h5file.root.events,params['GraceID'],Event,'CBC event') @@ -238,7 +240,6 @@ def process_gcn(payload, root): '''PLOTTING''' #save the pie of possibilities specindex = np.argmax(vals) - fig1, ax1 = plt.subplots(figsize=(5,5)) ax1.pie(vals,labels=None,wedgeprops=dict(width=0.5)) ax1.axis('equal') diff --git a/sync_database.py b/sync_database.py index cc583656877a82403fc9eaca1545bd72b34a3ab4..bc7d7c9b4fff57b65eb2610570fb8203c3546035 100644 --- a/sync_database.py +++ b/sync_database.py @@ -40,8 +40,6 @@ def sync_database(): for col in soup.tbody.find_all("tr"): #print(row) #for col in row("tr"): - if 'RETRACTED' in str(col): - continue #link = col.find(hasstylenotclass).a.extract() name = col.find(hasstylenotclass).a.string eventnames.append(name) @@ -55,14 +53,16 @@ def sync_database(): bestfiles = [] imglinks = [] - - if any('Update' in s for s in all_files): + retracted = 0 + if any('Retract' in s for s in all_files): + bestfiles= [s for s in all_files if 'Retract' in s] + retracted = 1 + elif any('Update' in s for s in all_files): bestfiles = [s for s in all_files if 'Update' in s] elif any('Initial' in s for s in all_files): bestfiles= [s for s in all_files if 'Initial' in s] else: - bestfiles = [s for s in all_files if 'Preliminary' in s] - + bestfiles = [s for s in all_files if 'Preliminary' in s] if any('LALInferenceOffline.png' in s for s in all_files): imglinks = [s for s in all_files if 'LALInferenceOffline.png' in s] else: @@ -76,8 +76,8 @@ def sync_database(): imgpath = evname+'.png' datapath = 'ToRead'+evname+'.xml' - - os.system("curl --silent -0 "+imgfilepath + '> ' + './'+imgpath) + if retracted != 1: + os.system("curl --silent -0 "+imgfilepath + '> ' + './'+imgpath) os.system("curl --silent -0 "+datafilepath + '> ' + './'+datapath) payload = open(datapath,'rb').read()