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 [18]:
for module in ['hosts', 'targeting', 'bossanova']:
    if module in globals():
        reload(globals()[module])
    else:
        globals()[module] = __import__(module)

In [2]:
#need to generate the catalogs using a 1.5 deg radius

In [3]:
hs = hosts.load_all_hosts(keyonname=True)

In [4]:
his = hs.values()[:2]

In [40]:
bossanova.generate_count_table(his, 'bossanova/targetingstats.dat',remove_cached=False)


Generating target count for NSA155204 # 1 of 2
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA132273 # 2 of 2
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Out[40]:
namedistmpcrvirarcmin...ntargpersat_20.5ntargpersat_20
NSA15520438.221176565926.9830529539...2764.21245.4
NSA13227360.176287143917.1383792551...2647.22091.66666667

In [41]:
tab = bossanova.generate_count_table(hs.values(), 'bossanova/targetingstats1p5deg.dat',remove_cached=True)


Generating target count for NSA155204 # 1 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA132273 # 2 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA102480 # 3 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA140259 # 4 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA141565 # 5 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA165440 # 6 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA32 # 7 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA133810 # 8 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA127782 # 9 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA166313 # 10 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA134821 # 11 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA150440 # 12 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA158901 # 13 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA5916 # 14 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA159593 # 15 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA131295 # 16 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA140895 # 17 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA165952 # 18 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA149889 # 19 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA148472 # 20 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA76316 # 21 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA133355 # 22 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA127226 # 23 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA168145 # 24 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA142728 # 25 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA25728 # 26 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA129140 # 27 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA129387 # 28 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA161509 # 29 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA169846 # 30 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA155576 # 31 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA143975 # 32 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA138634 # 33 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA169169 # 34 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA41075 # 35 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA165091 # 36 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA146210 # 37 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA147100 # 38 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA147103 # 39 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA23274 # 40 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA160608 # 41 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA161726 # 42 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA151537 # 43 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA166440 # 44 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA156839 # 45 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA64342 # 46 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA160084 # 47 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA156881 # 48 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA144045 # 49 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA150238 # 50 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA129431 # 51 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA159789 # 52 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA142509 # 53 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA48849 # 54 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA126157 # 55 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA155005 # 56 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA169528 # 57 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA151874 # 58 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA56408 # 59 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA37217 # 60 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA53553 # 61 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA139467 # 62 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA56725 # 63 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA133120 # 64 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA134212 # 65 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA149454 # 66 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}
Generating target count for NSA145188 # 67 of 67
Targeting parameters: {'removegama': False, 'faintlimit': 21, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20.5, 'outercutrad': -90}
Targeting parameters: {'removegama': False, 'faintlimit': 20, 'outercutrad': -90}

In [42]:
print tab.dtype, len(tab)


[('name', '|S9'), ('distmpc', '<f8'), ('rvirarcmin', '<f8'), ('ntarg_21', '<i8'), ('ntarg_20.5', '<i8'), ('ntarg_20', '<i8'), ('nsat_21', '<i8'), ('nsat_20.5', '<i8'), ('nsat_20', '<i8'), ('ntargpersat_21', '<f8'), ('ntargpersat_20.5', '<f8'), ('ntargpersat_20', '<f8')] 67

In [94]:
figure(figsize=(10,10))
scatter(tab['distmpc'], tab['ntarg_21']*1e-3,s=(tab['nsat_21']-np.min(tab['nsat_21']))*10+1,lw=0,alpha=1,c='r',label='$r<21$')
scatter(tab['distmpc'], tab['ntarg_20.5']*1e-3,s=(tab['nsat_20.5']-np.min(tab['nsat_20.5']))*10+1,lw=0,alpha=1,c='g',label='$r<20.5$')
scatter(tab['distmpc'], tab['ntarg_20']*1e-3,s=(tab['nsat_20']-np.min(tab['nsat_20']))*10+1,lw=0,alpha=1,c='b',label='$r<20$')
legend()
xlabel(r'$d/{\rm Mpc}$')
ylabel(r'$N / 1000$')
ylim(0.000001,40)
savefig('bossanova/ntargssize.pdf')



In [93]:
figure(figsize=(10,10))
scatter(tab['distmpc'], tab['ntarg_21']*1e-3,c=tab['nsat_21'],lw=0,alpha=1,vmin=3,vmax=7,label='$r<21$')
scatter(tab['distmpc'], tab['ntarg_20.5']*1e-3,c=tab['nsat_20.5'],lw=0,alpha=1,marker='s',vmin=3,vmax=7,label='$r<20.5$')
scatter(tab['distmpc'], tab['ntarg_20']*1e-3,c=tab['nsat_20'],lw=0,alpha=1,marker='^',vmin=3,vmax=7,label='$r<20$')
colorbar().set_label(r'$N_{\rm sats}$')
xlabel(r'$d/{\rm Mpc}$')
ylabel(r'$N / 1000$')
legend(loc=0)
ylim(0.000001,40)
savefig('bossanova/ntargscolor.pdf')


Estimating color based on draco stars


In [20]:
from astropy.io import ascii
dra = ascii.read('Draco_30am_eteq.csv')

In [25]:
g = dra['psf_g'] - dra['Ag']
r = dra['psf_r'] - dra['Ar']
i = dra['psf_i'] - dra['Ai']

In [33]:
figure(figsize=(12,12))
scatter(g-r,r,s=1,lw=0,alpha=.5)
xlim(-1.5,3)
ylim(25,16)


Out[33]:
(25, 16)

In [ ]:

Generating Catalogs


In [19]:
hs=hosts.load_all_hosts('hosts2.dat').values()
for hi in hs:
    hi.environsarcmin = 90.

In [24]:
q=hi.sdss_environs_query(magcut=('modelMag_r', 21.5))

In [25]:
print q


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



FROM dbo.fGetNearbyObjEq(187.842294042, 57.964641518, 90.0) n, PhotoPrimary p
LEFT JOIN SpecObj s ON p.specObjID = s.specObjID
WHERE n.objID = p.objID and p.modelMag_r < 21.5


In [31]:
import os
for hi in hs:
    fnbase = 'catalogs/' + hi.name + '_sdss'
    if os.path.exists(fnbase + '.dat'):
        print 'Data file for', hi.name, 'exists, not making query!'
    else:
        print 'Making query file', fnbase + '.query'
        q = hi.sdss_environs_query(magcut=('modelMag_r', 21.5))
        with open(fnbase + '.query', 'w') as f:
            f.write(q)


Making query file catalogs/NSA144113_sdss.query
Data file for NSA144045 exists, not making query!
Data file for NSA143975 exists, not making query!
Making query file catalogs/NSA143856_sdss.query
Making query file catalogs/NSA143555_sdss.query
Data file for NSA142509 exists, not making query!
Making query file catalogs/NSA142335_sdss.query
Making query file catalogs/NSA141863_sdss.query
Making query file catalogs/NSA144521_sdss.query
Making query file catalogs/NSA144151_sdss.query
Making query file catalogs/NSA145879_sdss.query
Making query file catalogs/NSA145967_sdss.query
Data file for NSA146210 exists, not making query!
Data file for NSA147100 exists, not making query!
Data file for NSA145188 exists, not making query!
Making query file catalogs/NSA145314_sdss.query
Making query file catalogs/NSA145682_sdss.query
Making query file catalogs/NSA145729_sdss.query
Making query file catalogs/NSA147606_sdss.query
Making query file catalogs/NSA148188_sdss.query
Making query file catalogs/NSA154089_sdss.query
Making query file catalogs/NSA153017_sdss.query
Data file for NSA148472 exists, not making query!
Making query file catalogs/NSA148275_sdss.query
Making query file catalogs/NSA149781_sdss.query
Making query file catalogs/NSA148735_sdss.query
Making query file catalogs/NSA150340_sdss.query
Making query file catalogs/NSA150307_sdss.query
Making query file catalogs/NSA151137_sdss.query
Data file for NSA150440 exists, not making query!
Data file for NSA158901 exists, not making query!
Data file for NSA159593 exists, not making query!
Making query file catalogs/NSA157495_sdss.query
Making query file catalogs/NSA158541_sdss.query
Making query file catalogs/NSA156022_sdss.query
Making query file catalogs/NSA157374_sdss.query
Making query file catalogs/NSA155274_sdss.query
Making query file catalogs/NSA155420_sdss.query
Data file for NSA155005 exists, not making query!
Data file for NSA155204 exists, not making query!
Making query file catalogs/NSA61945_sdss.query
Making query file catalogs/NSA63326_sdss.query
Making query file catalogs/NSA13927_sdss.query
Making query file catalogs/NSA16559_sdss.query
Data file for NSA32 exists, not making query!
Making query file catalogs/NSA52773_sdss.query
Making query file catalogs/NSA53145_sdss.query
Making query file catalogs/NSA33446_sdss.query
Data file for NSA41075 exists, not making query!
Making query file catalogs/NSA160524_sdss.query
Making query file catalogs/NSA159804_sdss.query
Making query file catalogs/NSA159756_sdss.query
Making query file catalogs/NSA159747_sdss.query
Making query file catalogs/NSA162547_sdss.query
Making query file catalogs/NSA161987_sdss.query
Data file for NSA161726 exists, not making query!
Data file for NSA161509 exists, not making query!
Making query file catalogs/NSA169570_sdss.query
Making query file catalogs/NSA163136_sdss.query
Making query file catalogs/NSA162580_sdss.query
Data file for NSA166440 exists, not making query!
Making query file catalogs/NSA169911_sdss.query
Data file for NSA169846 exists, not making query!
Making query file catalogs/NSA126133_sdss.query
Making query file catalogs/NSA128381_sdss.query
Making query file catalogs/NSA69028_sdss.query
Making query file catalogs/NSA74567_sdss.query
Making query file catalogs/NSA82428_sdss.query
Making query file catalogs/NSA87606_sdss.query
Making query file catalogs/NSA90222_sdss.query
Making query file catalogs/NSA94217_sdss.query
Making query file catalogs/NSA99614_sdss.query
Making query file catalogs/NSA101649_sdss.query
Making query file catalogs/NSA163652_sdss.query
Making query file catalogs/NSA163956_sdss.query
Making query file catalogs/NSA164374_sdss.query
Data file for NSA165091 exists, not making query!
Making query file catalogs/NSA165153_sdss.query
Making query file catalogs/NSA165536_sdss.query
Making query file catalogs/NSA165832_sdss.query
Data file for NSA165952 exists, not making query!
Making query file catalogs/NSA165955_sdss.query
Data file for NSA166313 exists, not making query!
Making query file catalogs/NSA138217_sdss.query
Making query file catalogs/NSA135440_sdss.query
Making query file catalogs/NSA133953_sdss.query
Data file for NSA133355 exists, not making query!
Making query file catalogs/NSA134737_sdss.query
Data file for NSA134212 exists, not making query!
Data file for NSA129431 exists, not making query!
Data file for NSA129387 exists, not making query!
Making query file catalogs/NSA132339_sdss.query
Making query file catalogs/NSA129533_sdss.query
Making query file catalogs/NSA140004_sdss.query
Data file for NSA140259 exists, not making query!
Data file for NSA139467 exists, not making query!
Making query file catalogs/NSA139920_sdss.query
Data file for NSA140895 exists, not making query!
Making query file catalogs/NSA141465_sdss.query
Making query file catalogs/NSA140458_sdss.query
Making query file catalogs/NSA140827_sdss.query
Making query file catalogs/NSA141475_sdss.query
Data file for NSA141565 exists, not making query!

In [ ]: