def on_search(self, data): t, T1, T2 = self.collector.get_actual_temperature(2 * EXT_STAB_TIME) targets = [self.state.settings["USB"]["T1set"], self.state.settings["USB"]["T2set"]] if not logic.check_stability(t, [T1, T2], targets, EXT_STAB_TIME): return new_range = logic.search(data) if new_range is None: return print "New search range", new_range bot, top = new_range if top - bot > 10: setter = lambda x: self.state.update("USB", ("DIL_T", x)) step = max(1, SEARCH_STEP * (bot - top) / (SEARCH_BOT - SEARCH_TOP)) dt = INT_STAB_RATE * step logic.init_search(bot, top, step, dt, setter) else: mid = int((bot + top) / 2) self.state.update("USB", ("DIL_T", mid)) self.state.update("PCIE", ("framecount", 1000)) print "Setting DIL_T to %d" % mid self.start_PFGIT_scan(True, 25000) self.scannerWidget.accurateScan.blockSignals(True) self.scannerWidget.accurateScan.setChecked(True) self.scannerWidget.accurateScan.blockSignals(False) self.status = "preparing_scan"
def on_wait(self, data): t, T1, T2 = self.collector.get_actual_temperature(2 * EXT_STAB_TIME) targets = [self.state.settings["USB"]["T1set"], self.state.settings["USB"]["T2set"]] if logic.check_stability(t, [T1, T2], targets, EXT_STAB_TIME): self.status = "searching" self.state.update("PCIE", ("framecount", 200)) print "Searching" middle = (self.state.settings["TimeScanner"]["top"] + self.state.settings["TimeScanner"]["bottom"]) / 2 self.state.update("USB", ("PFGI_TscanAmp", middle)) setter = lambda x: self.state.update("USB", ("DIL_T", x)) dt = INT_STAB_RATE * SEARCH_STEP / 3 logic.init_search(SEARCH_BOT, SEARCH_TOP, SEARCH_STEP, dt, setter)
from os import listdir from os.path import isfile, join import logic as l if __name__ == "__main__": path = '/home/oberon/vidz/train/' file_list = [ f for f in listdir(path) if isfile(join(path, f)) and f.split('.')[-1] == 'mp4' ] for fname in file_list: l.init_search(path + fname, fname)