Created
November 27, 2012 13:49
-
-
Save gadamc/4154304 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import KDataPy.database as kdb | |
import datetime, time | |
db = kdb.radon('http://10.0.1.11:5984') | |
startTime = datetime.datetime(2010, 10, 18, 13, 0, 0) | |
endTime = startTime + datetime.timedelta(hours=-5) | |
endTime_epoch = time.mktime(endTime.timetuple()) | |
startTime_epoch = time.mktime(startTime.timetuple()) | |
#special function built to run on server side that uses a mapReduce View to collate the results | |
#into a histogram, which is returned here. | |
#Please don't kill my computer with large time ranges! :) | |
data = db.list('app/hist' , 'bydate', reduce=False, descending=True, startkey=startTime_epoch, endkey=endTime_epoch, lowE=2000, highE=2350) | |
counts = sum(data) | |
activity = 98.7 * counts / (startTime_epoch - endTime_epoch) | |
print 'from', endTime, 'to', startTime, ':' | |
print ' radon activity was', activity, ' Bq/m^3' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment