Ejemplo n.º 1
0
# Chris Riederer
# Google, Inc
# 2014-08-15

"""Record baselines and show improvements for working on magnet"""

import test_detect as t

import glob

cleanedList = t.GetRunDataFromArgs(glob.glob('cleaned/*.json'))
snipList = t.GetRunDataFromArgs(glob.glob('snips/*.json'))

decalCleanedList = t.GetRunDataFromArgs(glob.glob('cleaned/*.json'))
decalCleanedList = t.preprocessRunData(decalCleanedList)
decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/*.json'))
decalSnipList = t.preprocessRunData(decalSnipList)

def tryDetector(detector, detectorLabel):
  print detectorLabel
  print "Running on snippets"
  t.testDetector(detector, snipList, printFileData=False)
  print

  print detectorLabel
  print "Running on full files"
  t.testDetector(detector, cleanedList, printFileData=False)
  print

  print detectorLabel
  print "Running on snippets, decalibrated"
Ejemplo n.º 2
0
import sys

if len(sys.argv) < 2:
    print "Please provide the name of the file you'd like to analyze."

runData = t.MakeDummyRunData()

with open(sys.argv[1]) as f:
    magdata = []
    f.readline()
    f.readline()
    for line in f:
        empty, time, x, y, z = line.strip().split(",")
        magdata.append(map(float, [time, 0, x, y, z]))

runData["magnetometer"] = magdata

runDataList = [runData]
runDataList = t.preprocessRunData(runDataList)

detector = t.TimeWindowDetector()
detector.segment_time = 175
# detector = t.OriginalDetector()

# t.PlotData(runData)
# t.pl.show()

# t.testDetector(detector, runDataList, optPlotData=True)
t.PlotThresholds(runData, 30, 130, segment_size=400)
Ejemplo n.º 3
0
  t.pl.plot(newX, newY, color='red')


# things to plot:
#   snips w/ template for each axis
#   distances of snips from template


# TODO: NOT JUST MMX
# decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/!(htc*|s4*|nexus*|moto*)'))
decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/[!h]*.json')) # not htc
# decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/mmx*.json')) # not htc
# decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/motox-negative-cjr-4*.json')) # not htc
# decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/[!hs]*.json')) # not htc
# decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/mmx*.json'))
decalSnipList = t.preprocessRunData(decalSnipList)
print len(decalSnipList)

# break into positives and negatives
positives = [rd for rd in decalSnipList if len(rd['labels']) > 0]
negatives = [rd for rd in decalSnipList if len(rd['labels']) == 0]


# xt, yt, zt, magt = t.CreateTemplates(decalSnipList)
# newX = range(0,500000000,1000000)
# newY = [magt(x) for x in newX]
# t.pl.plot(newX, newY)

# templates = t.CreateTemplates(decalSnipList)
# featurizer = t.ManyFeaturesSumOfDifferencesMagToVec(templates)
# featurizer = t.MagnitudeFeaturesDataToVec()
Ejemplo n.º 4
0
import sys

if len(sys.argv) < 2:
  print "Please provide the name of the file you'd like to analyze."

runData = t.MakeDummyRunData()

with open(sys.argv[1]) as f:
  magdata = []
  f.readline()
  f.readline()
  for line in f:
    empty, time, x, y, z = line.strip().split(',')
    magdata.append(map(float, [time, 0, x, y, z]))

runData['magnetometer'] = magdata

runDataList = [runData]
runDataList = t.preprocessRunData(runDataList)

detector = t.TimeWindowDetector()
detector.segment_time = 175
# detector = t.OriginalDetector()

# t.PlotData(runData)
# t.pl.show()

# t.testDetector(detector, runDataList, optPlotData=True)
t.PlotThresholds(runData, 30, 130, segment_size=400)
Ejemplo n.º 5
0
# Chris Riederer
# Google, Inc
# 2014-08-15
"""Record baselines and show improvements for working on magnet"""

import test_detect as t

import glob

cleanedList = t.GetRunDataFromArgs(glob.glob('cleaned/*.json'))
snipList = t.GetRunDataFromArgs(glob.glob('snips/*.json'))

decalCleanedList = t.GetRunDataFromArgs(glob.glob('cleaned/*.json'))
decalCleanedList = t.preprocessRunData(decalCleanedList)
decalSnipList = t.GetRunDataFromArgs(glob.glob('snips/*.json'))
decalSnipList = t.preprocessRunData(decalSnipList)


def tryDetector(detector, detectorLabel):
    print detectorLabel
    print "Running on snippets"
    t.testDetector(detector, snipList, printFileData=False)
    print

    print detectorLabel
    print "Running on full files"
    t.testDetector(detector, cleanedList, printFileData=False)
    print

    print detectorLabel
    print "Running on snippets, decalibrated"