Esempio n. 1
0
    def calculation_precise_coverage(self, parameters):
        #LISTA COM OS NÚMEROS DOS DOCUMENTOS RELEVANTES PARA A CONSULTA Q
        listDocRelevant = parameters[1]
        allRelevant = len(listDocRelevant)
        if allRelevant > 20:
            allRelevant = 20

        listResultScore = []
        cont = 0
        score = parameters[0]
        position = 1
        flag = 0
        auxSmaller = len(score)
        for n in score[0:self.value]:
            doc = int(n[0].get_path())
            if doc in listDocRelevant:
                print("Doc" + str(doc) + " posição>" + str(position))
                cont += 1
                flag = 1
            c = float(cont / allRelevant)
            try:
                p = float(cont / position)
            except ZeroDivisionError:
                p = 0
            listResultScore.append(Infor(doc, c, p, flag))
            position += 1
            flag = 0
        return (listResultScore, cont)
Esempio n. 2
0
 def __init__(self):
     # Definiton of the variables
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.path_selected = None
     self.navi = Navigator(self.window)
     self.info = Infor(self.window)
     self.oper = Operator(self.window)
     self.gwydata = GwyData()
     self.img_1 = Imager(self.window,400)
     self.img_2 = Imager(self.window,400)
     self.channel_img_1 = None
     self.channel_img_2 = None
     # Definition of the widget
     self.window.connect("destroy", lambda w: gtk.main_quit())
     self.window.set_title("SPMBrowser")
     # vbox_main
     self.vbox_main = gtk.VBox(False,0)
     # hbox_main
     self.hbox_main = gtk.HBox(False,0)
     self.vbox_2 = gtk.VBox(False,0)
     self.hbox_main.pack_start(self.img_1.vbox_main,1,1,0)
     self.hbox_main.pack_start(self.img_2.vbox_main,1,1,0)
     self.vbox_2.pack_start(self.info.table_info,0,1,0)
     self.vbox_2.pack_end(self.oper.vbox_main,0,1,0)
     self.hbox_main.pack_end(self.vbox_2,0,1,0)
     # pack
     self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
     self.vbox_main.pack_start(self.hbox_main,0,1,0)
     self.window.add(self.vbox_main)
     self.window.show_all()
     # Signal handling
     self.navi.combobox_files.connect('changed',self.update_all,None)
     self.img_1.combobox_channels.connect('changed',self.record_channels,None)
     self.img_2.combobox_channels.connect('changed',self.record_channels,None)
     #self.info.entry_ratio.connect('changed',self.update_info,None)
     self.window.connect('key_press_event',self._key_press_event)
Esempio n. 3
0
class SPMBrowser():
    def __init__(self):
        # Definiton of the variables
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.path_selected = None
        self.navi = Navigator(self.window)
        self.info = Infor(self.window)
        self.oper = Operator(self.window)
        self.gwydata = GwyData()
        self.img_1 = Imager(self.window,400)
        self.img_2 = Imager(self.window,400)
        self.channel_img_1 = None
        self.channel_img_2 = None
        # Definition of the widget
        self.window.connect("destroy", lambda w: gtk.main_quit())
        self.window.set_title("SPMBrowser")
        # vbox_main
        self.vbox_main = gtk.VBox(False,0)
        # hbox_main
        self.hbox_main = gtk.HBox(False,0)
        self.vbox_2 = gtk.VBox(False,0)
        self.hbox_main.pack_start(self.img_1.vbox_main,1,1,0)
        self.hbox_main.pack_start(self.img_2.vbox_main,1,1,0)
        self.vbox_2.pack_start(self.info.table_info,0,1,0)
        self.vbox_2.pack_end(self.oper.vbox_main,0,1,0)
        self.hbox_main.pack_end(self.vbox_2,0,1,0)
        # pack
        self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
        self.vbox_main.pack_start(self.hbox_main,0,1,0)
        self.window.add(self.vbox_main)
        self.window.show_all()
        # Signal handling
        self.navi.combobox_files.connect('changed',self.update_all,None)
        self.img_1.combobox_channels.connect('changed',self.record_channels,None)
        self.img_2.combobox_channels.connect('changed',self.record_channels,None)
        #self.info.entry_ratio.connect('changed',self.update_info,None)
        self.window.connect('key_press_event',self._key_press_event)

    def update_all(self,widget,data):
        self.current_data = self.navi.get_full_path()
        if self.current_data:
            self.gwydata.load_data(self.current_data)
            self.info.initialize(widget,self.gwydata.param)
            #print self.gwydata.param['channels']
            self.img_1.initialize(self.gwydata,self.channel_img_1)
            self.img_2.initialize(self.gwydata,self.channel_img_2)
            self.oper.get_current_data(self.gwydata.get_container(),self.gwydata.get_param(),self.navi.get_path2save(),'Z')

    def record_channels(self,widget,data):
        self.gwydata.param['im_1_channel'] = self.img_1.channel_id
        self.gwydata.param['im_2_channel'] = self.img_2.channel_id
        self.channel_img_1 = self.img_1.get_active_channel()
        self.channel_img_2 = self.img_2.get_active_channel()
        self.oper.get_current_data(self.gwydata.get_container(),self.gwydata.get_param(),self.navi.path2save,'Z')
        #print self.navi.path2save

    def update_info(self,widget,data):
        self.info.update()

    def _key_press_event(self,widget,data):
        keyval = data.keyval
        #print keyval
        if keyval == 110:
            active = self.navi.combobox_files.get_active()
            if active >= 0:
                self.navi.go_forward(widget,data)
        if keyval == 98:
            active = self.navi.combobox_files.get_active()
            if active >= 0:
                self.navi.go_backward(widget,data)