diff options
| author | Aditya Naik | 2013-12-25 17:41:14 +0530 |
|---|---|---|
| committer | Aditya Naik | 2013-12-25 17:41:14 +0530 |
| commit | a783b865e8b40b149834aea09de3861e1a8c312c (patch) | |
| tree | 97646b9c7b938db3a3a384a78f1a43bb69ddbc80 | |
| parent | 892279be93ca03a1f0f3476c49cdcced4a0f990c (diff) | |
upgrade to ver 2.2
| -rw-r--r-- | aslclass.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/aslclass.py b/aslclass.py index 796911c..c253970 100644 --- a/aslclass.py +++ b/aslclass.py @@ -24,29 +24,39 @@ class ASLreport: if keystroke=="r": print("counter begins") self.key() + else: print("Unknown keystroke ") def key(self): clock() + tottime=0 keystroke=str(msvcrt.getch())[-2] if keystroke=="s": timestamp=clock() self.shotcount=self.shotcount+1 - self.shotlist.append((self.shotcount,timestamp)) + if self.pauseinterval!=[]: + for pausetime in self.pauseinterval: tottime=tottime+pausetime + actualtime=float(timestamp)-float(tottime) + # self.shotlist.append((self.shotcount,actualtime )) + print("Shot #%d at %fs "%(self.shotcount,actualtime)) + else: + self.shotlist.append((self.shotcount,timestamp )) + print("Shot #%d at %fs "%(self.shotcount,timestamp)) self.key() elif keystroke=="p": self.pause() elif keystroke=="e" : self.reset() + else: print("Unkown keystroke") def pause(self): print("paused") - startpause=clock() + self.startpause=clock() startagain=str(msvcrt.getch())[-2] if startagain=="p": - endpause=clock() + self.endpause=clock() print("restarted") - self.pauseinterval.append(endpause-startpause) + self.pauseinterval.append(self.endpause-self.startpause) self.key() elif startagain=="e": self.reset() - else: pass + else: print("Unknown keystroke") def reset(self): self.totaltime=clock() @@ -63,7 +73,7 @@ class ASLreport: def reportgenerator(self): fileopen=open(r"%s.ASLreport"%self.name,mode="w") fileopen.write( - "ASL report for %s \n\n Record Time=%f\n Recorded Shots=%d\n ASL=%f\nShot Timestamps:\n%s"%(self.name,self.totaltime,self.shotcount,self.ASL,(str(shotdata) for shotdata in self.shotlist))) + "ASL report for %s \n\n Record Time=%f\n Recorded Shots=%d\n ASL=%f\nShot Timestamps:\n%s"%(self.name,self.totaltime,self.shotcount,self.ASL,str(self.shotlist))) if __name__=="__main__": ASLreport().metadata()
\ No newline at end of file |
