Skip to content

Instantly share code, notes, and snippets.

View gadamc's full-sized avatar

G Adam Cox gadamc

  • Q-CTRL
  • Seattle, WA
  • 15:31 (UTC -12:00)
View GitHub Profile
@gadamc
gadamc / optfilter_plots.py
Last active December 14, 2015 09:50
plot optimal filter output spectra
#!/usr/bin/env python
import couchdbkit
import ROOT
import sys
import KDataPy.samba_utilities as sutil
import KDataPy.util as kutil
from os import listdir
from os.path import isfile, join
import numpy as np
First, I start with a reminder of the raw data structure and amp level data structure. (I won't include the Muon Modules…). TCA = TClonesArray
KRawEvent
-- TCA of KRawBolometerRecords
- detector name, mass, etc..
- TRefArray links to KRawBoloPulseRecords
- TRef link to KRawSambaRecord
//paste this into a ROOT macro, or the interpreter directly
gSystem.Load("libkds")
KHLAEvent *ehla = KEventFactory::NewHLAEvent()
KAmpEvent *eamp = KEventFactory::NewAmpEvent()
eamp->SetEventTriggerStamp(100)
eamp->AddBolo()
// (class KAmpBolometerRecord*)0x7fbbeacd1ee0
@gadamc
gadamc / data.txt
Last active December 17, 2015 23:39
Alpine Data Labs 30.2% (60) 34.2% (68) 35.7% (71) 1.94 199
Bright.com 25.4% (54) 48.4% (103) 26.3% (56) 1.99 213
Cloudant 93.3% (1349) 3.5% (50) 3.3% (47) 2.90 1446
Cloudera 30.1% (241) 47.2% (378) 22.7% (182) 2.07 801
Cloudmeter 87.2% (444) 7.9% (40) 5.3% (27) 2.83 509
CloudPhysics 75.6% (341) 14.9% (67) 10.4% (47) 2.67 451
Concurrent 16.2% (22) 42.6% (58) 41.2% (56) 1.75 136
Continuum Analytics 59.6% (133) 17.0% (38) 23.3% (52) 2.36 223
Datameer 57.5% (226) 21.1% (83) 21.4% (84) 2.36 393
DataSift 12.5% (12) 47.9% (46) 39.6% (38) 1.73 96
@gadamc
gadamc / csvtocouch.py
Created June 5, 2013 18:57
Example on how to read a CSV file using DictReader and then upload them to couchdb (with couchdbkit)
#!/usr/bin/env python
from couchdbkit import Server
from csv import DictReader
import time, sys, subprocess, math, os, datetime, pytz, calendar, json
#______________
# parseDoc
def parseDoc(doc):
for k,v in doc.items():
def geoname(lat, lng, usrname):
url = 'http://api.geonames.org/countrySubdivisionJSON?lat=%f&lng=%f&username=%s' % (lat, lng, usrname)
r = requests.get(url)
r.raise_for_status() #we'll quit if we have any problems.
return r.json()
@gadamc
gadamc / map.js
Created June 13, 2013 18:49
I called this design doc == geonames, view == nopoliticalinfo
function(doc){
if(doc.text && !doc.countryName && !doc.adminName1 && doc.geo && typeof doc["geo"]["coordinates"][0] === 'number' && typeof doc["geo"]["coordinates"][1] === 'number')
emit( doc._id, 1);
}
http://cpsievert.wordpress.com/
https://github.com/cpsievert/pitchFX
http://fastballs.wordpress.com/2007/08/23/how-to-build-a-pitch-database/
http://www.fangraphs.com/library/misc/pitch-fx/
http://www.fangraphs.com/library/interpreting-pitchfx-data/
http://www.fangraphs.com/library/pitch-type-abbreviations-classifications/
http://gd2.mlb.com/components/game/mlb/year_2007/
http://www.fangraphs.com/blogs/the-early-trend-of-2013-dingers/#more-120259
@gadamc
gadamc / acurl.py
Last active December 30, 2015 20:59
set up a curl alias (acurl) to include credentials so that you don't have to type them out
import base64
import os
import sys
user = raw_input('username:')
password = raw_input('password:')
b64encoded = base64.urlsafe_b64encode('{0}:{1}'.format(user,password))
shell = os.path.basename(os.environ.get('SHELL'))
#!/usr/bin/env python
from couchdbkit import Server
from csv import DictReader
import time, sys, subprocess, math, os, datetime, pytz, calendar, json
#______________
# parseDoc
def parseDoc(doc):
for k,v in doc.items():