Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created July 14, 2011 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadamc/1082583 to your computer and use it in GitHub Desktop.
Save gadamc/1082583 to your computer and use it in GitHub Desktop.
plot t_bolo v co
#!/usr/bin/env python
from couchdbkit import Server, Database
from ROOT import TFile, TH1D
import numpy as np
import sys
s = Server(sys.argv[1])
db = s[sys.argv[2]]
fout = TFile('tbolo_co_july8to14.root','recreate')
hFr = TH1D('hfr','hfr',5000,0.01, 0.03)
hIt = TH1D('hit','hit',5000,0.01, 0.03)
hNoCo = TH1D('hnoco','hnoco',5000,0.01, 0.03)
valCoFrance = []
valCoItaly = []
valNoCo = []
for i in range(8,14): #change these numbers to change the days (everything is in july)
for j in range(0,24):
vr = db.view('data/bydate', reduce=False, endkey = [2011,7,i,j+1,0,0,0], startkey=[2011,7,i,j,0,0,0], include_docs=True)
for row in vr:
if row['doc']['ipaddr'] == '134.158.176.112':
if row['doc']['Co_Italie'] > 0 and row['doc']['T_Bolo'] < 0.03:
valCoItaly.append(row['doc']['T_Bolo'])
hIt.Fill(row['doc']['T_Bolo'])
if row['doc']['Co_France'] > 0 and row['doc']['T_Bolo'] < 0.03:
valCoFrance.append(row['doc']['T_Bolo'])
hFr.Fill(row['doc']['T_Bolo'])
if row['doc']['Co_Italie'] == 0 and row['doc']['Co_France'] == 0:
valNoCo.append(row['doc']['T_Bolo'])
hNoCo.Fill(row['doc']['T_Bolo'])
vItaly = np.array(valCoItaly)
vFrance = np.array(valCoFrance)
vNoCo = np.array(valNoCo)
print 'Temperature Results - july 8 to july 14'
print 'number of events (italy, france, noCo)', len(vItaly), len(vFrance), len(vNoCo)
print 'Co_Italy: mean', vItaly.mean(), '+-', vItaly.std()
print 'Co_France: mean', vFrance.mean(), '+-', vFrance.std()
print 'No Co: mean', vNoCo.mean(), '+-', vNoCo.std()
fout.cd()
hFr.Write()
hIt.Write()
hNoCo.Write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment