This commit is contained in:
voulot_d
2017-06-07 15:05:42 +02:00
parent a6733e4cc5
commit d2155f810c
8 changed files with 82 additions and 64 deletions

View File

@@ -1,13 +1,13 @@
#Wed Jun 07 10:46:57 CEST 2017
#Wed Jun 07 14:45:43 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=1000.0
colormapMin=10.0
colormapMax=300.0
colormapMin=1.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=1024
imageWidth=1280
imageHeight=2160
imageWidth=2560
invert=false
regionStartX=1
regionStartY=1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-50.03909304143862
spatialCalOffsetY=-50.048875855327466
spatialCalScaleX=-1.0
spatialCalScaleY=-1.0
spatialCalOffsetX=-971.5790174628223
spatialCalOffsetY=-612.4991815322336
spatialCalScaleX=-8.510638533281156
spatialCalScaleY=-8.235816743984502
spatialCalUnits=mm
transpose=false

View File

@@ -1,5 +1,5 @@
#Wed Jun 07 10:56:09 CEST 2017
defaultSpeed=141.4213562373095
#Wed Jun 07 14:12:02 CEST 2017
defaultSpeed=282.842712474619
estbilizationDelay=0
hasEnable=false
homingType=None

View File

@@ -1,4 +1,4 @@
#Wed Jun 07 10:19:49 CEST 2017
#Wed Jun 07 11:34:07 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=578.797
@@ -18,9 +18,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=-50.03909304143862
spatialCalOffsetY=-50.048875855327466
spatialCalScaleX=-1.0
spatialCalScaleY=-1.0
spatialCalOffsetX=-161.48788305646764
spatialCalOffsetY=-158.49842396964675
spatialCalScaleX=-14.255081084280302
spatialCalScaleY=-13.524936230776813
spatialCalUnits=mm
transpose=false

View File

@@ -138,7 +138,6 @@
<Component class="javax.swing.JButton" name="buttonGrabBackground">
<Properties>
<Property name="text" type="java.lang.String" value="Grab Background"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGrabBackgroundActionPerformed"/>

View File

@@ -567,7 +567,6 @@ public class ScreenPanel extends Panel {
System.out.println("Setting camera: " + cameraName + " [" + (buttonCamtool.isSelected() ? "camtool" : "direct") + "]");
parseUserOverlays();
errorOverlay = null;
buttonGrabBackground.setEnabled(false);
checkBackground.setEnabled(false);
spinnerThreshold.setEnabled(false);
checkThreshold.setEnabled(false);
@@ -649,10 +648,11 @@ public class ScreenPanel extends Panel {
}
spinnerThreshold.setEnabled(true);
checkThreshold.setEnabled(true);
buttonGrabBackground.setEnabled(true);
((Camtool) camera).startReceiver();
} else {
checkBackground.setEnabled(true);
checkBackground.setSelected(false);
if (polling <= 0) {
camera.setMonitored(true);
} else {
@@ -1391,7 +1391,7 @@ public class ScreenPanel extends Panel {
}
void setLaserState(boolean value) throws Exception {
System.out.println( "Setting laser state: " + value);
Epics.putq("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", value ? 0 : 1);
Epics.putq("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1);
Thread.sleep(3000);
@@ -1805,7 +1805,6 @@ public class ScreenPanel extends Panel {
});
buttonGrabBackground.setText("Grab Background");
buttonGrabBackground.setEnabled(false);
buttonGrabBackground.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonGrabBackgroundActionPerformed(evt);
@@ -2603,27 +2602,40 @@ public class ScreenPanel extends Panel {
private void buttonGrabBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGrabBackgroundActionPerformed
try {
if ((camera != null) && (camera instanceof Camtool)) {
if (camera != null) {
if (SwingUtils.showOption(getTopLevel(), "Background", "Do you want to capture background now?", OptionType.YesNo) == OptionResult.Yes) {
boolean laserOn = getLaserState();
boolean rendering = (!camera.isClosed());
if (rendering) {
camera.close();
}
if (laserOn) {
setLaserState(false);
}
try {
System.out.println("Grabbing background for: " + cameraName);
((Camtool) camera).grabBackground(cameraName, 5);
} finally {
if (laserOn) {
setLaserState(true);
}
if (camera instanceof Camtool){
boolean rendering = (!camera.isClosed());
if (rendering) {
comboCamerasActionPerformed(null);
camera.close();
}
if (laserOn) {
setLaserState(false);
}
try {
System.out.println("Grabbing background for: " + cameraName);
((Camtool) camera).grabBackground(cameraName, 5);
} finally {
if (laserOn) {
setLaserState(true);
}
if (rendering) {
comboCamerasActionPerformed(null);
}
updateStop();
}
} else {
if (laserOn) {
setLaserState(false);
}
try {
camera.captureBackground(5, 0);
} finally {
if (laserOn) {
setLaserState(true);
}
}
updateStop();
}
SwingUtils.showMessage(getTopLevel(), "Success", "Success capturing background", 5000);
}
@@ -2813,21 +2825,25 @@ public class ScreenPanel extends Panel {
}//GEN-LAST:event_spinnerThresholdonChange
private void checkBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBackgroundActionPerformed
if (updatingCamtoolControls) {
return;
}
try {
if ((camera instanceof Camtool) && (((Camtool) camera).isPipelineStarted())) {
((Camtool) camera).setBackgroundSubtraction(checkBackground.isSelected());
if (camera instanceof Camtool){
if (updatingCamtoolControls) {
return;
}
} catch (Exception ex) {
showException(ex);
updateCamtoolControls();
//There is a bug in camtool: it will flag bg extraction as on:
updatingCamtoolControls = true;
checkBackground.setSelected(false);
updatingCamtoolControls = false;
try {
if (((Camtool) camera).isPipelineStarted()) {
((Camtool) camera).setBackgroundSubtraction(checkBackground.isSelected());
}
} catch (Exception ex) {
showException(ex);
updateCamtoolControls();
//There is a bug in camtool: it will flag bg extraction as on:
updatingCamtoolControls = true;
checkBackground.setSelected(false);
updatingCamtoolControls = false;
}
} else {
camera.setBackgroundEnabled(checkBackground.isSelected());
}
}//GEN-LAST:event_checkBackgroundActionPerformed

View File

@@ -11,7 +11,7 @@ ATTENUATORS = ["SINDI02-DBLM084:M06-1-ATT2-VAL", "SINDI02-DBLM084:M06-2-ATT2-VAL
RANGE = [0.5, 1.1]
STEP_SIZE = 0.01
SETTLING_TIME = 0.5
SIMULATION = True
SIMULATION = False
do_elog = True

View File

@@ -4,22 +4,22 @@ import ch.psi.pshell.epics.DiscretePositioner as DiscretePositioner
#Arguments
SAMPLES = 20
GAINS = ["SINDI02-DBLM084:M06-1-CH03-V-MM","SINDI02-DBLM084:M06-1-CH03-V-MM2",]
SAMPLES = 40
GAINS = ["SINDI02-DBLM084:M06-1-CH03-V-MM","SINDI02-DBLM084:M06-2-CH03-V-MM","S10DI01-DBLM113:M06-1-CH03-V-MM"]
BLMS = ["SINDI02-DBLM025", "SINDI02-DBLM085", "S10DI01-DBLM045"]
BPMS = ["SINDI01-DBPM060:Q1", "SINDI02-DBPM010:Q1"]
ATTENUATORS = ["SINDI02-DBLM084:M06-1-ATT2-VAL", "SINDI02-DBLM084:M06-2-ATT2-VAL", "S10DI01-DBLM113:M06-1-ATT2-VAL"]
RANGE = [0.5, 1.1]
STEP_SIZE = 0.01
STEP_SIZE = 0.1
SETTLING_TIME = 0.5
SIMULATION = True
SIMULATION = False
do_elog = True
gain_positioners = []
for i in range(len(GAINS)):
gain_positioners.append( DummyPositioner("gain " + str(i+1)) if SIMULATION else Channel(GAINS[i], alias = "gain " + str(i+1)))
gain_positioners.append( DummyPositioner("gain " + str(i+1)) if SIMULATION else Channel(GAINS[i], alias = "gain " + str(i+1)))
attenuators = []
for i in range(len(ATTENUATORS)):
att = DiscretePositioner("Att"+str(i+1), ATTENUATORS[i])
@@ -37,8 +37,9 @@ for i in range(len(ATTENUATORS)):
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 10, 0)
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 1, 0)
av = create_averager(blm, SAMPLES, interval = -1)
av.setMonitored(i>0)
sensors.append(av)
@@ -52,13 +53,15 @@ for i in range(len(BLMS)):
for i in range(len(BPMS)):
bpm = Scalar("bpm" + str(i+1), st, BPMS[i], 10, 0)
bpm = Scalar("bpm" + str(i+1), st, BPMS[i], 1, 0)
av1 = create_averager(bpm, SAMPLES, interval = -1)
av1.setMonitored(i>0)
sensors.append(av1)
sensors.append(av1.stdev)
sensors.append(av1.samples)
line_plots.append(av1.samples)
#Scalar("beam_ok" , st, "SIN-CVME-TIFGUN-EVR0:BEAMOK" , 1, 0)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
@@ -90,7 +93,7 @@ for att in attenuators:
try:
r=lscan(gain_positioners, sensors, [RANGE[0],] * len(gain_positioners), [RANGE[1],] * len(gain_positioners), [STEP_SIZE,] * len(gain_positioners), latency = SETTLING_TIME)
#r=bscan(st, 10)
finally:
st.close()

View File

@@ -5,8 +5,8 @@ import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
#CAMERA = "S10DI01-DSCR020" #"simulation"
#CAMERA = "SINDI02-DLAC055" #"simulation"
CAMERA = "S10BD01-DSCR030" #"simulation"
#CAMERA = "SINDI01-DSCR080" #"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"
@@ -81,7 +81,7 @@ try:
#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), 20, 0.11)
tscan((m, x_profile, y_profile, x_axis, y_axis, bpm, wcs), 10, 1)
finally:
# quad.close()
camtool.stop()