In [1]:
%matplotlib inline
from __future__ import division
import om10,os
import numpy as np
import matplotlib.pyplot as plt
import triangle
In [2]:
db = om10.DB(catalog='$OM10_DIR/data/qso_mock.fits')
print db.lenses
In [16]:
db.get_sky_positions(input_cat='$OM10_DIR/data/CFHTLS_LRGs.txt')
db.assign_sky_positions()
In [17]:
print db.lenses
~1/3 of the objects have an RA,DEC of (-99,-99). This is because there were no galaxies found in the reference sample with matching magnitudes/redshifts...
In [18]:
print len(db.lenses[db.lenses['RA']> 0]), len(db.lenses)
In [3]:
db.paint(lrg_input_cat='$OM10_DIR/data/LRGo.txt',qso_input_cat='$OM10_DIR/data/QSOo.txt')
In [5]:
print db.lenses['MAGG_SRC','MAGR_SRC','MAGI_SRC','MAGZ_SRC', \
'MAGW1_SRC','MAGW2_SRC','MAGW3_SRC','MAGW4_SRC', 'SDSS_FLAG_SRC']
In [21]:
from scipy.stats import itemfreq
itemfreq(db.lenses['SDSS_FLAG_SRC'])
Out[21]:
With 2-param matching, we had 1941 matched and 13717 unmatched. Matching in z alone, we have 15557 matched and 101 unmatched!
In [6]:
#write out cat
db.lenses.write('my_redshift_matching.fits',format='fits')
In [20]:
#pre-load painted, positioned catalog for this NB
db = om10.DB(catalog='$OM10_DIR/notebooks/painted_positioned_catalog.fits')
In [9]:
db.select_random(maglim=21.4,area=30000.0,IQ=1.0)
In [10]:
out_cat = db.make_sim_input_catalog()
In [27]:
print out_cat.colnames
In [29]:
out_cat
Out[29]:
In [14]:
positioned_cat = out_cat[out_cat['RA']>0] #let's only take galaxies that were matched to a location
In [27]:
positioned_cat.write('sim_input_sample_cat.fits',format='fits')
In [13]:
for var in ['G','R','I','Z']:
plt.figure()
plt.hist(positioned_cat[var][positioned_cat['XIMG'] == 0],bins=20,histtype='step',color='Orange',label='Lenses')
plt.hist(positioned_cat[var][positioned_cat['XIMG'] != 0],bins=20,histtype='step',color='Cyan',label='Sources')
plt.legend()
plt.xlabel(var)
In [25]:
plt.scatter(positioned_cat['RA'],positioned_cat['DEC'],color='Orange')
plt.title('Assigned Locations of Simulated Lenses in CFHT footprint (?)')
plt.xlabel('RA')
plt.ylabel('DEC')
Out[25]:
In [40]:
plt.hist(db.lenses['APMAG_I'])
Out[40]:
In [47]:
plt.scatter(db.lenses['ZLENS'],db.lenses['VELDISP'])
plt.xlabel('z')
plt.ylabel('Sigma')
Out[47]:
In [10]:
from astropy.table import Table
sloan = Table.read('../data/LRGo.txt',format='ascii')
print sloan
In [11]:
plt.scatter(db.sample['ZLENS'],db.sample['VELDISP'],color='Orange')
plt.scatter(sloan['col1'],sloan['col2'],color='Blue')
plt.xlabel('z')
plt.ylabel('Sigma')
Out[11]:
In [ ]: