def variability(self): data = cut_data(self.get_text()) varability = VariabilityTest(data[0], data[1], deviation_weight=1, percentage_condition=0) test = varability.calculate() Info.message("VariabilityTest", "Variability: %s" % test)
def __init__(self,name,parent): self.name = name self.pub = rospy.Publisher('/%s/compressed'%name, CompressedImage) self.blank_pub = rospy.Publisher('/%s_blank/compressed'%name, CompressedImage) self.info = Info() self.sub = None self.detect = getattr(VUtil, name) self.parent = parent self.kern = (3,3) self.thresh = 100 self.canPublish = False self.box = getCheckBox(name) self.box.stateChanged.connect(self.box_cb)
class Sub: def __init__(self,name,parent): self.name = name self.pub = rospy.Publisher('/%s/compressed'%name, CompressedImage) self.blank_pub = rospy.Publisher('/%s_blank/compressed'%name, CompressedImage) self.info = Info() self.sub = None self.detect = getattr(VUtil, name) self.parent = parent self.kern = (3,3) self.thresh = 100 self.canPublish = False self.box = getCheckBox(name) self.box.stateChanged.connect(self.box_cb) def cam_cb(self,rosimg): cvimg = VUtil.rosimg2cv(rosimg) y,x = cvimg.shape[:2] cvimg = cv2.resize(cvimg, (x/2,y/2)) if self.canPublish: blank = np.zeros_like(cvimg) out = self.detect(cvimg,self.info.data,blank) self.info.draw(blank) self.pub.publish(VUtil.writeCompressed(out)) self.blank_pub.publish(VUtil.writeCompressed(blank)) def box_cb(self, state): if state == QtCore.Qt.Checked: topic = str(self.parent.currTopic) self.sub = rospy.Subscriber(topic,Image,self.cam_cb) self.canPublish = True self.parent.analyseTopic = '/%s/compressed'%self.name self.ps = subprocess.Popen(['rosrun','image_view','image_view','image:='+'/%s_blank'%self.name,'compressed']) else: self.canPublish = False self.sub.unregister() self.ps.terminate()
def load(self): if len(self.get(0.0, END)) > 1: s = Info.askyesno( "Are you sure?", "Text filed isn't empty. Are you sure you want to load?" "You will loose your changes!") if not s: return self.clear() x = loadfile() # here we got tuple (directory, text) if not x: return filename = x[0].split("/") filename = filename[-1] self.master.title(title + " - " + filename) if not x: return self.directory = x[0] self.insert_text(x[1])