def svd_eofs(feature_vectors, number_of_vectors_to_keep=15, show_lambdas=0): # Should be using svd_eofs.SVDEOFs here z, lambdas, EOFs = svdeofs.svdeofs(feature_vectors) if show_lambdas: my_show.show(lambdas) return (z[:, :number_of_vectors_to_keep], lambdas)
def add_files(self, files_string, accepted_extensions=None, maximum=None): """Initialize sound structures from directory or from glob. For example: add_files("/data/music/*/*") Only the files that have accepted_extensions are taken from the files that fulfill the pattern. Doesn't handle ~ directories yet. returns a list of the newly created or already existing structures """ from glob import glob new_structures = [] accepted_extensions = accepted_extensions or self.accepted_extensions files_string = os.path.expanduser(files_string) # expand tilde if os.path.split(files_string)[1]: files = glob(files_string) # find files files = filter( lambda x: os.path.splitext(x)[1] in accepted_extensions, files) # keep only files with accepted extensions print len(files), "files to add:" show(files) print for file in files: new_structures.append(self.add_file(file)) if maximum and len(new_structures) >= maximum: break return new_structures else: files = glob(files_string + "/*") # find files files = filter( lambda x: os.path.splitext(x)[1] in accepted_extensions, files) # keep only files with accepted extensions print len(files), "files in directory, none processed" return files
def show(self): timefunc = lambda t: str(int(t[0])) + ":" + str(int(t[1] * 10) / 10.) my_show.show(map(lambda x: (timefunc(divmod(x.time(), 60)) + " " + str(x[1]) + " " +str(x[2])), self))
def show(self): my_show.show(self.shape1d())
def show(self): my_show.show(self.shape() * self.a)
def show(self): my_show.show(self.R, title = self.source.name + " - " + self.name)
def show(self): my_show.show(transpose(self.shape() * self.a))
def show(self): my_show.show(transpose(self.feature_vectors), title=self.source.name + " - " + self.name)