In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
from sqlalchemy import create_engine

import numpy as np
import pandas as pd
import seaborn as sb
import os
import healpy as hp

In [2]:
import lsst.sims.maf.db as db

In [3]:
from sqlalchemy import create_engine

In [337]:
engine = create_engine('sqlite:////Users/rbiswas/data/LSST/OpSimData/enigma_1189_sqlite.db')

In [338]:
Proposal = pd.read_sql_table('Proposal', engine)

In [339]:
Proposal


Out[339]:
propID propConf propName objectID objectHost Session_sessionID
0 362 ../conf/survey/GalacticPlaneProp.conf WL 27692624 enigma 1189
1 363 ../conf/survey/SouthCelestialPole-18.conf WL 27692368 enigma 1189
2 364 ../conf/survey/Universal-18-0824B.conf WLTSS 27692112 enigma 1189
3 365 ../conf/survey/NorthEclipticSpur-18c.conf WLTSS 27692240 enigma 1189
4 366 ../conf/survey/DDcosmology1.conf WLTSS 29065424 enigma 1189

In [324]:
opsdb = db.OpsimDatabase('sqlite:////Users/rbiswas/data/LSST/OpSimData/enigma_1189_sqlite.db')

In [325]:
propID, propTags = opsdb.fetchPropInfo()

In [328]:
propID


Out[328]:
{362: 'GalacticPlane',
 363: 'SouthCelestialPole-18',
 364: 'Universal-18-0824B',
 365: 'NorthEclipticSpur-18c',
 366: 'DDcosmology1'}

In [4]:
Summary = pd.read_hdf('storage.h5', 'table')

In [5]:
Summary.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 2469307 entries, 0 to 2473104
Data columns (total 48 columns):
obsHistID            int64
sessionID            int64
propID               int64
fieldID              int64
fieldRA              float64
fieldDec             float64
filter               object
expDate              int64
expMJD               float64
night                int64
visitTime            float64
visitExpTime         float64
finRank              float64
finSeeing            float64
transparency         float64
airmass              float64
vSkyBright           float64
filtSkyBrightness    float64
rotSkyPos            float64
lst                  float64
altitude             float64
azimuth              float64
dist2Moon            float64
solarElong           float64
moonRA               float64
moonDec              float64
moonAlt              float64
moonAZ               float64
moonPhase            float64
sunAlt               float64
sunAz                float64
phaseAngle           float64
rScatter             float64
mieScatter           float64
moonIllum            float64
moonBright           float64
darkBright           float64
rawSeeing            float64
wind                 float64
humidity             float64
slewDist             float64
slewTime             float64
fiveSigmaDepth       float64
ditheredRA           float64
ditheredDec          float64
gamma                float64
N0sq                 float64
alpha                float64
dtypes: float64(41), int64(6), object(1)
memory usage: 923.1+ MB

In [8]:
s = Summary[Summary['airmass'] <1.2]

In [ ]:


In [ ]:
plt.plot(Summary['expDate'], Summary['expMJD'])

In [331]:
fulltablesize = Summary.size

In [332]:
dd = Summary[Summary['propID']==366]
ddsize = dd.size
wfd = Summary[Summary['propID']==364]
wfdsize = wfd.size

In [335]:
from __future__ import division
ddsize/ fulltablesize , wfdsize / fulltablesize


Out[335]:
(0.043054994781936792, 0.85444985171953103)

In [344]:
fseason = Summary[(Summary['night'] < 366) & (Summary['propID']==364)]

In [345]:
testdf = fseason.copy(deep=True)

In [346]:
add_simlibCols(testdf)


Out[346]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha simLibPsf simLibZPTAVG simLibSkySig
0 1 1189 364 316 1.676483 -1.082473 y 2771 49353.032079 0 ... 0.000000 21.084291 1.643930 -1.108924 0.039924 0.000002 0.039924 2.030579 29.468989 9.505382
1 2 1189 364 372 1.694120 -1.033972 y 2810 49353.032525 0 ... 4.542362 21.088257 1.664257 -1.060423 0.039924 0.000002 0.039924 2.024145 29.470062 9.492727
2 3 1189 364 441 1.708513 -0.985271 y 2848 49353.032971 0 ... 4.561422 21.091100 1.680878 -1.011722 0.039924 0.000002 0.039924 2.019543 29.470829 9.483654
3 4 1189 364 505 1.720374 -0.936476 y 2887 49353.033417 0 ... 4.570186 21.092714 1.694604 -0.962927 0.039924 0.000002 0.039924 2.016934 29.471263 9.478505
4 5 1189 364 587 1.730248 -0.887672 y 2925 49353.033864 0 ... 4.568530 21.093091 1.706054 -0.914123 0.039924 0.000002 0.039924 2.016326 29.471365 9.477304
5 6 1189 364 680 1.738574 -0.838921 y 2964 49353.034310 0 ... 4.557107 21.092206 1.715721 -0.865372 0.039924 0.000002 0.039924 2.017755 29.471127 9.480128
6 7 1189 364 770 1.745690 -0.790249 y 3002 49353.034756 0 ... 4.537420 21.090028 1.723987 -0.816700 0.039924 0.000002 0.039924 2.021277 29.470539 9.487074
7 8 1189 364 824 1.683281 -0.756888 y 3041 49353.035204 0 ... 4.698822 21.122055 1.662273 -0.783339 0.039921 0.000002 0.039921 1.969968 29.479028 9.384791
8 9 1189 364 903 1.626792 -0.719569 y 3080 49353.035651 0 ... 4.645948 21.149382 1.606486 -0.746020 0.039919 0.000002 0.039919 1.927011 29.486042 9.297411
9 10 1189 364 991 1.576668 -0.678745 y 3118 49353.036098 0 ... 4.569719 21.172186 1.557047 -0.705196 0.039918 0.000002 0.039918 1.891743 29.491742 9.224463
10 11 1189 364 1080 1.532509 -0.635345 y 3157 49353.036546 0 ... 4.727198 21.061110 1.513534 -0.661796 0.039926 0.000002 0.039926 2.099774 29.494854 9.722521
11 12 1189 364 1096 1.592252 -0.627740 y 3196 49353.036995 0 ... 4.784620 21.035759 1.573383 -0.654191 0.039927 0.000002 0.039927 2.143600 29.488803 9.809319
12 13 1189 364 1007 1.639057 -0.669491 y 3234 49353.037441 0 ... 4.578310 21.016925 1.619581 -0.695942 0.039929 0.000002 0.039929 2.176636 29.484197 9.873804
13 14 1189 364 919 1.692362 -0.707741 y 3273 49353.037888 0 ... 4.592578 20.993467 1.672263 -0.734192 0.039930 0.000003 0.039930 2.218353 29.478325 9.954090
14 15 1189 364 1021 1.700932 -0.658150 y 3312 49353.038335 0 ... 4.660217 20.987662 1.681628 -0.684601 0.039931 0.000003 0.039931 2.228774 29.476848 9.973950
15 16 1189 364 1110 1.651280 -0.618574 y 3350 49353.038781 0 ... 4.513712 21.011994 1.632535 -0.645025 0.039929 0.000003 0.039929 2.185353 29.482976 9.890686
16 17 1189 364 1212 1.608166 -0.575819 y 3389 49353.039229 0 ... 4.709752 21.031212 1.589958 -0.602270 0.039928 0.000002 0.039928 2.151538 29.487700 9.824888
17 18 1189 364 1220 1.664386 -0.566519 y 3428 49353.039678 0 ... 4.776254 21.002983 1.646286 -0.592970 0.039930 0.000003 0.039930 2.201353 29.480725 9.921524
18 19 1189 364 1118 1.709686 -0.607725 y 3466 49353.040124 0 ... 4.571734 20.984401 1.691083 -0.634176 0.039931 0.000003 0.039931 2.234647 29.476015 9.985110
19 20 1189 364 1064 1.762505 -0.644202 y 3505 49353.040571 0 ... 4.551541 20.959738 1.743405 -0.670653 0.039932 0.000003 0.039932 2.279453 29.469615 10.069441
20 21 1189 364 1174 1.767750 -0.594793 y 3543 49353.041016 0 ... 4.491085 20.992113 1.749311 -0.621244 0.039930 0.000003 0.039930 2.210449 29.467958 9.912861
21 22 1189 364 1234 1.719772 -0.555894 y 3582 49353.041461 0 ... 4.441189 21.016848 1.701793 -0.582345 0.039929 0.000002 0.039929 2.166964 29.474473 9.830033
22 23 1189 364 1365 1.732854 -0.502282 y 3620 49353.041908 0 ... 4.614131 21.001634 1.715430 -0.528733 0.039930 0.000003 0.039930 2.193630 29.470487 9.880991
23 24 1189 364 1464 1.693895 -0.459746 y 3659 49353.042356 0 ... 4.663851 21.018791 1.676853 -0.486197 0.039929 0.000002 0.039929 2.163577 29.474977 9.823522
24 25 1189 364 1595 1.713484 -0.406673 y 3697 49353.042801 0 ... 4.480298 20.996397 1.696856 -0.433124 0.039930 0.000003 0.039930 2.202868 29.469099 9.898521
25 26 1189 364 1696 1.684343 -0.365069 y 3736 49353.043247 0 ... 4.532333 21.006013 1.667994 -0.391520 0.039929 0.000003 0.039929 2.185928 29.471640 9.866326
26 27 1189 364 1806 1.656778 -0.323526 y 3775 49353.043693 0 ... 4.554498 21.013472 1.640670 -0.349977 0.039929 0.000003 0.039929 2.172860 29.473595 9.841348
27 28 1189 364 1908 1.630085 -0.281906 y 3813 49353.044140 0 ... 4.585124 21.019154 1.614185 -0.308357 0.039929 0.000002 0.039929 2.162945 29.475072 9.822307
28 29 1189 364 2020 1.603920 -0.240147 y 3852 49353.044587 0 ... 4.614771 21.023209 1.588197 -0.266598 0.039928 0.000002 0.039928 2.155891 29.476121 9.808719
29 30 1189 364 2130 1.578071 -0.198239 y 3890 49353.045034 0 ... 4.638263 21.025694 1.562494 -0.224690 0.039928 0.000002 0.039928 2.151579 29.476762 9.800394
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
273309 272628 1189 364 2141 3.393799 -0.192613 z 31566393 49718.351774 365 ... 4.659556 22.085719 3.368515 -0.182694 0.039900 0.000002 0.039900 1.612321 30.966556 11.945308
273310 272629 1189 364 2155 3.338463 -0.187126 z 31566431 49718.352221 365 ... 4.650363 22.107685 3.313206 -0.177207 0.039898 0.000002 0.039898 1.583951 30.972056 11.855071
273311 272630 1189 364 2159 3.283007 -0.181197 z 31566470 49718.352668 365 ... 4.619784 22.126865 3.257778 -0.171278 0.039896 0.000001 0.039896 1.559509 30.976750 11.776251
273312 272631 1189 364 2173 3.226880 -0.176226 z 31566509 49718.353116 365 ... 4.689279 22.143958 3.201674 -0.166307 0.039895 0.000001 0.039895 1.537985 30.980853 11.706013
273313 272632 1189 364 2074 3.199068 -0.216692 z 31566547 49718.353564 365 ... 4.754171 22.162052 3.173658 -0.206773 0.039893 0.000001 0.039893 1.515464 30.985111 11.631661
273314 272633 1189 364 1983 3.170667 -0.257150 z 31566586 49718.354013 365 ... 4.751559 22.178030 3.145007 -0.247231 0.039891 0.000001 0.039891 1.495802 30.988802 11.566030
273315 272634 1189 364 1884 3.141593 -0.298112 z 31566625 49718.354461 365 ... 4.752787 22.192099 3.115632 -0.288193 0.039890 0.000001 0.039890 1.478664 30.991998 11.508265
273316 272635 1189 364 1768 3.111994 -0.340943 z 31566664 49718.354910 365 ... 4.759648 22.141126 3.085662 -0.331024 0.039895 0.000001 0.039895 1.551662 30.994295 11.794072
273317 272636 1189 364 1748 3.054146 -0.348822 z 31566703 49718.355359 365 ... 4.801861 22.152433 3.027740 -0.338903 0.039894 0.000001 0.039894 1.537268 30.996736 11.746017
273318 272637 1189 364 1871 3.083109 -0.301402 z 31566741 49718.355808 365 ... 4.821070 22.141915 3.057122 -0.291483 0.039895 0.000001 0.039895 1.550653 30.994466 11.790714
273319 272638 1189 364 2398 3.057617 -0.090907 z 31566791 49718.356389 365 ... 16.156443 22.100570 3.032698 -0.080988 0.039899 0.000002 0.039899 1.604209 30.985277 11.966615
273320 272639 1189 364 2524 3.085965 -0.046915 z 31566830 49718.356838 365 ... 4.850099 22.081945 3.061122 -0.036996 0.039900 0.000002 0.039900 1.628826 30.980995 12.045922
273321 272640 1189 364 2531 3.141593 -0.045990 z 31566870 49718.357293 365 ... 5.243459 22.069956 3.116751 -0.036071 0.039902 0.000002 0.039902 1.644836 30.978194 12.096999
273322 272641 1189 364 2523 3.197220 -0.046915 z 31566909 49718.357744 365 ... 5.039628 22.056586 3.172377 -0.036996 0.039903 0.000002 0.039903 1.662840 30.975024 12.153954
273323 272642 1189 364 2509 3.252637 -0.049506 z 31566947 49718.358194 365 ... 4.845097 22.041762 3.227791 -0.039587 0.039904 0.000002 0.039904 1.682989 30.971454 12.217105
273324 272643 1189 364 2505 3.307718 -0.053329 z 31566986 49718.358641 365 ... 4.653850 22.025308 3.282867 -0.043410 0.039905 0.000002 0.039905 1.705585 30.967422 12.287199
273325 272644 1189 364 2491 3.362444 -0.057902 z 31567025 49718.359087 365 ... 4.528220 22.006980 3.337586 -0.047983 0.039907 0.000002 0.039907 1.731040 30.962844 12.365249
273326 272645 1189 364 2481 3.416905 -0.062758 z 31567063 49718.359534 365 ... 4.555722 22.070718 3.392040 -0.052839 0.039901 0.000002 0.039901 1.628489 30.958174 11.981776
273327 272646 1189 364 2375 3.390920 -0.104445 z 31567102 49718.359982 365 ... 4.750810 22.098387 3.365968 -0.094526 0.039899 0.000002 0.039899 1.592677 30.965370 11.869342
273328 272647 1189 364 2377 3.336221 -0.099310 z 31567141 49718.360429 365 ... 4.564496 22.118599 3.311282 -0.089391 0.039897 0.000002 0.039897 1.566915 30.970492 11.787144
273329 272648 1189 364 2389 3.281128 -0.094595 z 31567179 49718.360876 365 ... 4.644305 22.136393 3.256201 -0.084676 0.039895 0.000001 0.039895 1.544513 30.974908 11.714749
273330 272649 1189 364 2279 3.254204 -0.135554 z 31567218 49718.361325 365 ... 4.771811 22.157478 3.229158 -0.125635 0.039893 0.000001 0.039893 1.518304 30.980033 11.628961
273331 272650 1189 364 2267 3.309764 -0.140422 z 31567257 49718.361774 365 ... 4.825217 22.143114 3.284701 -0.130503 0.039895 0.000001 0.039895 1.536119 30.976554 11.687404
273332 272651 1189 364 2263 3.364798 -0.145919 z 31567295 49718.362220 365 ... 4.578419 22.127066 3.339715 -0.136000 0.039896 0.000001 0.039896 1.556223 30.972605 11.752703
273333 272652 1189 364 2249 3.419720 -0.151046 z 31567334 49718.362667 365 ... 4.606788 22.108804 3.394618 -0.141127 0.039898 0.000002 0.039898 1.579357 30.968024 11.826984
273334 272653 1189 364 2237 3.474169 -0.156208 z 31567373 49718.363114 365 ... 4.624300 22.088479 3.449047 -0.146289 0.039900 0.000002 0.039900 1.605428 30.962818 11.909615
273335 272654 1189 364 2347 3.499825 -0.114112 z 31567411 49718.363562 365 ... 4.723369 22.063257 3.474847 -0.104193 0.039902 0.000002 0.039902 1.638255 30.956197 12.012073
273336 272655 1189 364 2229 3.528220 -0.161175 z 31567450 49718.364014 365 ... 5.024399 21.992385 3.503078 -0.151256 0.039908 0.000002 0.039908 1.749598 30.956754 12.413772
273337 272656 1189 364 2123 3.502578 -0.203741 z 31567489 49718.364462 365 ... 4.704423 22.019748 3.477238 -0.193822 0.039906 0.000002 0.039906 1.711457 30.963753 12.297903
273338 272657 1189 364 2127 3.448477 -0.198239 z 31567528 49718.364909 365 ... 4.646021 22.042882 3.423165 -0.188320 0.039904 0.000002 0.039904 1.679734 30.969510 12.199881

140146 rows × 51 columns


In [48]:
fieldsimlibs = testdf.groupby(by='fieldID')

In [258]:
def dec(fieldID):
    decvals = np.unique(fieldsimlibs.get_group(fieldID).fieldDec.values)
    if len(decvals)==1:
        return decvals[0]
    else:
        raise ValueError('The fieldDec of this group seems to not be unique\n')

In [319]:
class SummaryOpsim(object):
    
    import os, subprocess
    
    def __init__(self, summarydf, user=None, host=None, survey='LSST', telescope='LSST', pixSize=0.2):
        self.df = summarydf.copy(deep=True)
        self.fieldsimlibs = self.df.groupby(by='fieldID')
        self.fieldIds = self.fieldsimlibs.groups.keys()
        if user is None:
            user = os.getlogin()
        self.user = user
        if host is None:
            proc = subprocess.Popen('hostname', stdout=subprocess.PIPE)
            host, err = proc.communicate()
        self.host = host
        self.survey = survey
        self.host = host
        self.telescope = telescope
    def ra(self, fieldID):
        ravals = np.unique(self.fieldsimlibs.get_group(fieldID).fieldRA.values)
        if len(ravals)==1:
            return ravals[0]
        else:
            raise ValueError('The fieldDec of this group seems to not be unique\n')
        
    def dec(self, fieldID):
        decvals = np.unique(self.fieldsimlibs.get_group(fieldID).fieldDec.values)
        if len(decvals)==1:
            return decvals[0]
        else:
            raise ValueError('The fieldDec of this group seems to not be unique\n')
    def meta(self, fieldID):
        meta = {}
        meta['LIBID'] = fieldID
        meta['dec'] = self.dec(fieldID)
        return meta
    
    def fieldheader(self, fieldID):
        
        ra = self.ra(fieldID)
        dec = self.dec(fieldID)
        nobs = self.df.size
        s = '# --------------------------------------------' +'\n' 
        s += 'LIBID: {0:10d}'.format(fieldID) +'\n'
        s += 'RA: {0:+10.6f} DECL: {1:+10.6f}   NOBS: {2:10d} MWEBV: {3:5.2f}   PIXSIZE: {4:5.3f}'.format(ra, dec, nobs, 0.0, 0.2) + '\n'
        s += 'LIBID: {0:10d}'.format(fieldID) + '\n'
        s += '#                           CCD  CCD         PSF1 PSF2 PSF2/1' +'\n'
        s += '#     MJD      IDEXPT  FLT GAIN NOISE SKYSIG (pixels)  RATIO  ZPTAVG ZPTERR  MAG' + '\n'
        return s
    
    def fieldfooter(self, fieldID):
        
        s = 'END_LIBID: {0:10d}'.format(fieldID)
        s += '\n'
        return s
        
    def formatSimLibField(self, fieldID, sep=' '):
    
        opSimSummary = self.fieldsimlibs.get_group(fieldID)
        y =''
        for row in opSimSummary.iterrows():
            data = row[1] # skip the index
            #       MJD EXPID FILTER 
            lst = ['S:', "{0:5.3f}".format(data.expMJD), "{0:10d}".format(data.obsHistID), data['filter'], 
                   # CCD Gain CCD Noise 
                   "{0:5.2f}".format(1.),  "{0:5.2f}".format(0.25), 
                   # SKYSIG
                   "{0:6.2f}".format(data.simLibSkySig), 
                   # PSF1 PSF2 PSFRatio 
                   "{0:4.2f}".format(data.simLibPsf), "{0:4.2f}".format(0.), "{0:4.3f}".format(0.), 
                   # ZPTAVG MAG
                   "{0:6.2f}".format(data.simLibZPTAVG), "{0:6.3f}".format(0.005), "{0:+7.3f}".format(-99.) ]
            s = sep.join(lst)
            y += s + '\n'
        return y
    
    def writeSimLibField(self, fieldID):
        s = self.fieldheader(fieldID)
        s += self.formatSimLibField(fieldID, sep=' ')
        s += self.footer(fieldID)
        return s

    def simLibheader(self): #, user=None, host=None, survey='LSST', telescope='LSST'):
        s = 'SURVEY: {0:}    FILTERS: ugrizY  TELESCOPE: {1:}\n'.format(self.survey, self.telescope)
        s += 'USER: {0:}     HOST: {1:}'.format(self.user, self.host)
        s += 
        return s
    
    
    def writeSimlib(self, filename, comments=''):
        with open(filename, 'w') as fh:
            simlib_header = self.simLibheader()
            simlib_footer = self.simLibFooter()
            fh.write(simlib_header)
            fh.write(comments)
            fh.write('BEGIN LIBGEN\n')
            fh.write('\n')
            for fieldID in self.fieldIds:
                fh.write(self.fieldheader(fieldID))
                fh.write(self.formatSimLibField(fieldID))
                fh.write(self.fieldfooter(fieldID))
            fh.write(simlib_footer)

In [347]:
SO = SummaryOpsim(testdf)

In [348]:
SO.writeSimlib('fullsimlib.out')

In [359]:
Summary.replace({'filter': {'y','Y'}})


Out[359]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... wind humidity slewDist slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha
0 1 1189 364 316 1.676483 -1.082473 y 2771 49353.032079 0 ... 0 0 1.620307 0.000000 21.084291 1.643930 -1.108924 0.039924 0.000002 0.039924
1 2 1189 364 372 1.694120 -1.033972 y 2810 49353.032525 0 ... 0 0 0.049266 4.542362 21.088257 1.664257 -1.060423 0.039924 0.000002 0.039924
2 3 1189 364 441 1.708513 -0.985271 y 2848 49353.032971 0 ... 0 0 0.049298 4.561422 21.091100 1.680878 -1.011722 0.039924 0.000002 0.039924
3 4 1189 364 505 1.720374 -0.936476 y 2887 49353.033417 0 ... 0 0 0.049266 4.570186 21.092714 1.694604 -0.962927 0.039924 0.000002 0.039924
4 5 1189 364 587 1.730248 -0.887672 y 2925 49353.033864 0 ... 0 0 0.049177 4.568530 21.093091 1.706054 -0.914123 0.039924 0.000002 0.039924
5 6 1189 364 680 1.738574 -0.838921 y 2964 49353.034310 0 ... 0 0 0.049050 4.557107 21.092206 1.715721 -0.865372 0.039924 0.000002 0.039924
6 7 1189 364 770 1.745690 -0.790249 y 3002 49353.034756 0 ... 0 0 0.048916 4.537420 21.090028 1.723987 -0.816700 0.039924 0.000002 0.039924
7 8 1189 364 824 1.683281 -0.756888 y 3041 49353.035204 0 ... 0 0 0.055729 4.698822 21.122055 1.662273 -0.783339 0.039921 0.000002 0.039921
8 9 1189 364 903 1.626792 -0.719569 y 3080 49353.035651 0 ... 0 0 0.056015 4.645948 21.149382 1.606486 -0.746020 0.039919 0.000002 0.039919
9 10 1189 364 991 1.576668 -0.678745 y 3118 49353.036098 0 ... 0 0 0.056014 4.569719 21.172186 1.557047 -0.705196 0.039918 0.000002 0.039918
10 11 1189 364 1080 1.532509 -0.635345 y 3157 49353.036546 0 ... 0 0 0.055726 4.727198 21.061110 1.513534 -0.661796 0.039926 0.000002 0.039926
11 12 1189 364 1096 1.592252 -0.627740 y 3196 49353.036995 0 ... 0 0 0.048813 4.784620 21.035759 1.573383 -0.654191 0.039927 0.000002 0.039927
12 13 1189 364 1007 1.639057 -0.669491 y 3234 49353.037441 0 ... 0 0 0.055981 4.578310 21.016925 1.619581 -0.695942 0.039929 0.000002 0.039929
13 14 1189 364 919 1.692362 -0.707741 y 3273 49353.037888 0 ... 0 0 0.056182 4.592578 20.993467 1.672263 -0.734192 0.039930 0.000003 0.039930
14 15 1189 364 1021 1.700932 -0.658150 y 3312 49353.038335 0 ... 0 0 0.050035 4.660217 20.987662 1.681628 -0.684601 0.039931 0.000003 0.039931
15 16 1189 364 1110 1.651280 -0.618574 y 3350 49353.038781 0 ... 0 0 0.056173 4.513712 21.011994 1.632535 -0.645025 0.039929 0.000003 0.039929
16 17 1189 364 1212 1.608166 -0.575819 y 3389 49353.039229 0 ... 0 0 0.055665 4.709752 21.031212 1.589958 -0.602270 0.039928 0.000002 0.039928
17 18 1189 364 1220 1.664386 -0.566519 y 3428 49353.039678 0 ... 0 0 0.048200 4.776254 21.002983 1.646286 -0.592970 0.039930 0.000003 0.039930
18 19 1189 364 1118 1.709686 -0.607725 y 3466 49353.040124 0 ... 0 0 0.055856 4.571734 20.984401 1.691083 -0.634176 0.039931 0.000003 0.039931
19 20 1189 364 1064 1.762505 -0.644202 y 3505 49353.040571 0 ... 0 0 0.056231 4.551541 20.959738 1.743405 -0.670653 0.039932 0.000003 0.039932
20 21 1189 364 1174 1.767750 -0.594793 y 3543 49353.041016 0 ... 0 0 0.049593 4.491085 20.992113 1.749311 -0.621244 0.039930 0.000003 0.039930
21 22 1189 364 1234 1.719772 -0.555894 y 3582 49353.041461 0 ... 0 0 0.055976 4.441189 21.016848 1.701793 -0.582345 0.039929 0.000002 0.039929
22 23 1189 364 1365 1.732854 -0.502282 y 3620 49353.041908 0 ... 0 0 0.054789 4.614131 21.001634 1.715430 -0.528733 0.039930 0.000003 0.039930
23 24 1189 364 1464 1.693895 -0.459746 y 3659 49353.042356 0 ... 0 0 0.054789 4.663851 21.018791 1.676853 -0.486197 0.039929 0.000002 0.039929
24 25 1189 364 1595 1.713484 -0.406673 y 3697 49353.042801 0 ... 0 0 0.055970 4.480298 20.996397 1.696856 -0.433124 0.039930 0.000003 0.039930
25 26 1189 364 1696 1.684343 -0.365069 y 3736 49353.043247 0 ... 0 0 0.049596 4.532333 21.006013 1.667994 -0.391520 0.039929 0.000003 0.039929
26 27 1189 364 1806 1.656778 -0.323526 y 3775 49353.043693 0 ... 0 0 0.048978 4.554498 21.013472 1.640670 -0.349977 0.039929 0.000003 0.039929
27 28 1189 364 1908 1.630085 -0.281906 y 3813 49353.044140 0 ... 0 0 0.048799 4.585124 21.019154 1.614185 -0.308357 0.039929 0.000002 0.039929
28 29 1189 364 2020 1.603920 -0.240147 y 3852 49353.044587 0 ... 0 0 0.048813 4.614771 21.023209 1.588197 -0.266598 0.039928 0.000002 0.039928
29 30 1189 364 2130 1.578071 -0.198239 y 3890 49353.045034 0 ... 0 0 0.048915 4.638263 21.025694 1.562494 -0.224690 0.039928 0.000002 0.039928
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2473075 2469278 1189 364 1887 3.504231 -0.295396 z 315303863 53002.350273 3649 ... 0 0 0.055752 4.989087 22.172978 3.490263 -0.278864 0.039892 0.000001 0.039892
2473076 2469279 1189 364 1783 3.477274 -0.338835 z 315303902 53002.350720 3649 ... 0 0 0.050429 4.641726 22.199048 3.463105 -0.322303 0.039889 0.000001 0.039889
2473077 2469280 1189 364 1662 3.449038 -0.382409 z 315303940 53002.351167 3649 ... 0 0 0.050958 4.632926 22.222381 3.434635 -0.365877 0.039887 0.000001 0.039887
2473078 2469281 1189 364 1557 3.418736 -0.426138 z 315303979 53002.351614 3649 ... 0 0 0.051846 4.630774 22.243448 3.404061 -0.409606 0.039884 0.000001 0.039884
2473079 2469282 1189 364 1448 3.385224 -0.469907 z 315304018 53002.352061 3649 ... 0 0 0.053176 4.638925 22.262674 3.370237 -0.453375 0.039882 0.000001 0.039882
2473080 2469283 1189 364 1340 3.347241 -0.513259 z 315304056 53002.352509 3649 ... 0 0 0.054773 4.655264 22.280333 3.331901 -0.496727 0.039880 0.000001 0.039880
2473081 2469284 1189 364 1366 3.293695 -0.502282 z 315304095 53002.352957 3649 ... 0 0 0.048060 4.699621 22.296960 3.278449 -0.485750 0.039879 0.000001 0.039879
2473082 2469285 1189 364 1402 3.240667 -0.490072 z 315304134 53002.353404 3649 ... 0 0 0.048199 4.689257 22.311601 3.225521 -0.473540 0.039877 0.000001 0.039877
2473083 2469286 1189 364 1436 3.187011 -0.476348 z 315304172 53002.353852 3649 ... 0 0 0.049464 4.693792 22.324644 3.171974 -0.459816 0.039875 0.000001 0.039875
2473084 2469287 1189 364 1535 3.228194 -0.436660 z 315304211 53002.354300 3649 ... 0 0 0.054238 4.730125 22.312496 3.213447 -0.420128 0.039877 0.000001 0.039877
2473085 2469288 1189 364 1626 3.258522 -0.396489 z 315304250 53002.354747 3649 ... 0 0 0.048816 4.599973 22.301063 3.244035 -0.379957 0.039878 0.000001 0.039878
2473086 2469289 1189 364 1723 3.286881 -0.356251 z 315304288 53002.355194 3649 ... 0 0 0.048101 4.609745 22.288343 3.272623 -0.339719 0.039880 0.000001 0.039880
2473087 2469290 1189 364 1809 3.314354 -0.315768 z 315304327 53002.355641 3649 ... 0 0 0.048077 4.632444 22.273960 3.300296 -0.299236 0.039881 0.000001 0.039881
2473088 2469291 1189 364 1797 3.369771 -0.323527 z 315304366 53002.356089 3649 ... 0 0 0.053192 4.696787 22.256773 3.355677 -0.306995 0.039883 0.000001 0.039883
2473089 2469292 1189 364 1689 3.342205 -0.365070 z 315304404 53002.356536 3649 ... 0 0 0.048984 4.629100 22.274501 3.327899 -0.348538 0.039881 0.000001 0.039881
2473090 2469293 1189 364 1598 3.313064 -0.406673 z 315304443 53002.356983 3649 ... 0 0 0.049587 4.618919 22.290320 3.298514 -0.390141 0.039879 0.000001 0.039879
2473091 2469294 1189 364 1913 3.396464 -0.281906 z 315304484 53002.357464 3649 ... 0 0 0.147367 7.565652 22.241357 3.382552 -0.265374 0.039885 0.000001 0.039885
2473092 2469295 1189 364 2025 3.422629 -0.240146 z 315304523 53002.357912 3649 ... 0 0 0.048812 4.663733 22.221812 3.408871 -0.223614 0.039887 0.000001 0.039887
2473093 2469296 1189 364 2127 3.448477 -0.198239 z 315304562 53002.358359 3649 ... 0 0 0.048915 4.680633 22.199786 3.434847 -0.181707 0.039889 0.000001 0.039889
2473094 2469297 1189 364 2141 3.393799 -0.192613 z 315304600 53002.358807 3649 ... 0 0 0.053934 4.662374 22.223760 3.380184 -0.176081 0.039887 0.000001 0.039887
2473095 2469298 1189 364 2249 3.419720 -0.151046 z 315304639 53002.359255 3649 ... 0 0 0.048793 4.706912 22.201126 3.406203 -0.134514 0.039889 0.000001 0.039889
2473096 2469299 1189 364 2375 3.390920 -0.104445 z 315304678 53002.359707 3649 ... 0 0 0.054666 5.063801 22.199679 3.377484 -0.087913 0.039889 0.000001 0.039889
2473097 2469300 1189 364 2377 3.336221 -0.099310 z 315304717 53002.360154 3649 ... 0 0 0.054657 4.594555 22.221866 3.322792 -0.082778 0.039887 0.000001 0.039887
2473098 2469301 1189 364 2389 3.281128 -0.094595 z 315304755 53002.360600 3649 ... 0 0 0.055026 4.572184 22.241492 3.267705 -0.078063 0.039885 0.000001 0.039885
2473099 2469302 1189 364 2397 3.225569 -0.090907 z 315304794 53002.361047 3649 ... 0 0 0.055455 4.626824 22.258951 3.212151 -0.074375 0.039883 0.000001 0.039883
2473100 2469303 1189 364 2509 3.252637 -0.049506 z 315304833 53002.361496 3649 ... 0 0 0.049428 4.784419 22.237795 3.239258 -0.032974 0.039885 0.000001 0.039885
2473101 2469304 1189 364 2505 3.307718 -0.053329 z 315304871 53002.361942 3649 ... 0 0 0.055142 4.528941 22.220991 3.294336 -0.036797 0.039887 0.000001 0.039887
2473102 2469305 1189 364 2491 3.362444 -0.057902 z 315304910 53002.362388 3649 ... 0 0 0.054840 4.550365 22.202301 3.349059 -0.041370 0.039889 0.000001 0.039889
2473103 2469306 1189 364 2481 3.416905 -0.062758 z 315304948 53002.362835 3649 ... 0 0 0.054572 4.574172 22.181407 3.403516 -0.046226 0.039891 0.000001 0.039891
2473104 2469307 1189 364 2473 3.471306 -0.067435 z 315304987 53002.363282 3649 ... 0 0 0.054488 4.602535 22.157834 3.457913 -0.050903 0.039893 0.000001 0.039893

2469307 rows × 48 columns


In [302]:
ss = SO.simLibheader()

In [135]:
xx = df[['expMJD', 'obsHistID','filter' ,'simLibSkySig', 'simLibPsf', 'simLibZPTAVG']].head()

In [136]:
xx


Out[136]:
expMJD obsHistID filter simLibSkySig simLibPsf simLibZPTAVG
323 49353.175972 324 y 9.784275 2.545872 29.404178
355 49353.190099 356 y 9.408418 2.352009 29.405112
384 49353.202902 385 y 8.732167 2.022323 29.407110
431 49353.223651 432 y 9.167321 2.231651 29.405772
454 49353.233813 455 y 8.182176 1.772317 29.409117

In [107]:
xx.to_string(header=False, index=False, float_format="{0:.4f}".format())


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-107-7ecfb9264f95> in <module>()
----> 1 xx.to_string(header=False, index=False, float_format="{0:.4f}".format())

IndexError: tuple index out of range

In [160]:
xx['filter'] = xx['filter'].astype(str)

In [172]:
y = np.asarray(xx['filter'],dtype='S1')

In [173]:



Out[173]:
array(['y', 'y', 'y', 'y', 'y'], 
      dtype='|S1')

In [250]:
def formatSimLibField(opSimSummary, sep=' '):
    y =''
    for row in opSimSummary.iterrows():
        data = row[1] # skip the index
        #       MJD EXPID FILTER 
        lst = ['S:', "{0:5.3f}".format(data.expMJD), "{0:10d}".format(data.obsHistID), data['filter'], 
               # CCD Gain CCD Noise 
               "{0:5.2f}".format(1.),  "{0:5.2f}".format(0.25), 
               # SKYSIG
               "{0:6.2f}".format(data.simLibSkySig), 
               # PSF1 PSF2 PSFRatio 
               "{0:4.2f}".format(data.simLibPsf), "{0:4.2f}".format(0.), "{0:4.3f}".format(0.), 
               # ZPTAVG MAG
               "{0:6.2f}".format(data.simLibZPTAVG), "{0:6.3f}".format(0.005), "{0:+7.3f}".format(-99.) ]
        s = sep.join(lst)
        y += s + '\n'
    return y

In [303]:
f = open('test.simlib', 'w')
f.write(ss)
f.close()

In [244]:
"{0:>6.3f}".format(1)


Out[244]:
' 1.000'

In [235]:
ss


Out[235]:
'1.0000'

In [210]:
li = [12,45,78,784,2,69,1254,4785,984]
print map('the number is {}'.format,li)


['the number is 12', 'the number is 45', 'the number is 78', 'the number is 784', 'the number is 2', 'the number is 69', 'the number is 1254', 'the number is 4785', 'the number is 984']

In [217]:
'{:0.2f}'.format(1.)


Out[217]:
'1.00'

In [182]:
lst = ['S:', '49353.176']
' '.join(lst)


Out[182]:
'S: 49353.176'

In [185]:
lst = ['S:', "{0:5.3f}".format(49353.176)]
' '.join(lst)


Out[185]:
'S: 49353.176'

In [68]:
Summary.ditheredRA.describe()


Out[68]:
count    2469307.000000
mean           2.958238
std            1.860743
min            0.000000
25%            1.340928
50%            2.734973
75%            4.543518
max            6.283000
Name: ditheredRA, dtype: float64

In [53]:
df = fieldsimlibs.get_group(fieldIds[0])

In [78]:
-6.1 % (2*np.pi)


Out[78]:
0.1831853071795866

In [79]:
plt.plot((Summary['ditheredRA'] - Summary['fieldRA']).values % (2. *np.pi), (Summary['ditheredDec'] - Summary['fieldDec']).values,'o')


Out[79]:
[<matplotlib.lines.Line2D at 0x159bd0f10>]

In [75]:
Summary[Summary['ditheredRA'] - Summary['fieldRA'] < -2.][['ditheredRA', 'fieldRA']]


Out[75]:
ditheredRA fieldRA
76784 0.046643 5.654874
76789 0.046643 5.654874
76813 0.046643 5.654874
76840 0.046643 5.654874
76851 0.046643 5.654874
76864 0.046643 5.654874
76869 0.046643 5.654874
76902 0.046643 5.654874
76932 0.046643 5.654874
90879 0.001645 5.654874
90991 0.001645 5.654874
91902 0.019277 6.058812
91903 0.091642 5.654874
92785 0.019277 6.058812
108896 0.046643 5.654874
108909 0.046643 5.654874
109187 0.002092 6.146796
109212 0.001750 6.185326
109213 0.001750 6.185326
109235 0.002092 6.146796
109245 0.001853 6.207012
109301 0.002235 6.221070
109308 0.004049 6.058812
109310 0.046643 5.654874
109320 0.002235 6.221070
109330 0.002092 6.146796
109332 0.001750 6.185326
109333 0.001750 6.185326
109337 0.004049 6.058812
109339 0.046643 5.654874
... ... ...
2423041 0.000186 6.255728
2423088 0.000186 6.255728
2423766 0.004443 6.244668
2423768 0.004930 6.249097
2423774 0.004727 6.254255
2423777 0.005007 6.252209
2423804 0.004443 6.244668
2423808 0.004930 6.249097
2423816 0.005007 6.252209
2423819 0.004727 6.254255
2423851 0.002221 6.256336
2423854 0.001506 6.255956
2423856 0.001009 6.255560
2423873 0.002221 6.256336
2423876 0.003868 6.256459
2423889 0.001506 6.255956
2423891 0.001009 6.255560
2423914 0.003868 6.256459
2423973 0.001009 6.255560
2424007 0.001009 6.255560
2436615 0.002483 6.254255
2436628 0.002313 6.255728
2436731 0.000459 6.238746
2437370 0.007307 6.244668
2437382 0.007531 6.249097
2437441 0.007406 6.252209
2437455 0.007406 6.252209
2437490 0.007406 6.252209
2437721 0.002918 6.255560
2437768 0.002918 6.255560

349 rows × 2 columns


In [40]:
def add_simlibCols(opsimtable, pixSize=0.2):
    
    opsim_seeing = opsimtable['finSeeing']
    opsim_maglim = opsimtable['fiveSigmaDepth']
    opsim_magsky = opsimtable['filtSkyBrightness']
    
    # area = (opsim_seeing, pixsize=0.2):

    opsimtable['simLibPsf'] = opsim_seeing /2.35 /pixSize
   
    area = (1.51 * opsim_seeing)**2.
    
    opsim_snr = 5.
    arg = area * opsim_snr * opsim_snr
    zpt_approx = 2.0 * opsim_maglim - opsim_magsky + 2.5 * np.log10(arg)
    # ARG again in David Cinabro's code
    val = -0.4 * (opsim_magsky - opsim_maglim)
    tmp = 10.0 ** val
    zpt_cor = 2.5 * np.log10(1.0 + 1.0 / (area * tmp))
    simlib_zptavg = zpt_approx + zpt_cor
    # ZERO PT CALCULATION 
    opsimtable['simLibZPTAVG'] = simlib_zptavg
    
    #SKYSIG Calculation
    npix_asec = 1./ pixSize**2.
    opsimtable['simLibSkySig'] = ((1.0/ npix_asec)*10.0 **(-0.4 * (opsim_maglim - simlib_zptavg)))**0.5
    return opsimtable

In [14]:
s = add_simlibCols(Summary)

In [19]:
groups = s.groupby(by='fieldID')

In [24]:
groups.get_group(1).night.max()


Out[24]:
238

In [30]:



---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-30-89d3914cd27f> in <module>()
----> 1 groups.groups[0]

KeyError: 0

In [ ]:
s.values

In [35]:
l = map(lambda x: len(np.unique(groups.get_group(x).fieldRA.values)), groups.groups.keys())

In [5]:
t = Summary.loc[Summary['obsHistID'].isin(range(5))]

In [36]:
type(l)


Out[36]:
list

In [39]:
np.unique(np.array(l))


Out[39]:
array([1])

In [6]:
t


Out[6]:
obsHistID sessionID propID fieldID fieldRA fieldDec filter expDate expMJD night ... wind humidity slewDist slewTime fiveSigmaDepth ditheredRA ditheredDec gamma N0sq alpha
0 1 1189 364 316 1.676483 -1.082473 y 2771 49353.032079 0 ... 0 0 1.620307 0.000000 21.084291 1.643930 -1.108924 0.039924 0.000002 0.039924
1 2 1189 364 372 1.694120 -1.033972 y 2810 49353.032525 0 ... 0 0 0.049266 4.542362 21.088257 1.664257 -1.060423 0.039924 0.000002 0.039924
2 3 1189 364 441 1.708513 -0.985271 y 2848 49353.032971 0 ... 0 0 0.049298 4.561422 21.091100 1.680878 -1.011722 0.039924 0.000002 0.039924
3 4 1189 364 505 1.720374 -0.936476 y 2887 49353.033417 0 ... 0 0 0.049266 4.570186 21.092714 1.694604 -0.962927 0.039924 0.000002 0.039924

4 rows × 48 columns


In [7]:
type(t)


Out[7]:
pandas.core.frame.DataFrame

In [10]:
y = add_simlibCols(t)


-c:9: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
-c:22: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
-c:26: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy

In [12]:
y[['simLibPsf', 'skysig', 'ZPTAVG']]


Out[12]:
simLibPsf skysig ZPTAVG
0 2.030579 90.352287 29.468989
1 2.024145 90.111861 29.470062
2 2.019543 89.939693 29.470829
3 2.016934 89.842056 29.471263

In [ ]:
Summary.loc[Summary[]]

In [75]:
fig, ax = plt.subplots(2,3)



In [ ]:


In [76]:
Summary.fiveSigmaDepth.hist(by=Summary['filter'], ax=ax, histtype='step', color='b', lw=2.0)


Out[76]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x157d84290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14f9b5990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14f9f97d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x159f07d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x159ed30d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14fa16b90>], dtype=object)

In [78]:
fig


Out[78]:

In [77]:
Summary.filtSkyBrightness.hist(by=Summary['filter'], ax=ax, color='r', lw=2.0, histtype='step')


Out[77]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x157d84290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14f9b5990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14f9f97d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x159f07d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x159ed30d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x14fa16b90>], dtype=object)

In [68]:
t = Summary.loc[Summary['night'].isin(range(365))].head(100)

In [74]:
np.unique(Summary.loc[Summary['night'].isin(range(365))]['filter'].values)


Out[74]:
array([u'g', u'i', u'r', u'u', u'y', u'z'], dtype=object)

In [65]:
t.plot('expMJD', 'filtSkyBrightness')


Out[65]:
<matplotlib.axes._subplots.AxesSubplot at 0x157c13110>

In [80]:



---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-80-6959d5d317f9> in <module>()
----> 1 Summary.fiveSigmaDepth.hist(by=Summary['filter'], histtype='step', color='b', lw=2.0, subplots=False)

/usr/local/manual/anaconda/lib/python2.7/site-packages/pandas/tools/plotting.pyc in hist_series(self, by, ax, grid, xlabelsize, xrot, ylabelsize, yrot, figsize, bins, **kwds)
   2839         axes = grouped_hist(self, by=by, ax=ax, grid=grid, figsize=figsize, bins=bins,
   2840                             xlabelsize=xlabelsize, xrot=xrot, ylabelsize=ylabelsize, yrot=yrot,
-> 2841                             **kwds)
   2842 
   2843     if axes.ndim == 1 and len(axes) == 1:

/usr/local/manual/anaconda/lib/python2.7/site-packages/pandas/tools/plotting.pyc in grouped_hist(data, column, by, ax, bins, figsize, layout, sharex, sharey, rot, grid, xlabelsize, xrot, ylabelsize, yrot, **kwargs)
   2879     fig, axes = _grouped_plot(plot_group, data, column=column,
   2880                               by=by, sharex=sharex, sharey=sharey, ax=ax,
-> 2881                               figsize=figsize, layout=layout, rot=rot)
   2882 
   2883     _set_ticks_props(axes, xlabelsize=xlabelsize, xrot=xrot,

/usr/local/manual/anaconda/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _grouped_plot(plotf, data, column, by, numeric_only, figsize, sharex, sharey, layout, rot, ax, **kwargs)
   2990         if numeric_only and isinstance(group, DataFrame):
   2991             group = group._get_numeric_data()
-> 2992         plotf(group, ax, **kwargs)
   2993         ax.set_title(com.pprint_thing(key))
   2994 

/usr/local/manual/anaconda/lib/python2.7/site-packages/pandas/tools/plotting.pyc in plot_group(group, ax)
   2873     """
   2874     def plot_group(group, ax):
-> 2875         ax.hist(group.dropna().values, bins=bins, **kwargs)
   2876 
   2877     xrot = xrot or rot

/usr/local/manual/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   5886             if patch:
   5887                 p = patch[0]
-> 5888                 p.update(kwargs)
   5889                 if lbl is not None:
   5890                     p.set_label(lbl)

/usr/local/manual/anaconda/lib/python2.7/site-packages/matplotlib/artist.pyc in update(self, props)
    755             func = getattr(self, 'set_' + k, None)
    756             if func is None or not six.callable(func):
--> 757                 raise AttributeError('Unknown property %s' % k)
    758             func(v)
    759             changed = True

AttributeError: Unknown property subplots