示例#1
0
 def calc_avg_val_cols(self,row_tree,col_tree):
     if row_tree is None:
         pass
     else:
         avg_level_cols = barcode.level_avgs(self.data,col_tree)
         avg_tree_cols = tree_util.tree_averages(avg_level_cols,row_tree).T
         self.avg_tree_cols = avg_tree_cols
         Publisher.sendMessage("embed.col.avg")
     return avg_tree_cols
示例#2
0
 def calc_avg_val_rows(self,row_tree,col_tree):
     if col_tree is None:
         print "empty column tree"
         pass
     else:
         avg_level_rows = barcode.level_avgs(self.data.T,row_tree).T
         avg_tree_rows = tree_util.tree_averages(avg_level_rows.T,col_tree).T
         self.avg_tree_rows = avg_tree_rows
         Publisher.sendMessage("embed.row.avg")
     return avg_tree_rows
示例#3
0
    def calculate(self,datadict):
        self.data = datadict["data"]
        self.q_descs = datadict["q_descs"]
        self.p_score_descs = datadict["p_score_descs"]
        self.p_scores = datadict["p_scores"]
        self.col_tree = datadict["col_tree"]
        self.row_tree = datadict["row_tree"] 

        avgs = barcode.level_avgs(self.data,self.col_tree)
        node_avgs = tree_util.tree_averages(avgs,self.row_tree)
        orig_shape = np.shape(node_avgs)
        r_avgs = np.reshape(node_avgs,(-1,orig_shape[-1]))
        #br_avgs = barcode.organize_cols(self.col_tree,r_avgs)
        #self.q_image = np.reshape(br_avgs,orig_shape)
        self.q_image = np.reshape(r_avgs,orig_shape)
        self.q_image_mg = np.zeros(np.shape(self.q_image))
        self.q_image_mg[:,1:,:] = np.diff(self.q_image,axis=1)
        self.q_image_top = np.zeros(np.shape(self.q_image))
        self.q_image_top = self.q_image - self.q_image[:,0,:][:,np.newaxis,:]