In [2]:
%matplotlib inline
import om10
import numpy as np
import matplotlib.pyplot as plt


/Users/mbaumer/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:1155: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

In [4]:
db = om10.DB(catalog="/Users/mbaumer/pybin/OM10/data/qso_mock.fits")

id = 7176527
lens = db.get_lens(id)

In [24]:
print lens.names
print lens.item


['LENSID', 'FLAGTYPE', 'NIMG', 'ZLENS', 'VELDISP', 'ELLIP', 'PHIE', 'GAMMA', 'PHIG', 'ZSRC', 'XSRC', 'YSRC', 'MAGI_IN', 'MAGI', 'IMSEP', 'XIMG', 'YIMG', 'MAG', 'DELAY', 'KAPPA', 'FSTAR', 'DD', 'DDLUM', 'ABMAG_I', 'APMAG_I', 'KCORR', 'DS', 'DDS', 'SIGCRIT', 'DSLUM', 'L_I', 'REFF', 'REFF_T']
<built-in method item of FITS_rec object at 0x102f4e140>

In [6]:
db.select_random(maglim=22.1,area=30000.0,IQ=1.0)
db.write_table("OM10_PS1_mock_lensed_quasars.fits")
pars = ['ZLENS','ZSRC','APMAG_I','MAGI','IMSEP']
db.export_to_cpt(pars,"OM10_PS1_mock_lensed_quasars.cpt")


om10.DB: selection yields  1802  lenses
om10.DB: wrote catalog of  1802  OM10 lenses to file at OM10_PS1_mock_lensed_quasars.fits
om10.DB: wrote a  5 -column plain text file of  1802  OM10 lenses to file at OM10_PS1_mock_lensed_quasars.cpt

In [5]:
from numpy import rec
_ = plt.hist(db.lenses['MAGI'],bins=30)
print np.max(db.lenses['MAGI'])


23.29999

In [59]:
print type(db.lenses)
15658/995


<class 'pyfits.fitsrec.FITS_rec'>
Out[59]:
15

In [17]:
om10.plot_lens(lens)


om10.plot_lens: plotting image configuration of lens ID  7176527
om10.plot_lens: lens, image magnitudes: 20.9278469 [ 18.9618029   20.73899919]
om10.plot_lens: figure saved to file: om10_qso_ID=7176527.png