def keyEvents(self, key, x=None, y=None): if key=='?': self.help() if key=='q': self.close() if key=='d': self.goodframes[self.id] = 0 self.updatepage() if key=='u': self.goodframes[self.id] = 1 if key=='p': self.redophot(self.id) self.updatedataplot() if key=='P': self.thread=QtCore.QThread() self.thread.run=self.newphot self.thread.start() if key=='t' and x is not None and y is not None: tr=self.radius imarr=self.struct[int(self.pid[self.id])].data timage, tx, ty = st.calcdrift(imarr, x, y, tr, self.naxis1, self.naxis2) if tx >= 0 and ty >= 0: self.tx[self.id]=tx self.ty[self.id]=ty self.updatepage() if key=='c' and x is not None and y is not None: r=self.radius imarr=self.struct[int(self.pid[self.id])].data cimage, cx, cy = st.calcdrift(imarr, x, y, r, self.naxis1, self.naxis2) if cx >= 0 and cy >= 0: self.cx[self.id]=cx self.cy[self.id]=cy self.updatepage()
def keyEvents(self, key, x=None, y=None): if key == '?': self.help() if key == 'q': self.close() if key == 'd': self.goodframes[self.id] = 0 self.updatepage() if key == 'u': self.goodframes[self.id] = 1 if key == 'p': self.redophot(self.id) self.updatedataplot() if key == 'P': self.thread = QtCore.QThread() self.thread.run = self.newphot self.thread.start() if key == 't' and x is not None and y is not None: tr = self.radius imarr = self.struct[int(self.pid[self.id])].data timage, tx, ty = st.calcdrift(imarr, x, y, tr, self.naxis1, self.naxis2) if tx >= 0 and ty >= 0: self.tx[self.id] = tx self.ty[self.id] = ty self.updatepage() if key == 'c' and x is not None and y is not None: r = self.radius imarr = self.struct[int(self.pid[self.id])].data cimage, cx, cy = st.calcdrift(imarr, x, y, r, self.naxis1, self.naxis2) if cx >= 0 and cy >= 0: self.cx[self.id] = cx self.cy[self.id] = cy self.updatepage()
def newphoto(self, e): """program to being new photometry""" if e.key=='c' and e.xdata and e.ydata: cx=e.xdata cy=e.ydata cr=self.radius image=self.struct[int(self.pid[self.id])].data cimage, cx, cy = st.calcdrift(image, cx, cy, cr, self.naxis1, self.naxis2) if cx >= 0 and cy >= 0: self.cx[self.id]=cx self.cy[self.id]=cy self.updatedataplot() if e.key=='t' and e.xdata and e.ydata: tx=e.xdata ty=e.ydata tr=self.radius image=self.struct[int(self.pid[self.id])].data timage, tx, ty = st.calcdrift(image, tx, ty, tr, self.naxis1, self.naxis2) if tx >= 0 and ty >= 0: self.tx[self.id]=tx self.ty[self.id]=ty self.updatedataplot() if e.key=='p': self.redophot(self.id) #self.updatelightcurve() #self.lccanvas.draw() self.lcfig.delaxes(self.light_plot) self.plotlightcurve() self.lccanvas.draw() #self.callreset() if e.key=='P': nstart=self.id+1 nend=self.nframes-1 self.redophot(self.id) self.stopplay=True i=nstart while i < nend and self.stopplay: image=self.struct[int(self.pid[self.id])].data # these may be changed sigdet=5 contpix=10 sigback=3 driftlimit=10 iter=3 carray, fx,fy,status = st.finddrift(image, self.cx[i-1], self.cy[i-1], self.radius, \ self.naxis1, self.naxis2, sigdet, contpix, sigback, driftlimit, iter, self.logfile) if fx > -1 and fy > -1: if fx < self.naxis1 and fy < self.naxis2: dx=self.cx[i-1]-fx dy=self.cy[i-1]-fy self.cx[i]=fx self.cy[i]=fy self.tx[i]=self.tx[i-1]-dx self.ty[i]=self.ty[i-1]-dy else: message='Not able to perform photometry' print message return else: message='Not able to perform photometry' print message return self.redophot(i) self.lcfig.delaxes(self.light_plot) self.plotlightcurve() self.lccanvas.draw() if self.dtime[i] < self.lcx1 or self.dtime[i] > self.lcx2: self.callreset() #self.updatelightcurve() #self.lccanvas.draw() self.root.update() if not self.stopplay: self.updatedataplot() i += 1