In [ ]:
# This changes the current directory to the base saga directory - make sure to run this first!
# This is necessary to be able to import the py files and use the right directories,
# while keeping all the notebooks in their own directory.
import os
import sys
if 'saga_base_dir' not in locals():
saga_base_dir = os.path.abspath('..')
if saga_base_dir not in sys.path:
os.chdir(saga_base_dir)
In [29]:
for module in ['hosts', 'targeting', 'magellan']:
if module in globals():
reload(globals()[module])
else:
globals()[module] = __import__(module)
g = targeting.get_gama() #re-caches the gama catalog
In [37]:
magellan.build_imacs_targeting_files(hosts.h6, 'Munoz')
In [61]:
figure(figsize=(10,10))
magellan.plot_imacs_masks(hosts.h6,save=True)
In [69]:
hosts.h2.open_on_nsasite()
In [50]:
print magellan.imagelist_imacs_targets('imacs_targets/DLG6_1.SMF')
In [51]:
print magellan.imagelist_imacs_targets('imacs_targets/DLG6_2.SMF')
In [52]:
print magellan.imagelist_imacs_targets('imacs_targets/DLG6_3.SMF')
In [2]:
candidates = [hosts.h5, hosts.NSAHost(140594), hosts.NSAHost(13927)]
for c in candidates:
c.usnob_environs_query(dl=True)
c.sdss_environs_query(dl=True)
In [178]:
[c.open_on_nsasite() for c in candidates];
In [5]:
[len(targeting.select_targets(c)) for c in candidates]
Out[5]:
In [6]:
[len(targeting.select_targets(c,removegalsathighz=False))-len(targeting.select_targets(c)) for c in candidates]
Out[6]:
In [7]:
[len(targeting.select_targets(c)) - sum(targeting.select_targets(c)['r']<19.8) for c in candidates]
Out[7]:
In [177]:
for c in candidates:
figure(figsize=(6,6))
magellan.plot_targets_and_imacs_fov(c,'short')
gca().set_aspect(1)
title(c.name)
In [188]:
print 'WITH STARS'
for c in candidates:
t1 = targeting.select_targets(c,removegama=False)
t2 = targeting.select_targets(c,removegama='all')
t3 = targeting.select_targets(c,removegama='now')
print h.name,'w/o gama',len(t1),'GAMA planned',len(t2),'Only current GAMA',len(t3)
print '\nW/O STARS'
for c in candidates:
t1 = targeting.select_targets(c,removegama=False,galvsallcutoff=21)
t2 = targeting.select_targets(c,removegama='all',galvsallcutoff=21)
t3 = targeting.select_targets(c,removegama='now',galvsallcutoff=21)
print h.name,'w/o gama',len(t1),'GAMA planned',len(t2),'Only current GAMA',len(t3)
In [190]:
#examine the targets
h = candidates[1]
t = targeting.select_targets(c,removegama='now')
targeting.sampled_imagelist(t['ra'],t['dec'],names=t['objID'])
Out[190]:
In [192]:
#see what gal-only targets look like
h = candidates[1]
t = targeting.select_targets(c,removegama='now',galvsallcutoff=21)
targeting.sampled_imagelist(t['ra'],t['dec'],names=t['objID']);
In [204]:
#check to make sure reference star-like things are good
cat=h.get_sdss_catalog()
refmsk = (17 < cat['psf_r']) & (cat['psf_r'] < 19)
for band in 'gri':
refmsk = refmsk & (np.abs(cat[band] - cat['psf_' + band]) < 0.25)
sum(refmsk)
cr = cat[refmsk]
targeting.sampled_imagelist(cr['ra'],cr['dec'],names=cr['objID'])
Out[204]:
In [162]:
h = candidates[1]
raddeg = np.degrees(250 / (1000 * h.distmpc))
m,g,ds = targeting.find_gama(h.get_sdss_catalog(), h, raddeg,1/3600)
In [129]:
from scipy import spatial
g=targeting.get_gama()
kdt = spatial.cKDTree(np.array([g['RA_J2000'], g['DEC_J2000']]).T)
In [142]:
cat = candidates[1].get_sdss_catalog()
d,idx = kdt.query(np.array([cat['ra'], cat['dec']]).T)
In [151]:
tol = 1/3600
gi=g[idx[d<tol]]
i=110
gi[i],cat[d<tol][i],d[d<tol][i]*3600
Out[151]:
In [154]:
m,gm, dm = targeting.find_gama(cat,h,.5,1/3600)
i=110
gm[i],cat[m][i],dm[i]*3600
Out[154]:
In [159]:
targeting.sampled_imagelist(gm['RA_J2000'],gm['DEC_J2000'],names=gm['GAMA_IAU_ID'])
Out[159]:
In [30]:
rvdct = magellan.load_ricardo_rvs_and_match()
rvdct.keys()
Out[30]:
In [31]:
#rvs are relative to host - so smallest absolute ones are of interest
sorti = np.argsort(np.abs(rvdct['rvs']))
In [32]:
lns = ['name ra dec']
for dv, ra, dec in zip(rvdct['rvs'][sorti], rvdct['ras'][sorti], rvdct['decs'][sorti]):
lns.append(' '.join(('dv=' + str(dv),str(ra),str(dec))))
print '\n'.join(lns)
#paste into http://skyserver.sdss3.org/dr9/en/tools/chart/list.asp
In [33]:
print rvdct['fns'][sorti]
In [ ]: