From 846a6d33cdabaa1a04b5d9854ac4559de346059e Mon Sep 17 00:00:00 2001 From: gac-x09lb Date: Mon, 28 Nov 2022 15:22:31 +0100 Subject: [PATCH] Closedown --- config/devices.properties | 2 +- config/variables.properties | 6 +++--- script/templates/Regine.py | 32 ++++++++++++++++++++++++-------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/config/devices.properties b/config/devices.properties index 5cdb2f7..85b56e7 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -5,5 +5,5 @@ sample_z=ch.psi.pshell.epics.Motor|X09LB-ES2-SMP:TRZ|||true dummy_x=ch.psi.pshell.device.DummyMotor||||true dummy_y=ch.psi.pshell.device.DummyMotor||||true #sample_r=ch.psi.pshell.epics.Motor|X09LB-ES3-SAMPLE:ROT1|||true -ccd=ch.psi.pshell.epics.AreaDetector|X09LB-ES2-CCD|||true +$ccd=ch.psi.pshell.epics.AreaDetector|X09LB-ES2-CCD|||true image=ch.psi.pshell.imaging.CameraSource|ccd|||true diff --git a/config/variables.properties b/config/variables.properties index 133e8a3..ff0ba36 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Wed Nov 23 13:20:10 CET 2022 +#Wed Nov 23 13:30:40 CET 2022 LastRunDate=221123 -DaySequentialNumber=17 -FileSequentialNumber=145 +DaySequentialNumber=20 +FileSequentialNumber=148 diff --git a/script/templates/Regine.py b/script/templates/Regine.py index e8f761b..920ea4a 100644 --- a/script/templates/Regine.py +++ b/script/templates/Regine.py @@ -12,6 +12,7 @@ NOISE (FLOAT) """ import random +position_plot = None if "POSITION_PLOT" not in globals() else POSITION_PLOT #Debugging if (get_exec_pars().args is None) and (get_exec_pars().script=="Regine"): @@ -27,32 +28,48 @@ if (get_exec_pars().args is None) and (get_exec_pars().script=="Regine"): SETTLING_TIME = 1.0 ZIGZAG = True COMPRESSION = False + position_plot=None + + +if not position_plot: position_plot=plot(None, title="Motor Positions")[0] + #Constants SENSORS = [current, ccd.dataMatrix] POSITIONERS = [dummy_x, dummy_y] if DRY_RUN else [sample_x, sample_y] -ENABLED_PLOTS = [current, ccd.dataMatrix] +ENABLED_PLOTS = [ccd.dataMatrix] CUSTOM_PLOT_TYPES = {ccd.dataMatrix:"ch.psi.pshell.plot.MatrixPlotRenderer"} RANGE_X=[CENTER_X - STEP_SIZE_X*STEPS_X, CENTER_X + STEP_SIZE_X*STEPS_X] RANGE_Y=[CENTER_Y - STEP_SIZE_Y*STEPS_Y, CENTER_Y + STEP_SIZE_Y*STEPS_Y] +position_plot.clear() +position_plot.addSeries(LinePlotSeries("positions")) +position_plot.getAxis(AxisId.X).label = POSITIONERS[0].name +position_plot.getAxis(AxisId.X).setRange(RANGE_X[0]-STEP_SIZE_X, RANGE_X[1]+STEP_SIZE_X) +position_plot.getAxis(AxisId.Y).label = POSITIONERS[1].name +position_plot.getAxis(AxisId.Y).setRange(RANGE_Y[0]-STEP_SIZE_Y, RANGE_Y[1]+STEP_SIZE_Y) + + +def after_read(record, scan): + after_readout() + position_plot.getSeries(0).appendData(record[POSITIONERS[0]], record[POSITIONERS[1]]) + + if EXPOSURES: - ENABLED_PLOTS = [ccd.dataMatrix] #Cannot plot current in 3d vscan POSITIONERS = POSITIONERS + [exposure_index()] SENSORS = SENSORS + [exposure()] RANGE_E=[0, len(EXPOSURES)-1] def gen(): x_index = y_index = e_index = 0 - for x_step in range(-STEPS_X, STEPS_X+1): - xpos = CENTER_X + x_step*STEP_SIZE_X + (random.random()-0.5)*NOISE*2*STEP_SIZE_X + for x_step in range(-STEPS_X, STEPS_X+1): range_y= range(STEPS_Y, -STEPS_Y-1, -1) if (ZIGZAG and(x_index%2 ==1)) else range(-STEPS_Y, STEPS_Y+1) for y_step in range_y: - ypos = CENTER_Y + y_step*STEP_SIZE_Y + (random.random()-0.5)*NOISE*2*STEP_SIZE_Y - + xpos = CENTER_X + x_step*STEP_SIZE_X + (random.random()-0.5)*NOISE*2*STEP_SIZE_X + ypos = CENTER_Y + y_step*STEP_SIZE_Y + (random.random()-0.5)*NOISE*2*STEP_SIZE_Y if EXPOSURES: range_e= range(len(EXPOSURES)-1,-1, -1) if (ZIGZAG and(y_index%2 ==1)) else range(len(EXPOSURES)) for e in range_e: @@ -62,12 +79,11 @@ def gen(): y_index=y_index+1 x_index=x_index+1 - try: r = vscan(POSITIONERS, SENSORS , gen(), False,\ SETTLING_TIME, relative=False, zigzag = ZIGZAG, initial_move=False, \ - before_read=before_readout, after_read = after_readout, \ + before_read=before_readout, after_read = after_read, \ manual_range=RANGE_X, manual_range_y=RANGE_Y, \ compression = COMPRESSION, enabled_plots=ENABLED_PLOTS, \ keep=False, check_positions=False, plot_types=CUSTOM_PLOT_TYPES)