In [1]:
# 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 [2]:
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 [8]:
hs = hosts.get_saga_hosts_from_google(googleun, googlepw)
hs


Out[8]:
[<hosts.NSAHost object w/ name 'Odyssey' AKA: ['NGC6181', 'NSA147100']>,
 <hosts.NSAHost object w/ name 'Iliad' AKA: ['NGC7393', 'NSA150238']>,
 <hosts.NSAHost object w/ name 'Alice' AKA: ['NGC4030', 'NSA140594']>,
 <hosts.NSAHost object w/ name 'Beowulf' AKA: ['NGC2750', 'NSA135667']>,
 <hosts.NSAHost object w/ name 'Gilgamesh' AKA: ['NGC5962', 'NSA166313']>,
 <hosts.NSAHost object w/ name 'Hamlet' AKA: ['NGC5899', 'NSA166035']>,
 <hosts.NSAHost object w/ name 'Aeneid' AKA: ['NGC-99', 'NSA148734']>,
 <hosts.NSAHost object w/ name 'AnaK' AKA: ['NGC7716', 'NSA61945']>,
 <hosts.NSAHost object w/ name 'Ulysses' AKA: ['NGC7428', 'NSA150340']>]

In [11]:
ane = [h for h in hs if h.name=='Aeneid'][0]

In [27]:
ane.shortname = 'Aene'

In [13]:
ane.sdss_environs_query(True)
ane.usnob_environs_query(True)


File catalogs/Aeneid_sdss.dat exists - not downloading anything.
File catalogs/Aeneid_usnob.dat exists - not downloading anything.

In [16]:
ane.physical_to_projected(300*u.kpc)


Out[16]:
$19.8766 \; \mathrm{{}^{\prime}}$

In [31]:
magellan.build_imacs_targeting_files(ane, 'Marchi/Munoz', overwrite=True, refmagrange={'r':(17,17.5)}, selectkws=dict(faintlimit=22))


Removing 12 objects at high z w/ good spectra, keeping 4 (total of 171846 objects)
Wrote catalog to imacs_targets/Aene.cat
Wrote obs file to imacs_targets/Aene_ini.obs

Try some test runs


In [24]:
magellan.plot_imacs_masks(ane, eastleft=True)


[]
Total targets= 0

In [35]:
print ane.sdss_environs_query(xmatchwise=True)


SELECT  p.objId  as objID,
p.ra, p.dec, p.type, p.flags, p.specObjID, dbo.fPhotoTypeN(p.type) as phot_sg,
p.modelMag_u as u, p.modelMag_g as g, p.modelMag_r as r,p.modelMag_i as i,p.modelMag_z as z,
p.modelMagErr_u as u_err, p.modelMagErr_g as g_err, p.modelMagErr_r as r_err,p.modelMagErr_i as i_err,p.modelMagErr_z as z_err,
p.psfMag_u as psf_u, p.psfMag_g as psf_g, p.psfMag_r as psf_r, p.psfMag_i as psf_i, p.psfMag_z as psf_z,
p.fibermag_r, p.fiber2mag_r,
p.petroMag_r + 2.5*log10(2*PI()*p.petroR50_r*p.petroR50_r) as sb_petro_r,
p.expMag_r, p.expMag_r + 2.5*log10(2*PI()*p.expRad_r*p.expRad_r + 1e-20) as sb_exp_r,
p.deVMag_r, p.deVMag_r + 2.5*log10(2*PI()*p.deVRad_r*p.deVRad_r + 1e-20) as sb_deV_r,
p.lnLExp_r, p.lnLDeV_r, p.lnLStar_r,
p.extinction_u as Au, p.extinction_g as Ag, p.extinction_r as Ar, p.extinction_i as Ai, p.extinction_z as Az,
ISNULL(s.z, -1) as spec_z, ISNULL(s.zErr, -1) as spec_z_err, ISNULL(s.zWarning, -1) as spec_z_warn, s.class as spec_class,
s.subclass as spec_subclass, ISNULL(pz.z,-1) as photz,ISNULL(pz.zerr,-1) as photz_err, ISNULL(W.w1mpro,-99) as w1, ISNULL(W.w1sigmpro, -99) as w1_err



FROM dbo.fGetNearbyObjEq(309.727020806, -5.63998013366, 19.8766428759) n, PhotoPrimary p
LEFT JOIN WISE_xmatch X ON p.objid = X.sdss_objid
LEFT JOIN wise_allsky W ON x.wise_cntr = W.cntr
LEFT JOIN SpecObj s ON p.specObjID = s.specObjID
LEFT JOIN PhotoZ pz ON p.ObjID = pz.ObjID
WHERE n.objID = p.objID



In [ ]: