def getFilteredAll(): try: start = sys.argv[1] except IndexError: start = '' try: end = sys.argv[2] except IndexError: end = '' try: msgid = sys.argv[3] except IndexError: msgid = 32 sensors = qs.GetSensorDF() for s in range(len(sensors)): targetTable = sensors.name[s] df = qs.GetRawAccelData(siteid = targetTable, fromTime = start, toTime = end, msgid = msgid) numElements = len(df.index) qs.PrintOut("Number of %s Raw elements: %s" % (targetTable, numElements)) if numElements > 0: df_filtered = fs.applyFilters(df, orthof=True, rangef=True, outlierf=True) numFiltered = len(df_filtered.index) if numFiltered > 0: qs.PrintOut("Number of %s filtered elements: %s" % (targetTable, numFiltered)) #print df_filtered else: qs.PrintOut("No valid filtered data for %s" % (targetTable))
def testBlock(_tdate=None, _twin=None): if (_tdate == None) or (_twin == None): print "Error: No target date or time window input" return try: #Get list of sensors sensorsInfo = qs.GetSensorDF() columns = sensorsInfo["name"] for column in columns: print """\n\nCurrent Sensor Column: %s, Target Date: %s, Time Window: %s \n\n""" % ( column, _tdate, _twin) hmap_data = hmap.heatmap(col=column, t_timestamp=_tdate) print hmap_data except IndexError: print '>> Error in writing extracting database data to files..'
#import Data Analysis/querySenslopeDb import querySenslopeDb as qs #import Velocity, Column Position and Displacement Generator Library import vcdgen as vcd #vcd.displacement("mamb") fdate = "2016-05-01 00:00:00" #tdate = time.strftime("%Y-%m-%d %H:%M") tdate = "2016-06-09 15:00:00" fixpoints = ['top', 'bottom', 'TOP', 'BOTTOM', 'Top', 'Bottom', ''] try: #Get list of sensors sensorsInfo = qs.GetSensorDF() columns = sensorsInfo["name"] # for fixpoint in fixpoints: # print fixpoint for column in columns: print """Current Sensor Column: %s, End Date: %s, Start Date: %s""" % ( column, tdate, fdate) vel = vcd.velocity(colname=column, endTS=tdate) print vel except IndexError: print '>> Error in writing extracting database data to files..'
# -*- coding: utf-8 -*- """ Created on Fri Nov 13 16:24:57 2015 @author: Mizpah """ import querySenslopeDb as qs import filterSensorData as fs sensors = qs.GetSensorDF() #print sensors for s in range(len(sensors)): targetTable = sensors.name[s] #df = qs.GetRawAccelData(siteid = targetTable, fromTime = "2013-01-01", msgid = 33) df = qs.GetRawAccelData(siteid=targetTable, fromTime="2013-01-01") numElements = len(df.index) if numElements > 0: df_resampled = fs.applyFilters(df, orthof=True, rangef=True, outlierf=False) df_filtered = fs.applyFilters(df, orthof=False, rangef=False, outlierf=True) numFiltered = len(df_filtered.index)