def __fillTable(self, useLocal: bool = False): self.__setUiToDefault() if not useLocal: self.tracks.clear() self.tracks = u.readFiles(self.paths) count = 1 for tr in self.tracks: self.ui.tableItems.insertRow(self.ui.tableItems.rowCount()) row = self.ui.tableItems.rowCount() - 1 self.ui.tableItems.setItem(row, 0, NumericTableWidgetItem(count)) self.ui.tableItems.setItem(row, 1, QTableWidgetItem(tr.filename)) self.ui.tableItems.setItem(row, 2, QTableWidgetItem(tr.data["title"])) self.ui.tableItems.setItem(row, 3, QTableWidgetItem(tr.data["artist"])) self.ui.tableItems.setItem(row, 4, QTableWidgetItem(tr.data["album"])) self.ui.tableItems.setItem( row, 5, NumericTableWidgetItem(tr.data["track"])) self.ui.tableItems.setItem(row, 6, QTableWidgetItem(tr.data["date"])) self.ui.tableItems.setItem(row, 7, QTableWidgetItem(tr.data["comment"])) count += 1 self.ui.tableItems.sortItems(0)
from sys import argv, exit import sys sys.path.append('src') import pandas as pd import numpy as np from matplotlib import pyplot as plt from graph import Graph from utils import readFiles if __name__ == '__main__': vertexes, edges, cities_df, cities_new_cases = readFiles() # Treinando o algoritimo. graph = Graph(vertexes, edges, cities_df, cities_new_cases) n_steps = 105 city = 3168804 # Tiradentes accumulated_curve = [] for i in range(len(cities_new_cases[city])): if i == 0: accumulated_curve.append(cities_new_cases[city][0]) else: accumulated_curve.append(cities_new_cases[city][i] + accumulated_curve[i - 1]) # executa o projeção novamente com os pesos que ajustaram a curva melhor # para cada um dos set de parâmetros. max_pred = 0 df_sets = pd.read_csv('datasets/best_set.csv')
required=True, help='input training matrix data') # parser.add_argument('--chrN', type=int, required=True, help='chromosome used to train') #parser.add_argument('--output_filename', type=str, help='where to save the output image') # parser.add_argument('--scale_factor', type=float, required=True, help='factor by which resolution needed') #parser.add_argument('--cuda', action='store_true', help='use cuda') opt = parser.parse_args() print(opt) #use_cuda = opt.cuda #if use_cuda and not torch.cuda.is_available(): # raise Exception("No GPU found, please run without --cuda") infile = opt.input_file # chrN = opt.chrN # scale = opt.scale_factor highres = utils.readFiles(infile, chrs_length[chrN - 1] / input_resolution + 1, input_resolution) highres_sub, index = utils.divide(highres, chrN) print(highres_sub.shape) np.save(infile + "highres", highres_sub) lowres = utils.genDownsample(highres, 1 / float(scale)) lowres_sub, index = utils.divide(lowres, chrN) print(lowres_sub.shape) np.save(infile + "lowres", lowres_sub) #trainConvNet.train(lowres_sub,highres_sub)
INPUT_AUDIO_DIR = args.INPUT_AUDIO_DIR SAMPLES = args.SAMPLES MIN_DUR = args.MIN_DUR MAX_DUR = args.MAX_DUR AMP_THESHOLD = args.AMP_THESHOLD PLOT = args.PLOT > 0 HIGHLIGHT = args.HIGHLIGHT SAVE_DATA = args.SAVE_DATA > 0 OUTPUT_FILE = args.OUTPUT_FILE # Audio config FFT = 2048 HOP_LEN = FFT/4 # Read files fileGroups, files = readFiles(INPUT_FILES, INPUT_AUDIO_DIR) fileCount = len(files) hasGroups = len(fileGroups) > 1 print("Found %s files" % fileCount) # Make sure output dirs exist outDirs = [os.path.dirname(OUTPUT_FILE)] for outDir in outDirs: if not os.path.exists(outDir): os.makedirs(outDir) # snatched from: https://github.com/ml4a/ml4a-guides/blob/master/notebooks/audio-tsne.ipynb def getFeatures(y, sr): # y = y[0:sr] # analyze just first second S = librosa.feature.melspectrogram(y, sr=sr, n_mels=128) log_S = librosa.amplitude_to_db(S, ref=np.max)
HiC_max_value = 100 chrs_length = [ 195471971, 182113224, 160039680, 156508116, 151834684, 149736546, 145441459, 129401213, 124595110, 130694993, 122082543, 120129022, 120421639, 124902244, 104043685, 98207768, 94987271, 90702639, 61431566 ] delimiter = opt.delimiter expRes = 10000 ## need to make resolution adjustable. length = chrs_length[chrN - 1] / expRes # divide the input matrix into sub-matrixes. inputMatrix = utils.readFiles(input_file, length + 1, expRes, delimiter) print("inputMatrix is symmetric?") print(is_symmetric(inputMatrix)) compareMatrix = utils.readFiles(compare_matrix, length + 1, expRes, delimiter) print("compareMatrix is symmetric?") print(is_symmetric(compareMatrix)) low_resolution_samples, index = utils.divide(inputMatrix, chrN) low_resolution_samples = np.minimum( HiC_max_value, low_resolution_samples ) # why use HiC_max_value, in this way, low_resolution_samples will not change. batch_size = low_resolution_samples.shape[0] #256 # batch_size=256