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]:
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)
Use catalogs already-generated by marla for clean-up on Gilgamesh and new observations of NSA33446/85746
In [4]:
n33446 = hosts.NSAHost(33446)
n33446.sdss_environs_query(True)
n33446incat = ascii.read('catalogs/mmt2015a_nsa33446.dat', format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(n33446incat)
Out[4]:
In [5]:
gilg = hosts.gilgamesh
gilgincat = ascii.read('catalogs/mmt2015a_nsa166313.dat', format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(gilgincat)
Out[5]:
In [6]:
ody = hosts.odyssey
odyincat = ascii.read('catalogs/mmt2015a_nsa147100.dat', format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(odyincat)
Out[6]:
In [7]:
n85746 = hosts.NSAHost(85746)
n85746.environsarcmin = 50
n85746.sdss_environs_query(True)
n85746incat = ascii.read('catalogs/mmt2015a_nsa85746.dat', format='basic', names='ra,dec,objID,r,fibermag_r,rank'.split(','))
len(n85746incat)
Out[7]:
In [8]:
for nm in 'gilg,ody,n33446,n85746'.split(','):
print nm, SkyCoord(locals()[nm].coords).galactic
In [9]:
plt.hist(gilgincat['fibermag_r'],bins=100)
None
In [10]:
msk = gilgincat['fibermag_r'] < 20
targeting.sampled_imagelist(gilgincat['ra'][msk],gilgincat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in gilgincat[msk]])
Out[10]:
In [ ]:
msk = gilgincat['fibermag_r'] > 23
targeting.sampled_imagelist(gilgincat['ra'][msk],gilgincat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in gilgincat[msk]])
In [11]:
print np.sum((17<gilgincat['fibermag_r'])&(gilgincat['fibermag_r'] < 22.5)&(gilgincat['rank'] < 4))
print np.sum((17<gilgincat['fibermag_r'])&(gilgincat['fibermag_r'] < 23)&(gilgincat['rank'] < 4))
In [39]:
#note the rank+1 - that's because *flux* stars should be rank 1, but the catalog starts at rank=1
gilgrank = gilgincat['rank']+1
gilgrank[gilgincat['fibermag_r'] > 23] = 6
mskgilg = (17<gilgincat['fibermag_r'])
In [38]:
targeting.sampled_imagelist(gilgincat['ra'][mskgilg],gilgincat['dec'][mskgilg],
names=['rank={0}'.format(r) for r in gilgrank[mskgilg]])
Out[38]:
In [40]:
gilgoutcat = mmthecto.generate_catalog(gilg, gilgincat[mskgilg], gilgrank,
repeatflux=1, removefluxdistance=1*u.arcmin,
fnout='mmthecto/{0}_feb2015.cat'.format(gilg.name),
fluxfnout='mmthecto/{0}_feb2015.fluxstars'.format(gilg.name))
In [14]:
plt.hist(n33446incat['fibermag_r'],bins=100)
None
In [ ]:
msk = n33446incat['fibermag_r'] < 18
targeting.sampled_imagelist(n33446incat['ra'][msk],n33446incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n33446incat[msk]])
In [ ]:
msk = n33446incat['fibermag_r'] > 23
targeting.sampled_imagelist(n33446incat['ra'][msk],n33446incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n33446incat[msk]])
In [15]:
msk33446 = (17<n33446incat['fibermag_r'])&(n33446incat['fibermag_r'] < 23)
In [16]:
targeting.sampled_imagelist(n33446incat['ra'][msk33446],n33446incat['dec'][msk33446],
names=['rank={0}'.format(icat['rank']) for icat in n33446incat[msk33446]])
Out[16]:
In [17]:
#note the rank+1 - that's because *flux* stars should be rank 1, but the catalog starts at rank=1
n33446outcat = mmthecto.generate_catalog(n33446, n33446incat[msk33446], n33446incat['rank'][msk33446]+1,
repeatflux=2, removefluxdistance=1*u.arcmin,
fnout='mmthecto/{0}_feb2015.cat'.format(n33446.name),
fluxfnout='mmthecto/{0}_feb2015.fluxstars'.format(n33446.name))
In [15]:
plt.hist(odyincat['fibermag_r'],bins=100)
print np.sum(odyincat['fibermag_r'] < 22.5), np.sum(odyincat['fibermag_r'] < 23)
In [19]:
plt.hist(odyincat['rank'],bins=100)
None
In [ ]:
msk = odyincat['rank'] < 3
targeting.sampled_imagelist(odyincat['ra'][msk],odyincat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in odyincat[msk]])
In [30]:
#note the rank+1 - that's because *flux* stars should be rank 1, but the catalog starts at rank=1
odyrank = odyincat['rank']+1
odyrank[odyincat['fibermag_r'] > 23] = 6
mskody = (17<odyincat['fibermag_r'])
In [23]:
targeting.sampled_imagelist(odyincat['ra'][mskody],odyincat['dec'][mskody],
names=['rank={0}'.format(r) for r in odyrank[mskody]])
Out[23]:
In [31]:
odyoutcat = mmthecto.generate_catalog(ody, odyincat[mskody], odyrank[mskody],
repeatflux=2, removefluxdistance=1*u.arcmin,
fnout='mmthecto/{0}_feb2015.cat'.format(ody.name),
fluxfnout='mmthecto/{0}_feb2015.fluxstars'.format(ody.name))
In [22]:
n85746catsc = SkyCoord(n85746incat['ra']*u.deg, n85746incat['dec']*u.deg)
plt.hist(n85746.coords.separation(n85746catsc).arcmin, bins=100,histtype='step')
plt.xlabel('distance from host [arcmin]')
plt.figure()
plt.scatter((n85746catsc.ra - n85746.coords.ra).to(u.rad)*n85746.dist.to(u.kpc),
(n85746catsc.dec - n85746.coords.dec).to(u.rad)*n85746.dist.to(u.kpc),
c=n85746incat['rank'])
plt.colorbar()
plt.xlabel(r'$\Delta \alpha$ [kpc]')
plt.ylabel(r'$\Delta \delta$ [kpc]')
None
In [23]:
plt.hist(n85746incat['fibermag_r'],bins=100)
None
In [ ]:
msk = n85746incat['fibermag_r'] < 18
targeting.sampled_imagelist(n85746incat['ra'][msk],n85746incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n85746incat[msk]])
In [ ]:
msk = (22.5 < n85746incat['fibermag_r']) & (n85746incat['fibermag_r'] < 23)
targeting.sampled_imagelist(n85746incat['ra'][msk],n85746incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n85746incat[msk]])
None
In [ ]:
msk = n85746incat['fibermag_r'] > 23
targeting.sampled_imagelist(n85746incat['ra'][msk],n85746incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n85746incat[msk]])
None
In [ ]:
msk = n85746incat['fibermag_r'] < 23
targeting.sampled_imagelist(n85746incat['ra'][msk],n85746incat['dec'][msk],None,
names=['fm_r={0}-rank={1}'.format(icat['fibermag_r'],icat['rank']) for icat in n85746incat[msk]])
None
In [24]:
#for 85746 we're trying to focus on low-SB galaxies
#note that rank=1 is unpopulated because that gets flux stars
marlarank = n85746incat['rank'] #2/3 w/i Rvir, 4 beyond
fm_r = n85746incat['fibermag_r']
n85746ranks = np.zeros_like(marlarank)
n85746ranks[(22<=fm_r)&(fm_r <= 23)] = 2
n85746ranks[fm_r < 22] = 4
n85746ranks[fm_r > 23] = 7
n85746ranks[marlarank==3] += 1
n85746ranks[marlarank==4] = 6
cnts = np.bincount(n85746ranks)
plt.bar(np.arange(len(cnts))-.4, cnts, .8)
plt.xlim(-.1,8.9)
Out[24]:
In [25]:
msk = n85746ranks ==2
targeting.sampled_imagelist(n85746incat['ra'][msk],n85746incat['dec'][msk],
names=['rmag={0}_fm_r={1}'.format(cati['r'], cati['fibermag_r']) for cati in n85746incat[msk]])
Out[25]:
In [26]:
plt.scatter((n85746catsc.ra - n85746.coords.ra).to(u.rad)*n85746.dist.to(u.kpc),
(n85746catsc.dec - n85746.coords.dec).to(u.rad)*n85746.dist.to(u.kpc),
c=n85746ranks)
plt.colorbar()
plt.xlabel(r'$\Delta \alpha$ [kpc]')
plt.ylabel(r'$\Delta \delta$ [kpc]')
None
In [27]:
msk85746 = (17<n85746incat['fibermag_r'])&(n85746ranks < 6)
In [ ]:
targeting.sampled_imagelist(n85746incat['ra'][msk85746],n85746incat['dec'][msk85746],
names=['rank={0}'.format(r) for r in n85746ranks[msk85746]])
In [28]:
n85746outcat = mmthecto.generate_catalog(n85746, n85746incat[msk85746], n85746ranks[msk85746],
repeatflux=5, removefluxdistance=30*u.arcsec,
fnout='mmthecto/{0}_feb2015.cat'.format(n85746.name),
fluxfnout='mmthecto/{0}_feb2015.fluxstars'.format(n85746.name))
In [ ]: