import ch.psi.pshell.epics.ControlledVariable as ControlledVariable #Easy script to read the camtool camera data and save it # #CAMERA = "S10DI01-DSCR020" #"simulation" #CAMERA = "SINDI02-DLAC055" #"simulation" #CAMERA = "S10BD01-DSCR030" #"simulation" CAMERA = "SINDI01-DSCR080" #"simulation" #CAMERA = "SINEG01-DSCR190" #"simulation" #QUADRUPOLE = "S10CB02-MQUA230" # quadrupole for the scan with S10DI01-DSCR020: S10CB02-MQUA230 CHARGE_BPM = "SINDI01-DBPM060:Q1" CHARGE_ICT = "S10DI01-DICT025:B1_CHARGE-OP" WirePos = "SINDI01-DWSC090:MOTOR_1.RBV" #RANGE = (-3.0, 0.0) #STEPS = 100 #SETTLING_TIME = 1 #kill_camtool() check_camtool() print camtool.getCameras() #camtool.start("SINBD01-DSCR010") camtool.start(CAMERA) camtool.stream.waitCacheChange(10000) print camtool.value.identifiers #plot(camtool.getValue("y_fit_gauss_function")) m=camtool.getDataMatrix() x = camtool.stream.getChild("x_fit_mean") y = camtool.stream.getChild("y_fit_mean") x_profile = camtool.stream.getChild("x_profile") y_profile = camtool.stream.getChild("y_profile") x_axis = camtool.stream.getChild("x_axis") y_axis = camtool.stream.getChild("y_axis") """ 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") wcs = Channel(WirePos, 'd', alias = "Wire position") #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 (camtool.stream, m, 10) #Saves 10 next frames -> For machine at 10 -> 100Hz #tscan(m, 10, 0.2) # 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 (camtool.stream,(m, x, y), -1, 5.0) #Saves all frames received in 5s #mscan (camtool.stream,(m, x, y), 50) # Saves firs 50 frames #lscan(quad, (m, x, y), RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME) #readables = camtool.stream.getReadables().clone() + [bpm, ict] #readables.remove(camtool.stream.getChild("image")) #readables.insert(0,m) # lscan(quad, readables, RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME) #tscan((m, x_profile, y_profile, x_axis, y_axis, bpm, wcs), 10, 1.0) #Saves 10 samples waiting 1.0 s between them tscan((m, x_profile, y_profile, x_axis, y_axis, bpm, wcs), 10, 1) finally: # quad.close() camtool.stop()