Beispiel #1
0
def find_median_astrometry(astromaps,pointingra,pointingdec):

    foundpointing = False
    for astromap in astromaps:
        ra,dec=getposim('%s/astromap.fits'%astromap)
        if sepn(ra*deg2rad,dec*deg2rad,pointingra,pointingdec)*rad2deg < 0.6:        
            foundpointing = True
            f = fits.open('%s/astromap.fits'%astromap)
            _,_,ys,xs=f[0].data.shape
            # Use central 20% of the image
            subim=f[0].data[0][0][ys/2-ys/5:ys/2+ys/5,xs/2-xs/5:xs/2+xs/5].flatten()
    if foundpointing:
        subim = np.nan_to_num(subim)
        return np.median(subim)
    else:
        print 'Cant find astrometry near %s, %s'%(pointingra*rad2deg,pointingdec*rad2deg)
        sys.exit(0)
def find_median_astrometry(astromaps,pointingra,pointingdec):

    foundpointing = False
    for astromap in astromaps:
        amname='%s/astromap.fits'%astromap
        if not os.path.isfile(amname):
            continue
        ra,dec=getposim(amname)
        if sepn(ra*deg2rad,dec*deg2rad,pointingra,pointingdec)*rad2deg < 0.6:        
            foundpointing = True
            f = fits.open('%s/astromap.fits'%astromap)
            _,_,ys,xs=f[0].data.shape
            # Use central 20% of the image
            subim=f[0].data[0][0][old_div(ys,2)-old_div(ys,5):old_div(ys,2)+old_div(ys,5),old_div(xs,2)-old_div(xs,5):old_div(xs,2)+old_div(xs,5)].flatten()
    if foundpointing:
        subim = np.nan_to_num(subim)
        return np.median(subim)
    else:
        print('Cant find astrometry near %s, %s'%(pointingra*rad2deg,pointingdec*rad2deg))
        return None
Beispiel #3
0
                    job_status = 'running'
                    d_colour = 'green'
                else:
                    job_status = 'other (' + jobs[shortname] + ')'

            for ft in s_files:
                if os.path.isfile('image_' + ft + '.app.restored.fits'):
                    secondary_status = ft
        circles.append((name, ra, dec, s_colours[status], d_colour))
        print "%-45s %-15s %8.3f %8.3f %-12s %-10s %s" % (
            d, name, ra, dec, status, job_status, secondary_status)
        continue
    # else check for image only
    ims = glob.glob('image_full_ampphase1m_shift.int.facetRestored.fits')
    if len(ims) > 0:
        ra, dec = getposim(ims[0])
        if name is None:
            name = d.split('/')[-1]
            name = name.split('_')[0]
        print "%-45s %-15s %8.3f %8.3f %-12s" % (d, name, ra, dec, 'final')
        circles.append((name, ra, dec, 'blue'))

ras = np.array([c[1] for c in circles])
decs = np.array([c[2] for c in circles])
rarange = max(ras) - min(ras)
decrange = max(decs) - min(decs)
yfigsize = 1
xfigsize = (rarange / decrange) * np.cos(np.mean(decs) * np.pi / 180.0)
maxs = max((xfigsize, yfigsize))
xfigsize *= 18 / maxs
yfigsize *= 18 / maxs
                elif jobs[shortname] == 'R':
                    job_status = 'running'
                    d_colour = 'green'
                else:
                    job_status = 'other ('+jobs[shortname]+')'
            
            for ft in s_files:
                if os.path.isfile('image_'+ft+'.app.restored.fits'):
                    secondary_status = ft
        circles.append((name,ra,dec,s_colours[status],d_colour))
        print "%-45s %-15s %8.3f %8.3f %-12s %-10s %s" % (d,name,ra,dec,status,job_status,secondary_status)
        continue
    # else check for image only
    ims=glob.glob('image_full_ampphase1m_shift.int.facetRestored.fits')
    if len(ims)>0:
        ra,dec=getposim(ims[0])
        if name is None:
            name=d.split('/')[-1]
            name=name.split('_')[0]
        print "%-45s %-15s %8.3f %8.3f %-12s" % (d,name,ra,dec,'final')
        circles.append((name,ra,dec,'blue'))

ras=np.array([c[1] for c in circles])
decs=np.array([c[2] for c in circles])
rarange=max(ras)-min(ras)
decrange=max(decs)-min(decs)
yfigsize=1
xfigsize=(rarange/decrange)*np.cos(np.mean(decs)*np.pi/180.0)
maxs=max((xfigsize,yfigsize))
xfigsize*=18/maxs
yfigsize*=18/maxs