import ch.psi.pshell.epics.ControlledVariable as ControlledVariable CAMERA = "S10DI01-DSCR020" #CAMERA = "SINDI02-DLAC055" QUADRUPOLE = "S10CB01-MQUA430" # quadrupole for the scan with S10DI01-DSCR020: S10CB02-MQUA230 CHARGE_BPM = "SINEG01-DBPM340:Q1" CHARGE_ICT = "SINEG01-DICT215:B1_CHARGE-OP" RANGE = (-0.485, 1.515) STEPS = 100 SETTLING_TIME = 0.1 print cam_server.cameras cam_server.start(CAMERA) wait_cam_server_message() print cam_server.value.identifiers m=cam_server.getDataMatrix() x = cam_server.stream.getChild("x_fit_mean") y = cam_server.stream.getChild("y_fit_mean") """ ax = create_averager(x, 5, -1, "X Fit") ay = create_averager(y, 5, -1, "Y Fit") ay.monitored = True """ set_device_alias(m,"image") #Create quadrupole device quad = ControlledVariable(QUADRUPOLE, QUADRUPOLE + ":I-SET", QUADRUPOLE + ":I-READ") quad.config.minValue =-10.0 quad.config.maxValue = 10.0 quad.config.precision = 3 quad.config.resolution = 0.007 quad.config.save() quad.initialize() bpm = Channel(CHARGE_BPM, 'd', alias = "Charge BPM") ict = Channel(CHARGE_ICT, 'd', alias = "Charge ICT") #Metadata try: set_attribute("/", "Camera", CAMERA) set_attribute("/", "Quadrupole", QUADRUPOLE) set_attribute("/", "Scan Parameters", RANGE + (STEPS,)) set_attribute("/", "Screen Position", caget(CAMERA + ":GET_SCREEN1_POS", 's')) set_attribute("/", "Filter Position", caget(CAMERA + ":GET_FILTER", 's')) except: pass try: laser_off() #save_dataset("/Background", m.read()) #mscan (cam_server.stream, m, 10) #Saves 10 next frames -> For machine at 10 -> 100Hz tscan(m, 10, 1.0) # 10 samples every 0.2 s -> For machine at 1Hz laser_on() #tscan((m, x, y), 10, 1.0) # 10 samples every 1.0 s #mscan (cam_server.stream,(m, x, y), -1, 5.0) #Saves all frames received in 5s #mscan (cam_server.stream,(m, x, y), 50) # Saves firs 50 frames #lscan(quad, (m, x, y), RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME) readables = cam_server.stream.getReadables().clone() + [bpm, ict] readables.remove(cam_server.stream.getChild("image")) readables.insert(0,m) lscan(quad, readables, RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME) finally: quad.close() cam_server.stop()