def main(targ_file, survey='2r', radec=None, deci=None, fpath=None, EPOCH=0., DSS=None, BW=False, imsize=5., show_spec=False): ''' Parameters: --------- targ_file: string or List of string ASCII file for targets (Name, RA, DEC) or a List Colon separated RA, DEC expected radec: integer (0) Flag indicating type of input 0 = ASCII file 1 = List or ['Name', 'RA', 'DEC'] BW: bool (False) B&W image? show_spec: bool (False) Try to grab and show an SDSS spectrum ''' import radec as x_r reload(x_r) import matplotlib.pyplot as plt import matplotlib.cm as cm # Init if fpath is None: fpath = './' cradius = imsize / 50. # Read in the Target list ra_tab = get_coord(targ_file, radec=radec) # Grab ra, dec in decimal degrees if deci != None: return # Convert to decimal degress x_r.stod(ra_tab) #ra_tab['RA'][q], ra_tab['DEC'][q], TABL) # Precess (as necessary) if EPOCH > 1000.: from astropy import units as u from astropy.coordinates import FK5 from astropy.time import Time # Precess to 2000. tEPOCH = Time(EPOCH, format='jyear', scale='utc') # Load into astropy fk5c = FK5(ra=ra_tab['RAD'], dec=ra_tab['DECD'], equinox=tEPOCH, unit=(u.degree,u.degree)) # Precess newEPOCH = Time(2000., format='jyear', scale='utc') newfk5 = fk5c.precess_to(newEPOCH) # Save ra_tab['RAD'] = newfk5.ra.degree ra_tab['DECD'] = newfk5.dec.degree # Strings too? ra_tab['RA'] = str(newfk5.ra.to_string(unit=u.hour,sep=':')) ra_tab['DEC'] = str(newfk5.dec.to_string(unit=u.hour,sep=':')) ## # Main Loop nobj = len(ra_tab) for qq in range(nobj): # Outfil outfil = fpath+ra_tab['Name'][qq]+'.pdf' print(outfil) # Grab the Image from xastropy.obs import x_getsdssimg as xgs reload(xgs) img, oBW = xgs.getimg(ra_tab['RAD'][qq], ra_tab['DECD'][qq], imsize, BW=BW,DSS=DSS) # Generate the plot plt.clf() fig = plt.figure(dpi=1200) fig.set_size_inches(8.0,10.5) # Font plt.rcParams['font.family']= 'times new roman' ticks_font = matplotlib.font_manager.FontProperties(family='times new roman', style='normal', size=16, weight='normal', stretch='normal') ax = plt.gca() for label in ax.get_yticklabels() : label.set_fontproperties(ticks_font) for label in ax.get_xticklabels() : label.set_fontproperties(ticks_font) # Image if oBW == 1: cmm = cm.Greys_r else: cmm = None plt.imshow(img,cmap=cmm,aspect='equal',extent=(-imsize/2., imsize/2, -imsize/2.,imsize/2)) # Axes plt.xlim(-imsize/2., imsize/2.) plt.ylim(-imsize/2., imsize/2.) # Label plt.xlabel('Relative ArcMin', fontsize=20) xpos = 0.12*imsize ypos = 0.02*imsize plt.text(-imsize/2.-xpos, 0., 'EAST', rotation=90.,fontsize=20) plt.text(0.,imsize/2.+ypos, 'NORTH', fontsize=20, horizontalalignment='center') # Title plt.text(0.5,1.24, str(ra_tab['Name'][qq]), fontsize=32, horizontalalignment='center',transform=ax.transAxes) plt.text(0.5,1.16, 'RA (J2000) = '+str(ra_tab['RA'][qq]), fontsize=28, horizontalalignment='center',transform=ax.transAxes) plt.text(0.5,1.10, 'DEC (J2000) = '+str(ra_tab['DEC'][qq]), fontsize=28, horizontalalignment='center',transform=ax.transAxes) #import pdb; pdb.set_trace() # Circle circle=plt.Circle((0,0),cradius,color='y', fill=False) plt.gca().add_artist(circle) # Spectrum?? if show_spec: spec_img = xgs.get_spec_img(ra_tab['RAD'][qq], ra_tab['DECD'][qq]) plt.imshow(spec_img,extent=(-imsize/2.1, imsize*(-0.1), -imsize/2.1, imsize*(-0.2))) # Write if show_spec: plt.savefig(outfil, dpi=300) else: plt.savefig(outfil) print 'finder: Wrote '+outfil #xdb.set_trace() print 'finder: All done.' return
def main(inp, survey='2r', radec=None, deci=None, fpath=None, show_circ=True, EPOCH=0., DSS=None, BW=False, imsize=5.*astrou.arcmin, show_spec=False, OUT_TYPE='PDF'): ''' Parameters: --------- inp: Input string or List of strings or List of several items 'ra_dec_list.txt' -- ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) ['NAME_OF_TARG', '10:31:38.87', '+25:59:02.3'] ['NAME_OF_TARG', 124.24*u.deg, -23.244*u.deg] ['NAME_OF_TARG', SkyCoord] radec: integer (0) [DEPRECATED!] Flag indicating type of input 0 = ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) 1 = List of string ['Name', 'RA', 'DEC'] 2 = ['Name', ra_deg, dec_deg] BW: bool (False) B&W image? show_circ: bool (True) Show a yellow circle on the target show_spec: bool (False) Try to grab and show an SDSS spectrum imsize: Quantity, optional Image size OUT_TYPE: str, optional File type -- 'PDF', 'PNG' ''' reload(x_r) reload(xgs) import matplotlib.pyplot as plt import matplotlib.cm as cm # Init if fpath is None: fpath = './' try: imsize=imsize.to('arcmin').value except AttributeError: raise AttributeError('finder: Input imsize needs to be an Angle') cradius = imsize / 50. # Read in the Target list if isinstance(inp,basestring): ra_tab = get_coord(targ_file, radec=radec) else: ira_tab = {} ira_tab['Name'] = inp[0] if isinstance(inp[1],basestring): ra, dec = x_r.stod1((inp[1],inp[2])) ira_tab['RA'] = ra ira_tab['DEC'] = dec elif isinstance(inp[1],float): ira_tab['RA'] = inp[1] * astrou.deg ira_tab['DEC'] = inp[2]* astrou.deg elif isinstance(inp[1],SkyCoord): ira_tab['RA'] = inp[1].ra.deg ira_tab['DEC'] = inp[1].dec.deg else: # Should check it is a Quantity ira_tab['RA'] = inp[1] ira_tab['DEC'] = inp[2] # Strings ras,decs = x_r.dtos1((ira_tab['RA'],ira_tab['DEC'])) ira_tab['RAS'] = ras ira_tab['DECS'] = decs # Make a list ra_tab = [ira_tab] # Grab ra, dec in decimal degrees if deci is not None: return #xdb.set_trace() #x_r.stod(ra_tab) #ra_tab['RA'][q], ra_tab['DEC'][q], TABL) # Precess (as necessary) if EPOCH > 1000.: from astropy import units as u from astropy.coordinates import FK5 from astropy.time import Time # Precess to 2000. tEPOCH = Time(EPOCH, format='jyear', scale='utc') # Load into astropy fk5c = FK5(ra=ra_tab['RA'], dec=ra_tab['DEC'], equinox=tEPOCH, unit=(u.degree,u.degree)) # Precess newEPOCH = Time(2000., format='jyear', scale='utc') newfk5 = fk5c.precess_to(newEPOCH) # Save ra_tab['RA'] = newfk5.ra.degree ra_tab['DEC'] = newfk5.dec.degree # Strings too? ra_tab['RAS'] = str(newfk5.ra.to_string(unit=u.hour,sep=':')) ra_tab['DECS'] = str(newfk5.dec.to_string(unit=u.hour,sep=':')) ## # Main Loop for obj in ra_tab: # Outfil nm = "".join(obj['Name'].split()) if OUT_TYPE=='PNG': outfil = fpath+ nm + '.png' else: outfil = fpath+ nm + '.pdf' print(outfil) # Grab the Image reload(xgs) img, oBW = xgs.getimg(obj['RA'], obj['DEC'], imsize, BW=BW,DSS=DSS) # Generate the plot plt.clf() fig = plt.figure(dpi=1200) fig.set_size_inches(8.0,10.5) # Font plt.rcParams['font.family']= 'times new roman' ticks_font = matplotlib.font_manager.FontProperties(family='times new roman', style='normal', size=16, weight='normal', stretch='normal') ax = plt.gca() for label in ax.get_yticklabels() : label.set_fontproperties(ticks_font) for label in ax.get_xticklabels() : label.set_fontproperties(ticks_font) # Image if oBW == 1: cmm = cm.Greys_r else: cmm = None plt.imshow(img,cmap=cmm,aspect='equal',extent=(-imsize/2., imsize/2, -imsize/2.,imsize/2)) # Axes plt.xlim(-imsize/2., imsize/2.) plt.ylim(-imsize/2., imsize/2.) # Label plt.xlabel('Relative ArcMin', fontsize=20) xpos = 0.12*imsize ypos = 0.02*imsize plt.text(-imsize/2.-xpos, 0., 'EAST', rotation=90.,fontsize=20) plt.text(0.,imsize/2.+ypos, 'NORTH', fontsize=20, horizontalalignment='center') # Title plt.text(0.5,1.24, str(nm), fontsize=32, horizontalalignment='center',transform=ax.transAxes) plt.text(0.5,1.16, 'RA (J2000) = '+str(obj['RAS']), fontsize=28, horizontalalignment='center',transform=ax.transAxes) plt.text(0.5,1.10, 'DEC (J2000) = '+str(obj['DECS']), fontsize=28, horizontalalignment='center',transform=ax.transAxes) #import pdb; pdb.set_trace() # Circle if show_circ: circle=plt.Circle((0,0),cradius,color='y', fill=False) plt.gca().add_artist(circle) # Spectrum?? if show_spec: spec_img = xgs.get_spec_img(obj['RA'], obj['DEC']) plt.imshow(spec_img,extent=(-imsize/2.1, imsize*(-0.1), -imsize/2.1, imsize*(-0.2))) # Write if show_spec: plt.savefig(outfil, dpi=300) else: plt.savefig(outfil) print 'finder: Wrote '+outfil plt.close() #xdb.set_trace() print 'finder: All done.' return oBW
def main(inp, survey='2r', radec=None, deci=None, fpath=None, EPOCH=0., DSS=None, BW=False, imsize=5., show_spec=False): ''' Parameters: --------- inp: Input string or List of strings or List of several items 'ra_dec_list.txt' -- ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) ['NAME_OF_TARG', '10:31:38.87', '+25:59:02.3'] ['NAME_OF_TARG', 124.24*u.deg, -23.244*u.deg] radec: integer (0) [DEPRECATED!] Flag indicating type of input 0 = ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) 1 = List of string ['Name', 'RA', 'DEC'] 2 = ['Name', ra_deg, dec_deg] BW: bool (False) B&W image? show_spec: bool (False) Try to grab and show an SDSS spectrum imsize: float Image size in arcmin ''' reload(x_r) reload(xgs) import matplotlib.pyplot as plt import matplotlib.cm as cm # Init if fpath is None: fpath = './' cradius = imsize / 50. # Read in the Target list if isinstance(inp, basestring): ra_tab = get_coord(targ_file, radec=radec) else: ira_tab = {} ira_tab['Name'] = inp[0] if isinstance(inp[1], basestring): ra, dec = x_r.stod1((inp[1], inp[2])) ira_tab['RA'] = ra ira_tab['DEC'] = dec elif isinstance(inp[1], float): ira_tab['RA'] = inp[1] * astrou.deg ira_tab['DEC'] = inp[2] * astrou.deg else: # Should check it is a Quantity ira_tab['RA'] = inp[1] ira_tab['DEC'] = inp[2] # Strings ras, decs = x_r.dtos1((ira_tab['RA'], ira_tab['DEC'])) ira_tab['RAS'] = ras ira_tab['DECS'] = decs # Make a list ra_tab = [ira_tab] # Grab ra, dec in decimal degrees if deci is not None: return #xdb.set_trace() #x_r.stod(ra_tab) #ra_tab['RA'][q], ra_tab['DEC'][q], TABL) # Precess (as necessary) if EPOCH > 1000.: from astropy import units as u from astropy.coordinates import FK5 from astropy.time import Time # Precess to 2000. tEPOCH = Time(EPOCH, format='jyear', scale='utc') # Load into astropy fk5c = FK5(ra=ra_tab['RA'], dec=ra_tab['DEC'], equinox=tEPOCH, unit=(u.degree, u.degree)) # Precess newEPOCH = Time(2000., format='jyear', scale='utc') newfk5 = fk5c.precess_to(newEPOCH) # Save ra_tab['RA'] = newfk5.ra.degree ra_tab['DEC'] = newfk5.dec.degree # Strings too? ra_tab['RAS'] = str(newfk5.ra.to_string(unit=u.hour, sep=':')) ra_tab['DECS'] = str(newfk5.dec.to_string(unit=u.hour, sep=':')) ## # Main Loop for obj in ra_tab: # Outfil nm = "".join(obj['Name'].split()) outfil = fpath + nm + '.pdf' print(outfil) # Grab the Image reload(xgs) img, oBW = xgs.getimg(obj['RA'], obj['DEC'], imsize, BW=BW, DSS=DSS) # Generate the plot plt.clf() fig = plt.figure(dpi=1200) fig.set_size_inches(8.0, 10.5) # Font plt.rcParams['font.family'] = 'times new roman' ticks_font = matplotlib.font_manager.FontProperties( family='times new roman', style='normal', size=16, weight='normal', stretch='normal') ax = plt.gca() for label in ax.get_yticklabels(): label.set_fontproperties(ticks_font) for label in ax.get_xticklabels(): label.set_fontproperties(ticks_font) # Image if oBW == 1: cmm = cm.Greys_r else: cmm = None plt.imshow(img, cmap=cmm, aspect='equal', extent=(-imsize / 2., imsize / 2, -imsize / 2., imsize / 2)) # Axes plt.xlim(-imsize / 2., imsize / 2.) plt.ylim(-imsize / 2., imsize / 2.) # Label plt.xlabel('Relative ArcMin', fontsize=20) xpos = 0.12 * imsize ypos = 0.02 * imsize plt.text(-imsize / 2. - xpos, 0., 'EAST', rotation=90., fontsize=20) plt.text(0., imsize / 2. + ypos, 'NORTH', fontsize=20, horizontalalignment='center') # Title plt.text(0.5, 1.24, str(nm), fontsize=32, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.16, 'RA (J2000) = ' + str(obj['RAS']), fontsize=28, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.10, 'DEC (J2000) = ' + str(obj['DECS']), fontsize=28, horizontalalignment='center', transform=ax.transAxes) #import pdb; pdb.set_trace() # Circle circle = plt.Circle((0, 0), cradius, color='y', fill=False) plt.gca().add_artist(circle) # Spectrum?? if show_spec: spec_img = xgs.get_spec_img(obj['RA'], obj['DEC']) plt.imshow(spec_img, extent=(-imsize / 2.1, imsize * (-0.1), -imsize / 2.1, imsize * (-0.2))) # Write if show_spec: plt.savefig(outfil, dpi=300) else: plt.savefig(outfil) print 'finder: Wrote ' + outfil #xdb.set_trace() print 'finder: All done.' return oBW
def main(inp, survey='2r', radec=None, deci=None, fpath=None, show_circ=True, EPOCH=0., DSS=None, BW=False, imsize=5. * astrou.arcmin, show_spec=False, OUT_TYPE='PDF', show_another=None): ''' Parameters: --------- inp: Input string or List of strings or List of several items 'ra_dec_list.txt' -- ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) ['NAME_OF_TARG', '10:31:38.87', '+25:59:02.3'] ['NAME_OF_TARG', 124.24*u.deg, -23.244*u.deg] ['NAME_OF_TARG', SkyCoord] radec: integer (0) [DEPRECATED!] Flag indicating type of input 0 = ASCII file with columns of Name,RA,DEC and RA,DEC are string or float (deg) 1 = List of string ['Name', 'RA', 'DEC'] 2 = ['Name', ra_deg, dec_deg] BW: bool (False) B&W image? show_circ: bool (True) Show a yellow circle on the target show_another : tuple, optional RA,DEC for another target to circle (e.g. offset star) show_spec: bool (False) Try to grab and show an SDSS spectrum imsize: Quantity, optional Image size OUT_TYPE: str, optional File type -- 'PDF', 'PNG' ''' reload(x_r) reload(xgs) import matplotlib.pyplot as plt import matplotlib.cm as cm # Init if fpath is None: fpath = './' try: imsize = imsize.to('arcmin').value except AttributeError: raise AttributeError('finder: Input imsize needs to be an Angle') cradius = imsize / 50. # Read in the Target list if isinstance(inp, basestring): raise NotImplementedError("No longer implemented") #ra_tab = get_coord(targ_file, radec=radec) else: ira_tab = {} ira_tab['Name'] = inp[0] if isinstance(inp[1], basestring): ra, dec = x_r.stod1((inp[1], inp[2])) ira_tab['RA'] = ra ira_tab['DEC'] = dec elif isinstance(inp[1], float): ira_tab['RA'] = inp[1] * astrou.deg ira_tab['DEC'] = inp[2] * astrou.deg elif isinstance(inp[1], SkyCoord): ira_tab['RA'] = inp[1].ra.deg ira_tab['DEC'] = inp[1].dec.deg else: # Should check it is a Quantity ira_tab['RA'] = inp[1] ira_tab['DEC'] = inp[2] # Strings ras, decs = x_r.dtos1((ira_tab['RA'], ira_tab['DEC'])) ira_tab['RAS'] = ras ira_tab['DECS'] = decs # Make a list ra_tab = [ira_tab] # Grab ra, dec in decimal degrees if deci is not None: return #xdb.set_trace() #x_r.stod(ra_tab) #ra_tab['RA'][q], ra_tab['DEC'][q], TABL) # Precess (as necessary) if EPOCH > 1000.: from astropy import units as u from astropy.coordinates import FK5 from astropy.time import Time # Precess to 2000. tEPOCH = Time(EPOCH, format='jyear', scale='utc') # Load into astropy fk5c = FK5(ra=ra_tab['RA'], dec=ra_tab['DEC'], equinox=tEPOCH, unit=(u.degree, u.degree)) # Precess newEPOCH = Time(2000., format='jyear', scale='utc') newfk5 = fk5c.precess_to(newEPOCH) # Save ra_tab['RA'] = newfk5.ra.degree ra_tab['DEC'] = newfk5.dec.degree # Strings too? ra_tab['RAS'] = str(newfk5.ra.to_string(unit=u.hour, sep=':')) ra_tab['DECS'] = str(newfk5.dec.to_string(unit=u.hour, sep=':')) ## # Main Loop for obj in ra_tab: # Outfil nm = "".join(obj['Name'].split()) if OUT_TYPE == 'PNG': outfil = fpath + nm + '.png' else: outfil = fpath + nm + '.pdf' print(outfil) # Grab the Image reload(xgs) img, oBW = xgs.getimg(obj['RA'], obj['DEC'], imsize, BW=BW, DSS=DSS) # Generate the plot plt.clf() fig = plt.figure(dpi=1200) fig.set_size_inches(8.0, 10.5) # Font plt.rcParams['font.family'] = 'times new roman' ticks_font = matplotlib.font_manager.FontProperties( family='times new roman', style='normal', size=16, weight='normal', stretch='normal') ax = plt.gca() for label in ax.get_yticklabels(): label.set_fontproperties(ticks_font) for label in ax.get_xticklabels(): label.set_fontproperties(ticks_font) # Image if oBW == 1: cmm = cm.Greys_r else: cmm = None plt.imshow(img, cmap=cmm, aspect='equal', extent=(-imsize / 2., imsize / 2, -imsize / 2., imsize / 2)) # Axes plt.xlim(-imsize / 2., imsize / 2.) plt.ylim(-imsize / 2., imsize / 2.) # Label plt.xlabel('Relative ArcMin', fontsize=20) xpos = 0.12 * imsize ypos = 0.02 * imsize plt.text(-imsize / 2. - xpos, 0., 'EAST', rotation=90., fontsize=20) plt.text(0., imsize / 2. + ypos, 'NORTH', fontsize=20, horizontalalignment='center') #import pdb; pdb.set_trace() # Circle if show_circ: circle = plt.Circle((0, 0), cradius, color='y', fill=False) plt.gca().add_artist(circle) # Second Circle if show_another is not None: # Coordinates cobj = x_r.to_coord((obj['RA'], obj['DEC'])) canother = x_r.to_coord(show_another) # Offsets off, PA = x_r.offsets(cobj, canother) xanother = -1 * off[0].to('arcmin').value yanother = off[1].to('arcmin').value square = matplotlib.patches.Rectangle( (xanother - cradius, yanother - cradius), cradius * 2, cradius * 2, color='cyan', fill=False) plt.gca().add_artist(square) plt.text(0.5, 1.24, str(nm), fontsize=32, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.18, 'RA (J2000) = ' + str(obj['RAS']) + ' DEC (J2000) = ' + str(obj['DECS']), fontsize=22, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.12, 'RA(offset) = {:s} DEC(offset) = {:s}'.format( canother.ra.to_string(unit=astrou.hour, pad=True, sep=':', precision=2), canother.dec.to_string(pad=True, alwayssign=True, sep=':', precision=1)), fontsize=22, horizontalalignment='center', transform=ax.transAxes, color='blue') plt.text( 0.5, 1.06, 'RA(offset to obj) = {:g} DEC(offset to obj) = {:g}'.format( -1 * off[0].to('arcsec'), -1 * off[1].to('arcsec')), fontsize=18, horizontalalignment='center', transform=ax.transAxes) else: # Title plt.text(0.5, 1.24, str(nm), fontsize=32, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.16, 'RA (J2000) = ' + str(obj['RAS']), fontsize=28, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.10, 'DEC (J2000) = ' + str(obj['DECS']), fontsize=28, horizontalalignment='center', transform=ax.transAxes) # Spectrum?? if show_spec: spec_img = xgs.get_spec_img(obj['RA'], obj['DEC']) plt.imshow(spec_img, extent=(-imsize / 2.1, imsize * (-0.1), -imsize / 2.1, imsize * (-0.2))) # Write if show_spec: plt.savefig(outfil, dpi=300) else: plt.savefig(outfil) print 'finder: Wrote ' + outfil plt.close() #xdb.set_trace() print 'finder: All done.' return oBW
def main(targ_file, survey='2r', radec=None, deci=None, fpath=None, EPOCH=0., DSS=None, BW=False, imsize=5., show_spec=False): ''' Parameters: --------- targ_file: string or List of string ASCII file for targets (Name, RA, DEC) or a List Colon separated RA, DEC expected radec: integer (0) Flag indicating type of input 0 = ASCII file 1 = List or ['Name', 'RA', 'DEC'] BW: bool (False) B&W image? show_spec: bool (False) Try to grab and show an SDSS spectrum imsize: float Image size in arcmin ''' import radec as x_r #reload(x_r) reload(xgs) import matplotlib.pyplot as plt import matplotlib.cm as cm # Init if fpath is None: fpath = './' cradius = imsize / 50. # Read in the Target list ra_tab = get_coord(targ_file, radec=radec) # Grab ra, dec in decimal degrees if deci != None: return # Convert to decimal degress x_r.stod(ra_tab) #ra_tab['RA'][q], ra_tab['DEC'][q], TABL) # Precess (as necessary) if EPOCH > 1000.: from astropy import units as u from astropy.coordinates import FK5 from astropy.time import Time # Precess to 2000. tEPOCH = Time(EPOCH, format='jyear', scale='utc') # Load into astropy fk5c = FK5(ra=ra_tab['RA'], dec=ra_tab['DEC'], equinox=tEPOCH, unit=(u.degree, u.degree)) # Precess newEPOCH = Time(2000., format='jyear', scale='utc') newfk5 = fk5c.precess_to(newEPOCH) # Save ra_tab['RA'] = newfk5.ra.degree ra_tab['DEC'] = newfk5.dec.degree # Strings too? ra_tab['RAS'] = str(newfk5.ra.to_string(unit=u.hour, sep=':')) ra_tab['DECS'] = str(newfk5.dec.to_string(unit=u.hour, sep=':')) ## # Main Loop nobj = len(ra_tab) for qq in range(nobj): # Outfil nm = "".join(ra_tab['Name'][qq].split()) outfil = fpath + nm + '.pdf' print(outfil) # Grab the Image reload(xgs) img, oBW = xgs.getimg(ra_tab['RA'][qq], ra_tab['DEC'][qq], imsize, BW=BW, DSS=DSS) # Generate the plot plt.clf() fig = plt.figure(dpi=1200) fig.set_size_inches(8.0, 10.5) # Font plt.rcParams['font.family'] = 'times new roman' ticks_font = matplotlib.font_manager.FontProperties( family='times new roman', style='normal', size=16, weight='normal', stretch='normal') ax = plt.gca() for label in ax.get_yticklabels(): label.set_fontproperties(ticks_font) for label in ax.get_xticklabels(): label.set_fontproperties(ticks_font) # Image if oBW == 1: cmm = cm.Greys_r else: cmm = None plt.imshow(img, cmap=cmm, aspect='equal', extent=(-imsize / 2., imsize / 2, -imsize / 2., imsize / 2)) # Axes plt.xlim(-imsize / 2., imsize / 2.) plt.ylim(-imsize / 2., imsize / 2.) # Label plt.xlabel('Relative ArcMin', fontsize=20) xpos = 0.12 * imsize ypos = 0.02 * imsize plt.text(-imsize / 2. - xpos, 0., 'EAST', rotation=90., fontsize=20) plt.text(0., imsize / 2. + ypos, 'NORTH', fontsize=20, horizontalalignment='center') # Title plt.text(0.5, 1.24, str(nm), fontsize=32, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.16, 'RA (J2000) = ' + str(ra_tab['RAS'][qq]), fontsize=28, horizontalalignment='center', transform=ax.transAxes) plt.text(0.5, 1.10, 'DEC (J2000) = ' + str(ra_tab['DECS'][qq]), fontsize=28, horizontalalignment='center', transform=ax.transAxes) #import pdb; pdb.set_trace() # Circle circle = plt.Circle((0, 0), cradius, color='y', fill=False) plt.gca().add_artist(circle) # Spectrum?? if show_spec: spec_img = xgs.get_spec_img(ra_tab['RA'][qq], ra_tab['DEC'][qq]) plt.imshow(spec_img, extent=(-imsize / 2.1, imsize * (-0.1), -imsize / 2.1, imsize * (-0.2))) # Write if show_spec: plt.savefig(outfil, dpi=300) else: plt.savefig(outfil) print 'finder: Wrote ' + outfil #xdb.set_trace() print 'finder: All done.' return oBW