error = False
 if not os.path.isfile(simage):
     try:
         show_overlay(lhdu,
                      shdu,
                      ra,
                      dec,
                      size,
                      firsthdu=None,
                      overlay_cat=ots,
                      overlay_scale=scale,
                      coords_color='red',
                      coords_ra=r['RA'],
                      coords_dec=r['DEC'],
                      coords_lw=3,
                      lw=2,
                      save_name=simage,
                      no_labels=True,
                      marker_ra=marker_ra,
                      marker_dec=marker_dec,
                      marker_lw=3,
                      marker_color='magenta',
                      title=title,
                      lw_ellipse=3,
                      ellipse_style=ls,
                      ellipse_color=cs,
                      peak=peak,
                      ppsize=350)
     except (Exception, RuntimeError) as e:
         error = True
     if error:
try:
    show_overlay(lhdu,
                 lhdu,
                 ra,
                 dec,
                 size,
                 firsthdu=None,
                 overlay_cat=ots,
                 show_grid=False,
                 overlay_scale=scale,
                 coords_color='red',
                 coords_ra=r['RA'],
                 coords_dec=r['DEC'],
                 coords_lw=3,
                 lw=2,
                 save_name=cimage,
                 no_labels=True,
                 marker_ra=marker_ra,
                 marker_dec=marker_dec,
                 marker_lw=3,
                 marker_color='cyan',
                 title=title,
                 lw_ellipse=3,
                 ellipse_style=ls,
                 ellipse_color=cs,
                 peak=peak,
                 ppsize=350,
                 cmap='inferno',
                 lofar_colorscale=True,
                 show_lofar=False)
    show_overlay(lhdu,
            peak = None

        plist = []
        if not os.path.isfile(iimage):
            show_overlay(lhdu,
                         ihdu,
                         ra,
                         dec,
                         size,
                         firsthdu=None,
                         overlay_cat=ots,
                         overlay_scale=scale,
                         coords_color='red',
                         coords_ra=r['RA'],
                         coords_dec=r['DEC'],
                         coords_lw=3,
                         lw=2,
                         save_name=iimage,
                         no_labels=True,
                         marker_ra=marker_ra,
                         marker_dec=marker_dec,
                         marker_lw=3,
                         marker_color='cyan',
                         title=title,
                         lw_ellipse=3,
                         ellipse_style=ls,
                         peak=peak,
                         noisethresh=1)
            plist.append(mogrify(iimage))
        if not os.path.isfile(ipimage):
            show_overlay(lhdu,
                         ihdu,
Example #4
0
        del(gals)
        '''

        ots=ot[separation(ra,dec,ot['RA'],ot['DEC'])<(size*2)]

        #pshdu=extract_subim(imagedir+'/downloads/'+psmaps[i],ra,dec,size*2,hduid=1)
        print 'Lofarfile is',lofarfile
        lhdu=extract_subim(lofarfile,ra,dec,size*2)
        firsthdu=extract_subim(imagedir+'/downloads/'+firstmaps[i],ra,dec,size*2)
        whdu=extract_subim(imagedir+'/downloads/'+wisemaps[i],ra,dec,size)
        try:
            peak==r['Peak_flux']/1000.0
        except:
            peak=None
        
        f=show_overlay(lhdu,whdu,ra,dec,size,firsthdu=firsthdu,coords_color='red',coords_ra=r['RA'],coords_dec=r['DEC'],coords_lw=3,lw=2,no_labels=True,marker_ra=marker_ra,marker_dec=marker_dec,marker_lw=3,marker_color='cyan',title=title,block=False,interactive=False,drlimit=8000,peak=peak)

        ora,odec=ss.odict[sourcename]
        components=ss.get_comps(sourcename)
        notcomponents=ss.get_ncomps(sourcename)
        print 'components is',components
        I=Interactive(f,ora,odec,ots,components,notcomponents)
        fig=plt.gcf()
        fig.canvas.mpl_connect('button_press_event', I.onclick)

        plt.ion()
        plt.show(block=False)
        try:
            print 'Blend probability',r['Blend_prob']
        except:
            pass
 show_overlay(lhdu,
              pshdu,
              ra,
              dec,
              size,
              firsthdu=None,
              overlay_cat=ots,
              overlay_scale=scale,
              coords_color='red',
              coords_lw=3,
              lw=1,
              save_name=psimage,
              no_labels=True,
              marker_ra=marker_ra,
              marker_dec=marker_dec,
              marker_lw=3,
              marker_color='cyan',
              title=title,
              peak=peak,
              plot_coords=False,
              show_grid=False,
              lw_ellipse=3,
              ellipse_style=ls,
              ellipse_color=colors,
              noisethresh=1.5,
              drlimit=1000,
              rms_use=rms,
              lofarlevel=2.5,
              logfile=logfile,
              sourcename=sourcename,
              vmax_cap=0.5)
        stop = False
        while not (stop):
            if display_mode == 'Spitzer':
                ohdu = extract_subim(spitzerfile, ra, dec, size)
            else:
                ohdu = extract_subim(ibandfile, ra, dec, size)
            f = show_overlay(lhdu,
                             ohdu,
                             ra,
                             dec,
                             size,
                             coords_color='red',
                             coords_ra=r['RA'],
                             coords_dec=r['DEC'],
                             coords_lw=3,
                             lw=2,
                             no_labels=True,
                             title=title,
                             block=False,
                             interactive=False,
                             drlimit=8000,
                             peak=peak,
                             plotpos=[(pwg, '+'), (mlt, 'h', 'red')])

            I = Interactive(f, ga)
            fig = plt.gcf()
            fig.canvas.mpl_connect('button_press_event', I.onclick)

            plt.ion()
            plt.show(block=False)
                    mode='wise'
                    whdu=extract_subim(wisefile,ra,dec,size*scalefactor)
                else:
                    whdu=extract_subim(legacyfile,ra,dec,size*scalefactor)
                    if np.all(np.isnan(whdu[0].data)):
                        print('Legacy image is blanked, using WISE')
                        mode='wise'
                        whdu=extract_subim(wisefile,ra,dec,size*scalefactor)

            try:
                peak==r['Peak_flux']/1000.0
            except:
                peak=None

            try:
                f=show_overlay(lhdu,whdu,ra,dec,size*scalefactor/initfactor,coords_color='red',coords_ra=s.sd[sourcename]['RA'],coords_dec=s.sd[sourcename]['DEC'],coords_lw=3,lw=2,no_labels=True,marker_ra=marker_ra,marker_dec=marker_dec,marker_lw=3,marker_color='cyan',title=title,block=False,interactive=False,drlimit=8000,peak=peak,plotpos=[(pwg,'+')])
            except Exception as e:
                print('*** Error making image. Press RETURN to skip and continue ***')
                print(e)
                raw_input()
                stop=True
                break

            ora,odec=s.optid(sourcename)

            components=s.get_comps(sourcename)
            notcomponents=[]
            for r in ots:
                name=r['Source_Name']
                if name in s.cd and s.cd['Parent']!=sourcename:
                    notcomponents.append(name)
                          size,
                          hduid=1)
    lhdu = extract_subim(lofarfile, ra, dec, size)
    firsthdu = extract_subim(imagedir + '/downloads/' + firstmaps[i], ra, dec,
                             size)

    show_overlay(lhdu,
                 pshdu,
                 ra,
                 dec,
                 size,
                 firsthdu=firsthdu,
                 overlay_cat=ots,
                 overlay_scale=scale,
                 coords_color='red',
                 coords_ra=r['RA'],
                 coords_dec=r['DEC'],
                 coords_lw=3,
                 lw=2,
                 save_name=psimage,
                 no_labels=True,
                 marker_ra=marker_ra,
                 marker_dec=marker_dec,
                 marker_lw=3,
                 marker_color='cyan',
                 title=title)

    show_overlay(lhdu,
                 pshdu,
                 ra,
                 dec,
                 size,
Example #9
0
                          dec,
                          size,
                          hduid=1)
    lhdu = extract_subim(lofarfile, ra, dec, size)
    firsthdu = extract_subim(imagedir + '/downloads/' + firstmaps[i], ra, dec,
                             size)

    show_overlay(lhdu,
                 pshdu,
                 ra,
                 dec,
                 size,
                 firsthdu=firsthdu,
                 overlay_cat=ots,
                 overlay_scale=scale,
                 coords_color='red',
                 coords_ra=r['RA'],
                 coords_dec=r['DEC'],
                 coords_lw=3,
                 lw=2,
                 save_name=psimage,
                 no_labels=True,
                 marker_ra=marker_ra,
                 marker_dec=marker_dec,
                 marker_lw=3,
                 marker_color='magenta',
                 title=title,
                 peak=r['Peak_flux'] / 1000.0)

    os.system('mogrify -quality 90 -trim ' + sourcename + '*.png')
                             size)
    try:
        peak == r['Peak_flux'] / 1000.0
    except:
        peak = None

    print ots, cols

    show_overlay(lhdu,
                 pshdu,
                 ra,
                 dec,
                 size,
                 firsthdu=firsthdu,
                 overlay_cat=ots,
                 overlay_scale=scale,
                 coords_color='red',
                 coords_ra=r['RA'],
                 coords_dec=r['DEC'],
                 coords_lw=3,
                 lw=2,
                 save_name=psimage,
                 no_labels=True,
                 marker_ra=marker_ra,
                 marker_dec=marker_dec,
                 marker_lw=3,
                 marker_color='cyan',
                 title=title,
                 ellipse_color=cols,
                 peak=peak)
        pshdu = extract_subim(imagedir + '/downloads/' + psmaps[name],
                              ra,
                              dec,
                              size,
                              hduid=1)
        lhdu = extract_subim(lofarfile, ra, dec, size)
        firsthdu = extract_subim(imagedir + '/downloads/' + firstmaps[name],
                                 ra, dec, size)
        plot_positions = check_positions[name]
        print 'Plotting positions', plot_positions
        plot_ra = []
        plot_dec = []
        for p in plot_positions:
            plot_ra.append(p[0])
            plot_dec.append(p[1])
        show_overlay(lhdu,
                     pshdu,
                     ra,
                     dec,
                     size,
                     firsthdu=firsthdu,
                     overlay_cat=ot,
                     overlay_scale=scale,
                     lw=2,
                     save_name=outname,
                     no_labels=True,
                     coords_ra=plot_ra,
                     coords_dec=plot_dec,
                     coords_lw=2)
Example #12
0
                color = bits[2]
            plotpos = [(tpp, shape)]
            print '*** PLOTPOS is ', plotpos

        show_overlay(lhdu,
                     pshdu,
                     ra,
                     dec,
                     size,
                     firsthdu=firsthdu,
                     vlasshdu=vlasshdu,
                     overlay_cat=ots,
                     overlay_scale=scale,
                     coords_color='red',
                     coords_ra=r['RA'],
                     coords_dec=r['DEC'],
                     coords_lw=3,
                     lw=2,
                     save_name=psimage,
                     no_labels=True,
                     marker_ra=marker_ra,
                     marker_dec=marker_dec,
                     marker_lw=3,
                     marker_color='magenta',
                     title=title,
                     ellipse_color=cols,
                     peak=peak,
                     plotpos=plotpos)
        whdu = extract_subim(imagedir + '/downloads/' + wisemaps[i], ra, dec,
                             size)
        show_overlay(lhdu,
                     whdu,
            peak == r['Peak_flux'] / 1000.0
        except:
            peak = None

        show_overlay(lhdu,
                     pshdu,
                     ra,
                     dec,
                     size,
                     firsthdu=None,
                     overlay_cat=ots,
                     overlay_scale=scale,
                     coords_color='red',
                     coords_lw=3,
                     lw=1,
                     save_name=psimage,
                     no_labels=True,
                     marker_ra=marker_ra,
                     marker_dec=marker_dec,
                     marker_lw=3,
                     marker_color='cyan',
                     title=title,
                     peak=peak,
                     plot_coords=False,
                     show_grid=False,
                     lw_ellipse=3,
                     ellipse_style=ls,
                     noisethresh=1.5)

        show_overlay(lhdu,
                     pshdu,
                     ra,