X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETGlitch.py;h=2e0b2b42751df9fce835c3902ee54bbf3a09c729;hp=7e997cb281d200d9d1c9e8866815611769d1ea84;hb=8ae30e6291cb4a6d67833eaa3ac23f9081f3e99a;hpb=ede679b09a09781692fe15a4b3ca76e965378d91 diff --git a/client/GoodFETGlitch.py b/client/GoodFETGlitch.py index 7e997cb..2e0b2b4 100644 --- a/client/GoodFETGlitch.py +++ b/client/GoodFETGlitch.py @@ -75,15 +75,21 @@ class GoodFETGlitch(GoodFET): return range(min,max,1); #If we get here, there are no points. Return empty set. return []; - def buildglitchvoltages(self): + def crunch(self): """This builds tables for glitching voltage ranges from the training set.""" - print "Precomputing glitching ranges. This might take a while."; + print "Precomputing glitching ranges. This might take a long while."; + print "Times..."; sys.stdout.flush(); - self.db.execute("create temporary table glitchrange(time integer primary key asc,max,min);"); + self.db.execute("drop table if exists glitchrange;"); + self.db.execute("create table glitchrange(time integer primary key asc,max,min);"); self.db.execute("insert into glitchrange(time,max,min) select distinct time, 0, 0 from glitches;"); + print "Maximums..."; + sys.stdout.flush(); self.db.execute("update glitchrange set max=(select max(vcc) from glitches where glitches.time=glitchrange.time and count=0);"); + print "Minimums..."; + sys.stdout.flush(); self.db.execute("update glitchrange set min=(select min(vcc) from glitches where glitches.time=glitchrange.time and count>0);"); - + print "Ranges calculated."; def graphx11(self): try: import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils @@ -126,9 +132,9 @@ class GoodFETGlitch(GoodFET): tstop=self.client.glitchstarttime(); times=range(tstart,tstop); random.shuffle(times); - self.buildglitchvoltages(); + #self.crunch(); count=0.0; - total=1.0*len(t); + total=1.0*len(times); for t in times: voltages=self.glitchvoltages(t); count=count+1.0;