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 [45]:
import hosts
import targeting
import mmthecto

from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table

In [3]:
%matplotlib inline
from matplotlib import pyplot as plt
from matplotlib import rcParams

rcParams['image.interpolation'] = 'none'
rcParams['figure.figsize'] = (16, 10)

In [14]:
hostlst = hosts.get_saga_hosts_from_google(useobservingsummary=True)


Using cached version of google hosts list from file "hosts_dl.pkl"

In [17]:
st = [h for h in hostlst if h.name == 'StarTrek']
assert len(st)==1
st = st[0]

In [18]:
dune = [h for h in hostlst if h.name == 'Dune']
assert len(dune)==1
dune = dune[0]

In [19]:
md = [h for h in hostlst if h.name == 'MobyDick']
assert len(md)==1
md = md[0]

In [46]:
gilg = hosts.gilgamesh

Star Trek


In [22]:
stcat = ascii.read('catalogs/mmt2015a2_nsa{0}.dat'.format(st.nsaid), format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(stcat)


Out[22]:
477

In [29]:
plt.scatter(stcat['ra'],stcat['dec'], c=stcat['rank'])
plt.colorbar()
None



In [30]:
plt.hist(stcat['fibermag_r'],bins=100)
None



In [34]:
msk = stcat['fibermag_r'] < 20
targeting.sampled_imagelist(stcat['ra'][msk],stcat['dec'][msk],None,
                            names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in stcat[msk]])
None

In [36]:
msk = stcat['fibermag_r'] > 22
targeting.sampled_imagelist(stcat['ra'][msk],stcat['dec'][msk],None, 
                            names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in stcat[msk]])
None

Make Catalog


In [43]:
stoutcat = mmthecto.generate_catalog(st, stcat, stcat['rank'], 
                                       repeatflux=5, removefluxdistance=1*u.arcmin,
                                       fnout='mmthecto/{0}_mar2015.cat'.format(st.name),
                                       fluxfnout='mmthecto/{0}_mar2015.fluxstars'.format(st.name))


Including 477 targets
Found 145 Flux stars
Removing 6 Flux stars too close to program stars
Found 1241 guide stars

Moby Dick


In [23]:
mdcat = ascii.read('catalogs/mmt2015a2_nsa{0}.dat'.format(md.nsaid), format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(mdcat)


Out[23]:
2190

In [32]:
plt.scatter(mdcat['ra'],mdcat['dec'], c=mdcat['rank'])
plt.colorbar()
None


Make Catalog


In [42]:
stoutcat = mmthecto.generate_catalog(md, mdcat, mdcat['rank'], 
                                       repeatflux=5, removefluxdistance=1*u.arcmin,
                                       fnout='mmthecto/{0}_mar2015.cat'.format(md.name),
                                       fluxfnout='mmthecto/{0}_mar2015.fluxstars'.format(md.name))


Including 2190 targets
Found 33 Flux stars
Removing 16 Flux stars too close to program stars
Found 186 guide stars

Dune


In [24]:
dunecat = ascii.read('catalogs/mmt2015a2_nsa{0}.dat'.format(dune.nsaid), format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(dunecat)


Out[24]:
1912

In [31]:
plt.scatter(dunecat['ra'], dunecat['dec'], c=dunecat['rank'])
plt.colorbar()
None


Make Catalog


In [41]:
stoutcat = mmthecto.generate_catalog(dune, dunecat, dunecat['rank'], 
                                       repeatflux=5, removefluxdistance=1*u.arcmin,
                                       fnout='mmthecto/{0}_mar2015.cat'.format(dune.name),
                                       fluxfnout='mmthecto/{0}_mar2015.fluxstars'.format(dune.name))


Including 1912 targets
Found 444 Flux stars
Removing 55 Flux stars too close to program stars
Found 933 guide stars

Gilgamesh 2


In [48]:
gilgcat = ascii.read('catalogs/mmt2015a2_nsa{0}.dat'.format(gilg.nsaid), format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(gilgcat)


Out[48]:
427

In [49]:
plt.scatter(gilgcat['ra'], gilgcat['dec'], c=gilgcat['rank'])
plt.colorbar()
None



In [50]:
goutcat = mmthecto.generate_catalog(gilg, gilgcat, gilgcat['rank'], 
                                       repeatflux=1, removefluxdistance=1*u.arcmin,
                                       fnout='mmthecto/{0}_mar2015.cat'.format(gilg.name),
                                       fluxfnout='mmthecto/{0}_mar2015.fluxstars'.format(gilg.name))


Including 427 targets
Found 220 Flux stars
Removing 25 Flux stars too close to program stars
Found 403 guide stars

In [ ]: