# set scan parameters globally for the qt phasing tool scan_range_global = 60.0 nb_steps = 21 nb_average = 10 wait_time = 0.1 stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01", "S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09", "S20CB01","S20CB02","S20CB03","S20CB04", "S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13", "SATCB01","STEST01") phase_start, phase_stop = {}, {} for station in stationlist: scan_range = 20 if station == "SINSB01" else scan_range_global Ph_Beam = caget(station + "-RSYS:SET-BEAM-PHASE") Ph_Vsum = caget(station + "-RSYS:SET-VSUM-PHASE") Ph_Offset = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE") while Ph_Vsum > 360: Ph_Vsum = Ph_Vsum - 360 Ph_Offset = Ph_Offset + 360 while Ph_Vsum < 0: Ph_Vsum = Ph_Vsum + 360 Ph_Offset = Ph_Offset - 360 caput(station + "-RSYS:SET-VSUM-PHASE", Ph_Vsum) caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", Ph_Offset) nominal_phase = 270 if station == "SINXB01" else 90 range_start = Ph_Vsum - scan_range / 2 + nominal_phase - Ph_Beam range_stop = Ph_Vsum + scan_range / 2 + nominal_phase - Ph_Beam if range_stop > 360: range_start = range_start - 360 range_stop = range_stop - 360 phase_start[station], phase_stop[station] = range_start, range_stop for station in stationlist: scan_range = 20 if station == "SINSB01" else scan_range_global caput(station + "-RSYS:SET-SCAN-START", phase_start[station]) caput(station + "-RSYS:SET-SCAN-STOP", phase_stop[station]) caput(station + "-RSYS:SET-SCAN-STEP", scan_range / (nb_steps - 1)) caput(station + "-RSYS:SET-NUM-AVERAGE", nb_average) caput(station + "-RSYS:SET-SCAN-WAIT-TIME", wait_time) caput(station + "-RSYS:PHASE-SET", 1) caput(station + "-RSYS:AMPLT-SET", 0) caput(station + "-RSYS:POWER-SET", 0)