def load_from_pa(self, pa): from app.settings import alg_win wins = [] for f in pa.alg['fkeys']: wins.append(alg_win[f]) win_data = '' for win in wins: win_data += self.WinSetting(**win).pack() self.enable = pa.enabled, self.mu_factor = sensitivitycompound(pa.digitalzoom), self.mode = pa.alg['mode'], self.win_size = len(wins), self.data = win_data
def load_from_pa(self, pa): self.enable = pa.enabled self.mu_factor = sensitivitycompound(pa.digitalzoom) self.mode = pa.alg['mode'] # pre_process_mode = 1 # photoelectron_valuee = 1 from app.settings import alg_win windows = [] for f in pa.alg['fkeys']: windows.append(alg_win[f]) self.win_size = 4 self.defence_start = pa.alg['defence_start'] self.defence_end = pa.alg['defence_end'] work_mode = 1 if pa.alg['alarm_workmode'] == u'ifpms_adaptation': work_mode = 0 elif pa.alg['alarm_workmode'] == u'ifpms_normal': work_mode = 1 elif pa.alg['alarm_workmode'] == u'ifpms_dector': work_mode = 2 elif pa.alg['alarm_workmode'] == u'ifpms_meansquare': work_mode = 3 # 下位机标准周界对应第一个窗口,自适应对应第二个窗口 if work_mode == 0 or work_mode == 2: setattr(self, 'begin2', windows[0]['begin']) setattr(self, 'end2', windows[0]['end']) setattr(self, 'noise2', windows[0]['noise']) if work_mode == 1: setattr(self, 'begin1', windows[0]['begin']) setattr(self, 'end1', windows[0]['end']) setattr(self, 'noise1', windows[0]['noise']) if work_mode == 3: # 下位机低频窗口noise由0变成5,高频窗口noise由0变成1,高频窗口 setattr(self, 'begin3', windows[0]['begin']) setattr(self, 'end3', windows[0]['end']) setattr(self, 'noise3', windows[0]['noise'] + 5) setattr(self, 'begin4', windows[1]['begin']) setattr(self, 'end4', windows[1]['end']) setattr(self, 'noise4', windows[1]['noise'] + 1) self.work_mode = work_mode self.sensitivity = pa.alg[pa.alg['alarm_workmode']][0]['sensitivity'] self.response_time = pa.alg[pa.alg['alarm_workmode']][0]['responsetime'] self.noise_immunity = pa.alg[pa.alg['alarm_workmode']][0]['ratio']