def main(): nsgals2=[] f = open("targets2.txt","r") for line in f: nsgals2.append(int(line)) print nsgals2 for entry in nsgals2: try: print entry newentry = 'NSA_ID_%s' % entry if os.path.exists("NSAtlas_Output/%s.pickle" % newentry): print "%s has run already!" % newentry continue print 'running tractor for %s' %entry generalNSAtlas(entry,itune1=6,itune2=6,nocache=True) os.system('cp flip-%s.pdf NSAtlas_Output' % newentry) os.system('cp %s.png NSAtlas_Output' % newentry) os.system('cp %s.pickle NSAtlas_Output' % newentry) halflight(newentry,direc='NSAtlas_Output') except AssertionError: print traceback.print_exc() print "Tractor failed on entry: %s" % newentry continue except IndexError: print traceback.print_exc() print "Tractor failed on entry: %s" % newentry continue
def main(): rc3 = pyfits.open('mediumrc3.fits') entries = [] for entry in rc3[1].data: if entry['NAME'] != '': name = entry['NAME'] elif entry['ALT_NAME_1'] != '': name = entry['ALT_NAME_1'] elif entry['ALT_NAME_2'] != '': name = entry['ALT_NAME_2'] else: name = entry['PGC_NAME'] if entry['DEC'] < -1.: continue print((10**entry['LOG_D25']) / 10.) fn = 'RC3_Output/%s.pickle' % (name.replace(' ', '_')) print(fn) if os.path.exists(fn): print('%s has run successfully already' % name) else: print('run %s through tractor' % name) entries.append('%s' % name) things = [str(x) for x in entries] print(len(things)) things.reverse() for entry in things: print(entry) newentry = entry.replace(' ', '_') print(newentry) try: print('running tractor for %s' % entry) generalRC3(entry, itune1=6, itune2=6, nocache=True) os.system('cp flip-%s.pdf RC3_Output' % newentry) os.system('cp %s.png RC3_Output' % newentry) os.system('cp %s.pickle RC3_Output' % newentry) halflight(newentry) add_to_table(newentry) except AssertionError: print(traceback.print_exc()) print("Tractor failed on entry: %s" % newentry) continue except MemoryError: print(traceback.print_exc()) print("Tractor failed on entry: %s" % newentry) continue
def main(): rc3 = pyfits.open('mediumrc3.fits') entries=[] for entry in rc3[1].data: if entry['NAME'] != '': name = entry['NAME'] elif entry['ALT_NAME_1'] != '': name = entry['ALT_NAME_1'] elif entry['ALT_NAME_2'] != '': name = entry['ALT_NAME_2'] else: name = entry['PGC_NAME'] if entry['DEC'] < -1.: continue print (10**entry['LOG_D25'])/10. fn = 'RC3_Output/%s.pickle' % (name.replace(' ', '_')) print fn if os.path.exists(fn): print '%s has run successfully already' %name else: print 'run %s through tractor' %name entries.append('%s' %name) things=[str(x) for x in entries] print len(things) things.reverse() for entry in things: print entry newentry=entry.replace(' ', '_') print newentry try: print 'running tractor for %s' %entry generalRC3(entry,itune1=6,itune2=6,nocache=True) os.system('cp flip-%s.pdf RC3_Output' % newentry) os.system('cp %s.png RC3_Output' % newentry) os.system('cp %s.pickle RC3_Output' % newentry) halflight(newentry) add_to_table(newentry) except AssertionError: print traceback.print_exc() print "Tractor failed on entry: %s" % newentry continue except MemoryError: print traceback.print_exc() print "Tractor failed on entry: %s" % newentry continue