Exemple #1
0
    def action_start(self):
        data = Data(self.path)
        pref = self.preference.get()
        pref = pref if pref == 'median' or 'max' else float(pref)
        param = [
            self.min_count.get(),
            self.min_occur.get(),
            self.segment_range.get(), pref,
            self.damping_factor.get(),
            self.max_iteration.get()
        ]
        if None not in param:
            mc.start(data,
                     min_count=param[0],
                     min_occur=param[1],
                     segment_range_ms=param[2] * 3600 * 1000,
                     preference=param[3],
                     damping_factor=param[4],
                     max_iteration=param[5],
                     new_data=self.new_data.get())
            segment_list = data.get_segment_list()
            if len(segment_list) > 0:
                option = self.segment_option['menu']
                option.delete(0, 'end')
                for index, string in enumerate(segment_list):
                    option.add_command(label=string,
                                       command=lambda idx=index, val=string:
                                       self.load_summary(idx, name=val))

            self.statistic_text.delete('1.0', 'end')
            statistic = data.get_statistic()
            for text in statistic:
                self.statistic_text.insert('insert', text + '\n')
Exemple #2
0
    def action_open_path(self):
        self.path = askdirectory()
        if not self.path:
            return
        data = Data(self.path)
        param = data.get_result('PARAMETER')
        if param is not None:
            self.min_count.set(param['min_count'])
            self.min_occur.set(param['min_occur'])
            self.segment_range.set(param['segment_range_ms'] / (3600 * 1000))
            self.preference.set(param['preference'])
            self.damping_factor.set(param['damping_factor'])
            self.max_iteration.set(param['max_iteration'])

            segment_list = data.get_segment_list()
            if len(segment_list) > 0:
                option = self.segment_option['menu']
                option.delete(0, 'end')
                for index, string in enumerate(segment_list):
                    option.add_command(label=string,
                                       command=lambda idx=index, val=string:
                                       self.load_summary(idx, name=val))

            self.statistic_text.delete('1.0', 'end')
            statistic = data.get_statistic()
            for text in statistic:
                self.statistic_text.insert('insert', text + '\n')