nbatch=int(args.nelementsperfile) randomise = args.randomise dc = DataCollection(infile) dc2 = DataCollection(infile) samples = dc.samples dir = dc.dataDir if len(dir)<1: dir='.' insamples = [dir+'/'+s for s in samples] gen = TrainDataGenerator() gen.setBatchSize(nbatch) gen.setSkipTooLargeBatches(False) gen.setFileList(insamples) if randomise: gen.shuffleFileList() nbatches = gen.getNBatches() newsamples=[] for i in range(nbatches): newname = str(samples[0][:-6]+"_n_"+str(i)+".djctd") newsamples.append(newname) ntd = gen.getBatch() print(newname) ntd.writeToFile(newname) print('..written')
def invokeGenerator(self): generator = TrainDataGenerator() generator.setBatchSize(self.__batchsize) generator.setSquaredElementsLimit(self.batch_uses_sum_of_squares) generator.setFileList([self.dataDir + "/" + s for s in self.samples]) return generator