def analyze(self, analyzer, config, save=True): """ Function analyzing all files of the dataset. Each file is dealt with as a Recording object, created, analyzed and saved. See Recording.analyze for more info. """ if self._verbatim > 0: print('\n\n *** DATASET ANALYSIS ***') tStartGlobal = time.time() for file_path in self.files: recording = Recording(file_path, config, verbatim=self._verbatim) tStart = time.time() recording.analyze(analyzer, config) tEnd = time.time() if self._verbatim > 1: print('\tRecording has been analyzed', file_path, tEnd - tStart) if save: recording.save(config) if self._verbatim > 1: print('\tRecording has been saved') tEndGlobal = time.time() if self._verbatim > 0: print('Dataset has been analyzed', tEndGlobal - tStartGlobal) return
def makeDecision(self, config, save=True): """ Function making the decision upon the predicted probas from analyze method. Each file is dealt with as a Recording object, created, loaded, decisions are made, and saved again. See Recording.makeDecision for more info. """ if self._verbatim > 0: print( '\n\n *** DATASET ANALYSIS: MAKING DECISION ON PREDICTIONS ***' ) tStartGlobal = time.time() for file_path in self.files: recording = Recording(file_path, config, verbatim=self._verbatim) recording.load(config) tStart = time.time() recording.makeDecision(config) tEnd = time.time() if save: recording.save(config) if self._verbatim > 1: print( '\tRecording has been re-analyzed: decisions on predictions have been made', file_path, tEnd - tStart) tEndGlobal = time.time() if self._verbatim > 0: print( 'Dataset has been re-analyzed: decisions on predictions have been made', tEndGlobal - tStartGlobal) return
return not any([c == '/' for c in name]) if __name__ == '__main__': recording = None path = DEFAULT_RECORD_PATH while True: user_input = input() if user_input == 'r': if recording is None: recording = Recording() track = recording.create_track() track.record() elif user_input == 'p': if recording.playing: recording.play() else: recording.pause() elif user_input == 's': recording.save() elif user_input == 't': user_input = input() recording = 0.0 if user_input == '' else float(user_input) elif user_input == 'o': recording = Recording.open()