def analyze_signal(self):  #Veriyi Analiz Etme
        self.average, self.entropy, self.kurtosis, self.max_v, self.median, self.min_v, self.skewness, self.standart_dev = Features.check_statistics(
            self)
        self.wavelet_type, self.wavelet_level = Features.discrete_check_wavelet(
            self)
        if (self.load_check and
            (self.average or self.entropy or self.kurtosis or self.max_v
             or self.median or self.min_v or self.skewness
             or self.standart_dev)):  #işlenecek müzik olması durumu

            self.analyze_check = True
            col, self.header, self.db_header = Features.init_table(
                self, len(self.all_signals))
            self.db_matrix = np.zeros(
                (len(self.all_signals), 8 * (self.wavelet_level + 1)))

            for iter in range(0, len(self.all_signals)):
                print(self.all_signals[iter])
                self.signals.clear()
                self.audio, self.sample = librosa.load(self.all_signals[iter])
                self.signals.append(self.audio)
                self.time = np.arange(0, len(self.audio)) / self.sample

                coeffs = pywt.wavedec(
                    self.audio, self.wavelet_type,
                    level=self.wavelet_level)  #Wavelet Analiz

                for i in range(0, self.wavelet_level + 1):
                    self.signals.append(coeffs[i])  #Sinyalleri Coef içine atma

                if (iter == 0
                        and self.wavelet_level < 8):  #İlk sinyali yazdırma
                    Features.discrete_plot_signal(self)
                self.db_matrix[iter] = Features.insertTable(self, iter, col)

                self.progressBar.setValue(
                    ((iter + 1) / len(self.all_signals)) * 100)
                #level = 3 ise signals içinde  5 (4 analiz edilmiş + 1 source)
        else:
            if not self.load_check:
                Features.message("You have to load at least 1 signal",
                                 QMessageBox.Warning)
            else:
                Features.message(
                    "You have to pick at least 1 statistic function",
                    QMessageBox.Warning)
    def run(self):
        wave_types = pywt.wavelist(kind='discrete')
        levels = [1, 2, 3]
        signals = []
        self.average, self.entropy, self.kurtosis, self.max_v, self.median, self.min_v, self.skewness, self.standart_dev = Features.check_statistics(
            self)
        table_names = Database.get_table_names(Database.database_name)

        for wave_func in wave_types:
            if wave_func.find("sym") == -1:
                for level in levels:
                    self.wavelet_level = level
                    self.wavelet_type = wave_func
                    col, self.header, self.db_header = Features.init_table(
                        self, len(self.all_signals))
                    self.db_matrix = np.zeros(
                        (len(self.all_signals), 8 * (self.wavelet_level + 1)))

                    if not any("Db_GTZAN_function_" + str(wave_func) +
                               "_Degree_" + str(level) in s
                               for s in table_names):

                        for iter in range(0, len(self.all_signals)):
                            self.signals.clear()
                            self.audio, self.sample = librosa.load(
                                self.all_signals[iter])
                            self.signals.append(self.audio)
                            self.time = np.arange(0, len(
                                self.audio)) / self.sample

                            coeffs = pywt.wavedec(
                                self.audio,
                                self.wavelet_type,
                                level=self.wavelet_level)  # wavelet analyze

                            for i in range(0, self.wavelet_level + 1):
                                self.signals.append(
                                    coeffs[i]
                                )  # adding signals array to coeffs

                            self.db_matrix[iter] = Features.insertTable(
                                self, iter, col
                            )  # level = 3 ise signals içinde  5 (4 analiz edilmiş + 1 kaynak)

                        w_name = str(wave_func)
                        table_name = "Db_GTZAN_function_" + w_name + "_Degree_" + str(
                            level)
                        Database.create_table(Database.database_name,
                                              table_name, self.db_header, "")

                        for index in range(0, len(self.all_signals)):
                            name = self.all_signals[index].split(
                                sep='/')  # name of signal
                            Database.delete_row(Database.database_name,
                                                table_name, name[-1], "")
                            Database.add_values_to_table(
                                Database.database_name, table_name, name[-1],
                                self.db_header, self.db_matrix[index],
                                "")  # adding db to values
                        print(table_name)
                    else:
                        print("Db_GTZAN_function_" + str(wave_func) +
                              "_Degree_" + str(level) + ' passed')
            else:
                print(wave_func + " passed")