diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties
index 76720cb..0e98b33 100644
--- a/devices/CurrentCamera.properties
+++ b/devices/CurrentCamera.properties
@@ -1,19 +1,19 @@
-#Sun Sep 23 23:38:05 CEST 2018
+#Thu Sep 27 11:01:54 CEST 2018
\u0000=
\u0000\u0000\u0000\u0000=
colormap=Flame
colormapAutomatic=true
colormapLogarithmic=false
-colormapMax=40000.0
-colormapMin=98.0
+colormapMax=5000.0
+colormapMin=42.0
flipHorizontally=false
flipVertically=false
grayscale=false
-imageHeight=2160
-imageWidth=2560
+imageHeight=1200
+imageWidth=1920
invert=false
-regionStartX=1
-regionStartY=1
+regionStartX=0
+regionStartY=0
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -24,10 +24,10 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=null
-spatialCalOffsetX=-1285.5021743822372
-spatialCalOffsetY=-1063.492325271727
-spatialCalScaleX=-17.12279119040641
-spatialCalScaleY=-17.316017253358037
+spatialCalOffsetX=-93.53143059339158
+spatialCalOffsetY=-95.47500121434692
+spatialCalScaleX=-8.673880440848214
+spatialCalScaleY=-8.839778747558594
spatialCalUnits=null
t=
transpose=false
diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties
index d2e00c0..249006a 100644
--- a/devices/WireScanner motor.properties
+++ b/devices/WireScanner motor.properties
@@ -1,12 +1,12 @@
-#Mon Sep 24 08:33:00 CEST 2018
-defaultSpeed=707.1067811865476
+#Thu Sep 27 13:33:31 CEST 2018
+defaultSpeed=6000.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=8000.0
maxValue=68500.0
minSpeed=50.0
-minValue=-47600.0
+minValue=-57027.0
offset=0.0
precision=1
resolution=0.1
diff --git a/devices/cam_server.properties b/devices/cam_server.properties
index 1080e02..1358b96 100644
--- a/devices/cam_server.properties
+++ b/devices/cam_server.properties
@@ -1,4 +1,4 @@
-#Sat Sep 22 11:42:58 CEST 2018
+#Thu Sep 27 07:12:40 CEST 2018
colormap=Flame
colormapAutomatic=true
colormapLogarithmic=false
@@ -17,9 +17,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
-spatialCalOffsetX=-109.42248161877063
-spatialCalOffsetY=-133.52987980134057
-spatialCalScaleX=-17.122791378997093
-spatialCalScaleY=-17.3160171812749
+spatialCalOffsetX=0.0
+spatialCalOffsetY=0.0
+spatialCalScaleX=1.0
+spatialCalScaleY=1.0
spatialCalUnits=mm
transpose=false
diff --git a/devices/positioner.properties b/devices/positioner.properties
index 3d7d8c5..d452287 100644
--- a/devices/positioner.properties
+++ b/devices/positioner.properties
@@ -1,4 +1,4 @@
-#Tue Sep 05 14:28:32 CEST 2017
+#Thu Sep 27 07:12:39 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
@@ -6,4 +6,5 @@ precision=-1
resolution=NaN
rotation=false
scale=1.0
+sign_bit=0
unit=null
diff --git a/plugins/WireScan.form b/plugins/WireScan.form
index b007898..4030cea 100644
--- a/plugins/WireScan.form
+++ b/plugins/WireScan.form
@@ -71,11 +71,12 @@
+
-
+
@@ -111,7 +112,10 @@
-
+
+
+
+
@@ -147,7 +151,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -178,7 +193,7 @@
-
+
@@ -245,7 +260,7 @@
-
+
@@ -253,6 +268,13 @@
+
+
+
+
+
+
+
@@ -310,7 +332,7 @@
-
+
@@ -420,10 +442,10 @@
-
+
-
+
@@ -517,12 +539,12 @@
-
+
-
+
-
+
@@ -628,6 +650,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/WireScan.java b/plugins/WireScan.java
index 55a3819..e56e62b 100644
--- a/plugins/WireScan.java
+++ b/plugins/WireScan.java
@@ -139,6 +139,14 @@ public class WireScan extends Panel {
}
onStateChange(getState(), getState());
panelRepRate.getDevice().update();
+
+ double rr = (Double)panelRepRate.getDevice().take();
+ int points = (Integer)spinnerPoints.getValue();
+ double velocity_x = Math.abs((Double)spinnerEndX.getValue()-(Double)spinnerStartX.getValue())*rr/points;
+ labelVelX.setText(String.format("%1.1f", velocity_x));
+ double velocity_y = Math.abs((Double)spinnerEndY.getValue()-(Double)spinnerStartY.getValue())*rr/points;
+ labelVelY.setText(String.format("%1.1f", velocity_y));
+
} catch (Exception ex){
}
}
@@ -159,10 +167,10 @@ public class WireScan extends Panel {
for (JComboBox cb : blmCombos){
cb.setEnabled(validWireScan);
}
- buttonMotorPanel.setEnabled(validWireScan);
+ buttonCalibration.setEnabled(validWireScan);
buttonScannerPanel.setEnabled(validWireScan);
buttonHoming.setEnabled(validWireScan);
- spinnerVel.setEnabled(validWireScan && !isBackground());
+ spinnerPoints.setEnabled(validWireScan && !isBackground());
spinnerCycles.setEnabled(validWireScan && !isBackground());
spinnerStartX.setEnabled(validWireScan && isX());
spinnerEndX.setEnabled(spinnerStartX.isEnabled());
@@ -351,7 +359,7 @@ public class WireScan extends Panel {
panelPosition = new ch.psi.pshell.swing.DeviceValuePanel();
comboBlm2 = new javax.swing.JComboBox();
comboBpm3 = new javax.swing.JComboBox();
- spinnerVel = new javax.swing.JSpinner();
+ spinnerPoints = new javax.swing.JSpinner();
buttonRaw2 = new javax.swing.JButton();
comboBlm3 = new javax.swing.JComboBox();
comboWireScanner = new javax.swing.JComboBox();
@@ -367,7 +375,7 @@ public class WireScan extends Panel {
spinnerStartX = new javax.swing.JSpinner();
jLabel13 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
- buttonMotorPanel = new javax.swing.JButton();
+ buttonCalibration = new javax.swing.JButton();
labelPosX = new javax.swing.JLabel();
spinnerBackground = new javax.swing.JSpinner();
buttonHoming = new javax.swing.JButton();
@@ -384,6 +392,10 @@ public class WireScan extends Panel {
buttonScannerPanel = new javax.swing.JButton();
jLabel21 = new javax.swing.JLabel();
spinnerBunch = new javax.swing.JSpinner();
+ jLabel23 = new javax.swing.JLabel();
+ labelVelX = new javax.swing.JLabel();
+ jLabel24 = new javax.swing.JLabel();
+ labelVelY = new javax.swing.JLabel();
plot.setTitle("");
@@ -401,7 +413,7 @@ public class WireScan extends Panel {
jLabel14.setText("Pos y (µm):");
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel8.setText("Vel (µm/s):");
+ jLabel8.setText("Points:");
buttonScan.setText("Scan");
buttonScan.addActionListener(new java.awt.event.ActionListener() {
@@ -471,7 +483,7 @@ public class WireScan extends Panel {
}
});
- spinnerVel.setModel(new javax.swing.SpinnerNumberModel(200.0d, 1.0d, 10000.0d, 1.0d));
+ spinnerPoints.setModel(new javax.swing.SpinnerNumberModel(200, 1, 10000, 1));
buttonRaw2.setText("Raw Signal");
buttonRaw2.addActionListener(new java.awt.event.ActionListener() {
@@ -524,10 +536,10 @@ public class WireScan extends Panel {
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel11.setText("Pos mot (µm):");
- buttonMotorPanel.setText("Motor Panel");
- buttonMotorPanel.addActionListener(new java.awt.event.ActionListener() {
+ buttonCalibration.setText("Calibration");
+ buttonCalibration.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonMotorPanelActionPerformed(evt);
+ buttonCalibrationActionPerformed(evt);
}
});
@@ -586,6 +598,18 @@ public class WireScan extends Panel {
spinnerBunch.setModel(new javax.swing.SpinnerNumberModel(1, 1, 2, 1));
+ jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel23.setText("Vel x (µm/s):");
+
+ labelVelX.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ labelVelX.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
+
+ jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel24.setText("Vel y (µm/s):");
+
+ labelVelY.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ labelVelY.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
+
javax.swing.GroupLayout panelLeftLayout = new javax.swing.GroupLayout(panelLeft);
panelLeft.setLayout(panelLeftLayout);
panelLeftLayout.setHorizontalGroup(
@@ -611,11 +635,12 @@ public class WireScan extends Panel {
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerPoints, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStartX)
.addComponent(spinnerStartY))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -645,7 +670,9 @@ public class WireScan extends Panel {
.addGroup(panelLeftLayout.createSequentialGroup()
.addGap(98, 98, 98)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(panelLeftLayout.createSequentialGroup()
+ .addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE))
.addGroup(panelLeftLayout.createSequentialGroup()
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(comboBlm3, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -676,21 +703,29 @@ public class WireScan extends Panel {
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonHoming, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScannerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonMotorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
+ .addComponent(buttonCalibration, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addGroup(panelLeftLayout.createSequentialGroup()
+ .addComponent(labelVelX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel24)
+ .addGroup(panelLeftLayout.createSequentialGroup()
+ .addGap(98, 98, 98)
+ .addComponent(labelVelY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
.addGap(0, 0, 0))
);
- panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel15, jLabel16, jLabel17, jLabel18, jLabel19, jLabel2, jLabel20, jLabel21, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel15, jLabel16, jLabel17, jLabel18, jLabel19, jLabel2, jLabel20, jLabel21, jLabel23, jLabel24, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY});
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonParkAll, buttonScan});
- panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCalibration, buttonScannerPanel});
- panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition, panelRepRate});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, labelVelX, labelVelY, panelPosition, panelRepRate});
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBackground, spinnerCycles, spinnerEndX, spinnerEndY});
- panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBunch, spinnerStartX, spinnerStartY, spinnerVel});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBunch, spinnerPoints, spinnerStartX, spinnerStartY});
panelLeftLayout.setVerticalGroup(
panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -710,7 +745,7 @@ public class WireScan extends Panel {
.addComponent(spinnerCycles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
- .addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addComponent(spinnerPoints, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerBackground, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -765,12 +800,18 @@ public class WireScan extends Panel {
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel13)
.addComponent(labelPosX)
- .addComponent(buttonMotorPanel))
+ .addComponent(buttonCalibration))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel14)
.addComponent(labelPosY))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(jLabel23)
+ .addComponent(labelVelX)
+ .addComponent(jLabel24)
+ .addComponent(labelVelY))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel15)
.addComponent(panelRepRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -794,9 +835,9 @@ public class WireScan extends Panel {
.addGap(0, 0, 0))
);
- panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {labelPosX, labelPosY, labelVelX, labelVelY, panelPosition});
- panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerBunch, spinnerStartX, spinnerStartY, spinnerVel});
+ panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerBunch, spinnerPoints, spinnerStartX, spinnerStartY});
panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerCycles, spinnerEndX, spinnerEndY});
@@ -850,7 +891,7 @@ public class WireScan extends Panel {
comboBlm2.setSelectedItem((ret==null) ? "" : ret.get(1));
int selection = Epics.get(currentScannner + ":WIRE_SP", Integer.class);
//comboSelection.setSelectedIndex(selection); //TODO: FIX
- spinnerVel.setValue(Epics.get(currentScannner + ":SCAN_VELO_SP", Double.class));
+ //spinnerPoints.setValue(Epics.get(currentScannner + ":SCAN_VELO_SP", Double.class));
spinnerCycles.setValue(Epics.get(currentScannner + ":NB_CYCL_SP", Integer.class));
Device scannerInfo = (Device)eval("new_scan_info_device(None, '" + currentScannner+ "')", true);
setGlobalVar("scanner_info", scannerInfo);
@@ -940,7 +981,7 @@ public class WireScan extends Panel {
range.add(spinnerEndY.getValue());
parameters.add(range);
parameters.add(spinnerCycles.getValue());
- parameters.add(spinnerVel.getValue());
+ parameters.add(spinnerPoints.getValue());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (cb.getSelectedItem()!=null && (!cb.getSelectedItem().toString().isEmpty())){
@@ -1021,14 +1062,19 @@ public class WireScan extends Panel {
//String caqtdm = "caqtdm -noMsg -stylefile sfop.qss -attach";
String caqtdm = "caqtdm -noMsg -stylefile sfop.qss";
- private void buttonMotorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMotorPanelActionPerformed
+ ch.psi.pshell.core.Plugin calibrationPlugin;
+ private void buttonCalibrationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCalibrationActionPerformed
try {
- String cmd = caqtdm + " -macro 'P=" + comboWireScanner.getSelectedItem() + ":,M=MOTOR_1' /sf/common/config/qt/motorx_all.ui";
- Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
+ //String cmd = caqtdm + " -macro 'P=" + comboWireScanner.getSelectedItem() + ":,M=MOTOR_1' /sf/common/config/qt/motorx_all.ui";
+ //Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});false WireScanCalibration.java
+ if (calibrationPlugin!=null){
+ getContext().getPluginManager().unloadPlugin(calibrationPlugin);
+ }
+ calibrationPlugin = getContext().getPluginManager().loadInitializePlugin(getContext().getSetup().expandPath("{plugins}/WireScanCalibration.java"));
} catch (Exception ex) {
showException(ex);
}
- }//GEN-LAST:event_buttonMotorPanelActionPerformed
+ }//GEN-LAST:event_buttonCalibrationActionPerformed
private void buttonScannerPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScannerPanelActionPerformed
try {
@@ -1091,8 +1137,8 @@ public class WireScan extends Panel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
+ private javax.swing.JButton buttonCalibration;
private javax.swing.JButton buttonHoming;
- private javax.swing.JButton buttonMotorPanel;
private javax.swing.JButton buttonMoveStart;
private javax.swing.JButton buttonPark;
private javax.swing.JButton buttonParkAll;
@@ -1123,6 +1169,8 @@ public class WireScan extends Panel {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
+ private javax.swing.JLabel jLabel23;
+ private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
@@ -1134,6 +1182,8 @@ public class WireScan extends Panel {
private javax.swing.JLabel labelPosX;
private javax.swing.JLabel labelPosY;
private javax.swing.JLabel labelStartY;
+ private javax.swing.JLabel labelVelX;
+ private javax.swing.JLabel labelVelY;
private ch.psi.pshell.swing.Led ledHomed;
private javax.swing.JPanel panelLeft;
private ch.psi.pshell.swing.DeviceValuePanel panelPosition;
@@ -1145,8 +1195,8 @@ public class WireScan extends Panel {
private javax.swing.JSpinner spinnerCycles;
private javax.swing.JSpinner spinnerEndX;
private javax.swing.JSpinner spinnerEndY;
+ private javax.swing.JSpinner spinnerPoints;
private javax.swing.JSpinner spinnerStartX;
private javax.swing.JSpinner spinnerStartY;
- private javax.swing.JSpinner spinnerVel;
// End of variables declaration//GEN-END:variables
}
diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py
index 397d080..fefc095 100755
--- a/script/Alignment/Gun_solenoid_alignment.py
+++ b/script/Alignment/Gun_solenoid_alignment.py
@@ -17,7 +17,7 @@ camera_name = "simulation" if dry_run else "SINEG01-DSCR190"
bpm_name = "SINEG01-DBPM340"
use_good_region=False
magnets = ["SINEG01-MCRX120","SINEG01-MCRY120",
- "SINEG01-MQUA140","SINEG01-MQUA150",
+ "SINEG01-MQUA140","SINEG01-MQSK150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180"]
diff --git a/script/Alignment/Laser_gun_alignment.py b/script/Alignment/Laser_gun_alignment.py
index c1cf08e..218d8c5 100755
--- a/script/Alignment/Laser_gun_alignment.py
+++ b/script/Alignment/Laser_gun_alignment.py
@@ -5,7 +5,7 @@
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
- # cycle the gun soleoid
+ # cycle the gun solenoid
# increase gun phase by 60 deg - RF focussing
# look at the centroid position (BPM or screen) downstream of the gun.
@@ -18,7 +18,7 @@ camera_name = "simulation" if dry_run else "SINEG01-DSCR190"
bpm_name = "SINEG01-DBPM340"
use_good_region=False
magnets = ["SINEG01-MCRX120","SINEG01-MCRY120",
- "SINEG01-MQUA140","SINEG01-MQUA150",
+ "SINEG01-MQUA140","SINEG01-MQSK150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180"]
diff --git a/script/Devices/WireScanner.py b/script/Devices/WireScanner.py
index dd6a023..b24915d 100644
--- a/script/Devices/WireScanner.py
+++ b/script/Devices/WireScanner.py
@@ -149,10 +149,10 @@ class WireScanner(WireScanInfo):
self.range = None
self.start = None
self.end = None
- self.scan_range = scan_range;
+ self.scan_range = scan_range
if velocity is not None:
- self.wire_velocity.write(float(velocity))
+ self.set_velocity(velocity)
if cycles is not None:
self.nb_cycles.write(int(cycles))
if continuous is not None:
@@ -165,7 +165,17 @@ class WireScanner(WireScanInfo):
#def on_readback_change(self, val):
# self.readback = val
-
+
+ def set_velocity(self, velocity):
+ self.wire_velocity.write(float(velocity))
+ self.velocity = self.wire_velocity.get()
+
+ def set_travel_velocity(self):
+ tv = self.travel_velocity.read()
+ self.set_velocity(tv/math.sqrt(2))
+ self.motor.speed=(tv)
+
+
def set_selection(self, sel):
if not sel in WireScanner.Selection:
raise Exception("Invalid Wire Scan selection: " + str(sel))
@@ -183,6 +193,10 @@ class WireScanner(WireScanInfo):
if sel in ["W1Y", "W2Y"]: self.start.write(float(self.scan_range[2]))
if sel in ["W1X", "W2X"]: self.end.write(float(self.scan_range[1]))
if sel in ["W1Y", "W2Y"]: self.end.write(float(self.scan_range[3]))
+ print "Sel: ", sel
+ print "Range: ", self.scan_range
+ print "Scan start: ", self.start.read()
+ print "End start: ", self.end.read()
def abort(self):
diff --git a/script/Diagnostics/WireScan.py b/script/Diagnostics/WireScan.py
index 7fc2f86..8e18f3a 100644
--- a/script/Diagnostics/WireScan.py
+++ b/script/Diagnostics/WireScan.py
@@ -8,14 +8,15 @@ run("Devices/Elements")
run("Devices/WireScanner")
run("Diagnostics/sig_process_wrapper")
-set_exec_pars(layout="default")
+#set_exec_pars(layout="default")
#Paramter parsing
-prefix = args[0] if has_args else "S10DI01-DWSC010" #"S10CB07-DWSC440" #"SINDI01-DWSC090"
+prefix = args[0] if has_args else SINDI01-DWSC090 # "S10DI01-DWSC010" #"S10CB07-DWSC440" #"SINDI01-DWSC090"
scan_type = args[1] if has_args else WireScanner.WireX1
-scan_range = args[2] if has_args else [-1000, 1000, -1000, 1000]
+scan_range = args[2] if has_args else []
cycles = args[3] if has_args else 2
-velocity = args[4] if has_args else 200
+#velocity = args[4] if has_args else 200
+n_shot = args[4] if has_args else 200
bpms = args[5] if has_args else [] #get_wire_scanners_bpms(prefix)
blms = args[6] if has_args else get_wire_scanners_blms(prefix)
bkgrd = args[7] if has_args else 10
@@ -25,7 +26,8 @@ bunch = args[10] if has_args else 1
do_elog = True if (has_args and (not is_script) and (plt is not None)) else False
print has_args, do_elog
-print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, velocity, bpms, blms, bkgrd, bunch
+print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, n_shot, bpms, blms, bkgrd, bunch
+
SET_BLM_WS_MODE = True
SET_BLM_WS_SETTLING_TIME = 2.0
@@ -47,11 +49,29 @@ if plt is not None:
plt.setLegendVisible(True);
snapshots = []
+if scan_range is None or len(scan_range) !=4:
+ if scan_type in [WireScanner.WireX2, WireScanner.WireY2, WireScanner.Set2]:
+ scan_range = [ caget(prefix+":W2X_START_SP", 'd'), \
+ caget(prefix+":W2X_END_SP", 'd'), \
+ caget(prefix+":W2Y_START_SP", 'd'), \
+ caget(prefix+":W2Y_END_SP", 'd') ]
+ else:
+ scan_range = [ caget(prefix+":W1X_START_SP", 'd'), \
+ caget(prefix+":W1X_END_SP", 'd'), \
+ caget(prefix+":W1Y_START_SP", 'd'), \
+ caget(prefix+":W1Y_END_SP", 'd') ]
+
+
+rr = get_repetition_rate()
+velocity_x = abs(scan_range[1]-scan_range[0])*rr/n_shot
+velocity_y = abs(scan_range[3]-scan_range[2])*rr/n_shot
+
+
#Creating WireScanner object
print "Creating scanner..."
if prefix not in get_wire_scanners():
raise Exception("Invalid wire scan: " + prefix)
-scanner = WireScanner(prefix, scan_range, cycles, velocity, True)
+scanner = WireScanner(prefix, scan_range, cycles, None, True)
#List of stream channels
channels = [("m_pos", scanner.motor_bs_readback.get_name()),
@@ -81,8 +101,11 @@ set_attribute("/", "Wire Scanner", prefix)
set_attribute("/", "Scan Type", scan_type)
set_attribute("/", "Range", scan_range)
set_attribute("/", "Cycles", cycles)
-set_attribute("/", "Motor Velocity", velocity*math.sqrt(2))
-set_attribute("/", "Wire Velocity", velocity)
+set_attribute("/", "Scan Points", n_shot)
+set_attribute("/", "Motor Velocity X", velocity_x*math.sqrt(2))
+set_attribute("/", "Wire Velocity X", velocity_x)
+set_attribute("/", "Motor Velocity Y", velocity_y*math.sqrt(2))
+set_attribute("/", "Wire Velocity Y", velocity_y)
set_attribute("/", "Background Measures", bkgrd)
set_attribute("/", "BPMs", bpms)
set_attribute("/", "BLMs", blms)
@@ -119,9 +142,12 @@ class w_pos(Readable):
#End of scan checking
scan_complete, cur_cycle, wire = None, None, None
+rec =None
def check_end_scan(record, scan):
global scan_complete,cur_cycle
+ global rec
+ rec = record
if record[4]<1:
print "Data aquisition completed"
scan_complete=True
@@ -148,14 +174,18 @@ def do_background():
for i in range(len(r.getReadables())):
d = r.getReadable(i)
try:
- path = get_exec_pars().group + "/"+ r.getReadables()[i].name
+ path = get_exec_pars().group + "/data/"+ r.getReadables()[i].name
set_attribute(path, "Mean", mean(d))
set_attribute(path, "Sigma", stdev(d) )
except:
pass
-def set_blm_gain(scan_type):
+def set_blm_gain(scan_type, index):
if SET_BLM_WS_MODE and len(blms)>0:
+ if scan_type == WireScanner.Set1:
+ scan_type = (WireScanner.WireX1 if index == 0 else WireScanner.WireY1)
+ if scan_type == WireScanner.Set2:
+ scan_type = (WireScanner.WireX2 if index == 0 else WireScanner.WireY2)
cfg_gain = get_setting(blms[0] + "GainWs" + scan_type)
print "cfg_gain = " , cfg_gain
if cfg_gain is not None:
@@ -168,7 +198,12 @@ def set_blm_gain(scan_type):
def do_scan(index):
global scan_complete, cur_cycle, wire
wire = "y" if (index==1) or (scan_type in [WireScanner.WireY1, WireScanner.WireY2]) else "x"
- set_exec_pars(group=wire+"_{count}", reset=True)
+ if wire == "x":
+ scanner.set_velocity(velocity_x)
+ else:
+ scanner.set_velocity(velocity_y)
+
+ set_exec_pars(group=wire+"_{count}", reset=True)
scanner.set_selection(get_scan_selection(scan_type, index))
if plt is not None:
if wire == "x":
@@ -177,7 +212,7 @@ def do_scan(index):
plt.getAxis(plt.AxisId.X).setRange(scan_range[2], scan_range[3])
- set_blm_gain(scan_type)
+ set_blm_gain(scan_type, index)
scanner.init(wait=True)
scanner.curr_cycl.write(0)
@@ -197,8 +232,9 @@ def do_scan(index):
#mscan (st, [w_pos(),] + st.getReadables() + [Timestamp(),], -1, -1, take_initial = True, after_read = check_end_scan)
l=[w_pos()] ; l.extend(st.getReadables()); l.append(Timestamp())
+ print "Start scan"
mscan (st, l, -1, -1, take_initial = True, after_read = check_end_scan)
-
+ print "End scan"
#tscan([w_pos()] + st.getReadables() + [Timestamp(),], 10, 0.5)
except:
print sys.exc_info()[1]
@@ -213,12 +249,15 @@ def do_scan(index):
#indexes = sorted(range(len(s.x)),key=lambda x:s.x[x])
#x,y = [s.x[x] for x in indexes], [s.y[x] for x in indexes]
#plot(y, xdata = x)
+ print "Calculating"
calculate()
+ print "Ok"
img_file = os.path.abspath(filename + "_" + get_exec_pars().group[0:1] + ".png")
time.sleep(0.1) #Give some time to plot finish (async)
if plt is not None:
plt.saveSnapshot(img_file, "png")
snapshots.append(img_file)
+ print "Finished"
msg = ""
ret = []
@@ -228,13 +267,16 @@ def calculate():
for i in range(len(blms)):
msg += "Wire " + wire + " - BLM " + str(i+1) + ":\n"
try:
- bg = get_attributes("background/blm" + str(i+1))["Mean"] if bkgrd>0 else 0.0
+ bg = get_attributes("background/data/blm" + str(i+1))["Mean"] if bkgrd>0 else 0.0
samples = [[], [], [], [], [], []]
for cycle in range (cycles):
- pos_path = wire+"_" + ("%04d" % (cycle+1)) + "/w_pos"
- pos = load_data(pos_path)
- path = wire+"_" + ("%04d" % (cycle+1)) + "/blm" + str(i+1)
- data = load_data(path)
+ pos_path = wire+"_" + ("%04d" % (cycle+1)) + "/data/w_pos"
+ print "Loading ", pos_path
+ pos = load_data(pos_path+"/value")
+ path = wire+"_" + ("%04d" % (cycle+1)) + "/data/blm" + str(i+1)
+ print "Loading ", path
+ data = load_data(path+"/value")
+ print "OK"
sp = data #blm_remove_spikes(data)
sig = sp if bg is None else [v-bg for v in sp]
@@ -261,7 +303,7 @@ def calculate():
#g = Gaussian(amp, com, sigma)
#gauss = [g.value(v)+off for v in pos]
#plot([data, sp, sig, gauss], ["data", "sp", "signal", "gauss", ], xdata = pos, title="Fit blm" + str(i+1) + " - " + str(cycle+1))
- ret.extend([rms_com, rms_sigma, com, sigma, get_exec_pars().path + "|"+ pos_path, get_exec_pars().path + "|"+ path])
+ ret.extend([rms_com, rms_sigma, com, sigma, filename + "|"+ pos_path +"/value", filename + "|"+ path +"/value"])
stats.append([])
for sample in samples:
@@ -307,14 +349,14 @@ def calculate():
def get_scan_time():
- global bkgrd, scan_type, scan_range, velocity
- _range = 0
+ global bkgrd, scan_type, scan_range, velocity_x, velocity_y
+ ret = 0
if not scan_type in [WireScanner.WireY1, WireScanner.WireY2]:
- _range += abs(scan_range[0] - scan_range[1]) #X SCAN
+ ret += abs(scan_range[0] - scan_range[1])/velocity_x #X SCAN
if not scan_type in [WireScanner.WireX1, WireScanner.WireX2]:
- _range += abs(scan_range[2] - scan_range[3]) #Y SCAN
- ret = _range / velocity
+ ret += abs(scan_range[2] - scan_range[3])/velocity_y #Y SCAN
ret += 2.0 #ACC/DEC
+ ret *= cycles
ret += bkgrd * (1.0/get_repetition_rate()) #BACK
print "Scan time = " + str(ret),
ret = ret * 2.0 + 10.0 #Tolernces
@@ -355,7 +397,9 @@ if do_elog:
log_msg = log_msg + "\nScan Type: " + str(scan_type)
log_msg = log_msg + "\nRange: " + str(scan_range)
log_msg = log_msg + "\nCycles: " + str(cycles)
- log_msg = log_msg + "\nWire Velocity: " + str(velocity)
+ log_msg = log_msg + "\nScan Points: " + str(n_shot)
+ log_msg = log_msg + "\nWire Velocity X: " + str(velocity_x)
+ log_msg = log_msg + "\nWire Velocity Y: " + str(velocity_y)
log_msg = log_msg + "\nBackground Measures: " + str(bkgrd)
log_msg = log_msg + "\nBPMs: " + str(bpms)
log_msg = log_msg + "\nBLMs: " + str(blms)
@@ -365,4 +409,5 @@ if do_elog:
elog("Wire Scan", log_msg, snapshots)
set_exec_pars(open=False)
+print ret
set_return(ret)
\ No newline at end of file
diff --git a/script/Diagnostics/WireScanCalibration.py b/script/Diagnostics/WireScanCalibration.py
index baa4550..ec3041b 100644
--- a/script/Diagnostics/WireScanCalibration.py
+++ b/script/Diagnostics/WireScanCalibration.py
@@ -6,8 +6,6 @@ run("Devices/Elements")
run("Devices/WireScanner")
run("Diagnostics/sig_process_wrapper")
-set_exec_pars(layout="default")
-
###################################################################################################
# Arguments and constants
###################################################################################################
@@ -66,15 +64,14 @@ print "Setting gain=", initial_gain
#Calculate speed
x_min, x_max = range_start, range_end
-rr = get_repetition_rate()
-ws_speed = (x_max- x_min)*rr/n_shot
-args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, ws_speed, [], [ws_blm], 10, plt, False,1]
+#rr = get_repetition_rate()
+#ws_speed = (x_max- x_min)*rr/n_shot
+args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, n_shot, [], [ws_blm], 10, plt, False,1]
ret = run("Diagnostics/WireScan", args)
[rms_com, rms_sigma, com, sigma, pos_path, path] = ret
-
###################################################################################################
# Optimize gain
###################################################################################################
@@ -82,14 +79,19 @@ print "--------------- Optimize gain --------------- "
-start_blm_ws(ws_blm, 600.0)
+#Need 30s for 25Hz at full gain range. Have a 2x factor.
+start_blm_ws(ws_blm, 2*7.5*(100/get_repetition_rate()))
ws_info = WireScanInfo("ws_info", ws_prefix )
motor_pos= ws_info.get_motor_pos(com, ws_wire)
set_status("Setting motor position to COM...")
+caput(ws_prefix+":MOTOR_1.VELO", caget(ws_prefix + ":TRAVEL_VELO_SP"))
caput(ws_prefix+":MOTOR_1.VAL", motor_pos) #DVAL?
+
+
+
print "Starting stream..."
set_status("Creating stream for gain search..." )
@@ -102,6 +104,14 @@ st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
+def change_blm_ws_gain(gain):
+ set_gain(gain)
+ #stop_blm_ws(ws_blm)
+ #st.getChild("blm1_ws_mode").waitValue(0, SET_BLM_WS_BS_READBACK_TIMEOUT)
+ #start_blm_ws(ws_blm, 600.0)
+ #st.getChild("blm1_ws_mode").waitValue(1, SET_BLM_WS_BS_READBACK_TIMEOUT)
+ time.sleep(0.25)
+
def get_loss():
global ch
samples = []
@@ -109,8 +119,11 @@ def get_loss():
st.waitCacheChange(-1)
val = st.getValue(ch)
samples.append(val)
+ samples.remove(max(samples))#Remove max value
return max(samples)
+change_blm_ws_gain(MIN_GAIN)
+time.sleep(2.0)
start_gain = get_gain()
pos = start_val = get_loss()
@@ -122,13 +135,7 @@ print "Start Loss = ", start_val
print "Target = ", target
set_status("Searching gain to match peak losses of " + str(target) + "...")
-def change_blm_ws_gain(gain):
- set_gain(gain)
- stop_blm_ws(ws_blm)
- st.getChild("blm1_ws_mode").waitValue(0, SET_BLM_WS_BS_READBACK_TIMEOUT)
- start_blm_ws(ws_blm, 600.0)
- st.getChild("blm1_ws_mode").waitValue(1, SET_BLM_WS_BS_READBACK_TIMEOUT)
- time.sleep(0.1)
+
try:
@@ -138,8 +145,8 @@ try:
loss = get_loss()
print "Pos = ", pos, " Loss = ", loss
if loss>=target:
- break
- stop_blm_ws(ws_blm)
+ break
+ #stop_blm_ws(ws_blm)
finally:
stop_blm_ws(ws_blm)
@@ -169,10 +176,9 @@ print "--------------- Optimize scan range --------------- "
set_status("Performing scan with optimal gain to define optimal range..." )
#caget(ws_blm+":SAT_RAW_SUM")
-args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, ws_speed, [], [ws_blm], 10, plt, False,1]
+args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, n_shot, [], [ws_blm], 10, plt, False,1]
[rms_com, rms_sigma, com, sigma, pos_path, path] = run("Diagnostics/WireScan", args)
-
x_range_min, x_range_max = com - scan_range_factor * sigma, com + scan_range_factor * sigma
print "Optimized range: " , x_range_min , " to " , x_range_max
set_wire_scan_range(ws_wire, x_range_min, x_range_max)
diff --git a/script/RFscan/GunEnergyScanNew.py b/script/RFscan/GunEnergyScanNew.py
index 66083f8..70fca56 100644
--- a/script/RFscan/GunEnergyScanNew.py
+++ b/script/RFscan/GunEnergyScanNew.py
@@ -44,7 +44,7 @@ plt.setLegendVisible(True)
#Creating Phase positioner
if dry_run:
phase = Positioner("Gun Phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
- camera_name = "simulation"
+ camera_name = "S10MA01-DSCR090" #"simulation"
else:
phase = Positioner("Gun Phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
camera_name = "SINBD01-DSCR010"
@@ -67,11 +67,12 @@ x = cam_server.stream.getChild("x_center_of_mass")
dx = cam_server.stream.getChild("x_rms")
cam_server.setThreshold(500)
#cam_server.captureBackground(10) #Capturing background
-cam_server.setBackgroundSubtraction(True)
-cam_server.setRoi([144,1431,482,706]) #X, Y, W, H
+cam_server.setBackgroundSubtraction(False)
+#cam_server.setRoi([144,1431,482,706]) #X, Y, W, H # something wrong thereto be fixed
#Creating averagers
x_averager = create_averager(x, nb, -1) # -1 event based, waits for the next value
+#x_averager.monitored = True # not blocking, will return last nb values
dx_averager = create_averager(dx, nb, -1)
dx_averager.monitored = True # not blocking, will return last nb values
diff --git a/script/local.py b/script/local.py
index e3d7aaf..dc1ae2c 100755
--- a/script/local.py
+++ b/script/local.py
@@ -50,13 +50,13 @@ def switch_off_magnets(magnets = None):
if magnets is None:
magnets = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140",
- "SINEG01-MQUA150",
+ "SINEG01-MQSK150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
- "SINEG01-MQUA320" ]
+ "SINEG01-MQSK320" ]
magnets = to_list(magnets)
for m in magnets:
caput(m + ":I-SET", 0.0)