This commit is contained in:
sfop
2017-05-09 11:32:08 +02:00
parent 412c99fe64
commit 06f3fdeca3
12 changed files with 589 additions and 287 deletions

View File

@@ -1,7 +1,7 @@
#Fri May 05 16:45:24 CEST 2017
#Tue May 09 10:15:56 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=0.0
colormapAutomatic=false
colormapMax=15000.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-529.5211875760955
spatialCalOffsetY=-459.5027453531823
spatialCalScaleX=-7.617446794181035
spatialCalScaleY=-7.774538405753697
spatialCalOffsetX=-649.4689449397814
spatialCalOffsetY=-522.5163272053469
spatialCalScaleX=-8.737659608697616
spatialCalScaleY=-8.83489815158259
spatialCalUnits=mm
transpose=false

8
devices/Gain.properties Normal file
View File

@@ -0,0 +1,8 @@
#Tue May 09 10:48:37 CEST 2017
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
scale=1.0
unit=null

View File

@@ -0,0 +1,6 @@
#Tue May 09 11:22:13 CEST 2017
positions=null
precision=-1
readback_pv=null
setpoint_pv=null
stop_pv=null

View File

@@ -1,12 +1,12 @@
#Fri May 05 16:27:17 CEST 2017
defaultSpeed=282.842712474619
#Mon May 08 17:19:11 CEST 2017
defaultSpeed=6000.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=8000.0
maxValue=51500.0
minSpeed=50.0
minValue=-56789.2
minValue=-57027.0
offset=0.0
precision=1
resolution=0.1

View File

@@ -0,0 +1,8 @@
#Tue May 09 11:08:01 CEST 2017
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
scale=1.0
unit=null

View File

@@ -0,0 +1,8 @@
#Tue May 09 11:08:29 CEST 2017
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
scale=1.0
unit=null

View File

@@ -18,113 +18,117 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="buttonPark" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonMoveStart" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonScan" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel11" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="buttonScan" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelPosition" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="labelPosX" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="labelPosY" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="panelPosition1" linkSize="4" min="-2" pref="92" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledHomed" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel11" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelPosition" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="labelPosX" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="labelPosY" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="panelPosition1" linkSize="4" min="-2" pref="92" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledHomed" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonHoming" max="32767" attributes="0"/>
<Component id="buttonScannerPanel" linkSize="3" alignment="0" max="32767" attributes="0"/>
<Component id="buttonMotorPanel" linkSize="3" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonHoming" max="32767" attributes="0"/>
<Component id="buttonScannerPanel" linkSize="3" alignment="0" max="32767" attributes="0"/>
<Component id="buttonMotorPanel" linkSize="3" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel3" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel6" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel10" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="labelStartY" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel18" alignment="1" max="32767" attributes="0"/>
</Group>
<Component id="jLabel4" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel5" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel16" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel17" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel20" alignment="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel2" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel3" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel6" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel10" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="labelStartY" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel18" alignment="1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboWireScanner" alignment="0" max="32767" attributes="0"/>
<Component id="comboScanType" max="32767" attributes="0"/>
<Component id="comboBpm3" alignment="0" max="32767" attributes="0"/>
<Component id="comboBpm1" max="32767" attributes="0"/>
<Component id="comboBpm2" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm3" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm2" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStartY" linkSize="8" max="32767" attributes="0"/>
<Component id="panelStatus" min="-2" pref="324" max="-2" attributes="0"/>
</Group>
<Component id="jLabel4" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel5" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel16" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel17" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel20" alignment="0" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboWireScanner" alignment="0" max="32767" attributes="0"/>
<Component id="comboScanType" max="32767" attributes="0"/>
<Component id="comboBpm3" alignment="0" max="32767" attributes="0"/>
<Component id="comboBpm1" max="32767" attributes="0"/>
<Component id="comboBpm2" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm3" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm2" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStartY" linkSize="8" max="32767" attributes="0"/>
<Component id="panelStatus" min="-2" pref="324" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="spinnerVel" linkSize="8" min="-2" pref="104" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel9" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="spinnerStartX" linkSize="8" max="32767" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel7" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel19" min="-2" max="-2" attributes="0"/>
<Component id="labelEndY" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="spinnerVel" linkSize="8" min="-2" pref="104" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel9" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="spinnerStartX" linkSize="8" max="32767" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel7" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel19" min="-2" max="-2" attributes="0"/>
<Component id="labelEndY" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerEndX" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerEndY" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerBackground" linkSize="7" alignment="1" min="-2" pref="104" max="-2" attributes="0"/>
<Component id="spinnerCycles" linkSize="7" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerEndX" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerEndY" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerBackground" linkSize="7" alignment="1" min="-2" pref="104" max="-2" attributes="0"/>
<Component id="spinnerCycles" linkSize="7" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Component id="jLabel8" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jLabel8" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="154" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonPark" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="buttonParkAll" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="buttonMoveStart" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="plot" pref="430" max="32767" attributes="0"/>
<EmptySpace min="11" pref="11" max="-2" attributes="0"/>
</Group>
@@ -236,11 +240,15 @@
<Component id="panelStatus" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonPark" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonParkAll" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPark" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="plot" max="32767" attributes="0"/>
@@ -542,5 +550,13 @@
<Property name="text" type="java.lang.String" value="Wire Scanner:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonParkAll">
<Properties>
<Property name="text" type="java.lang.String" value="ParkAll"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonParkAllActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -12,19 +12,14 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import java.awt.BorderLayout;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
*
@@ -144,11 +139,12 @@ public class WireScan extends Panel {
boolean validWireScan = isValidScanner();
buttonMoveStart.setEnabled((state==State.Ready) && validWireScan && homed);
buttonPark.setEnabled((state==State.Ready) && validWireScan && homed);
buttonParkAll.setEnabled(state==State.Ready);
buttonScan.setEnabled((state==State.Ready) && validWireScan && homed);
buttonAbort.setEnabled(state==State.Busy);
comboScanType.setEnabled(validWireScan);
for (JComboBox cb : bpmCombos){
cb.setEnabled(validWireScan);
cb.setEnabled(validWireScan && !isBackground());
}
for (JComboBox cb : blmCombos){
cb.setEnabled(validWireScan);
@@ -156,15 +152,12 @@ public class WireScan extends Panel {
buttonMotorPanel.setEnabled(validWireScan);
buttonScannerPanel.setEnabled(validWireScan);
buttonHoming.setEnabled(validWireScan);
spinnerVel.setEnabled(validWireScan);
spinnerCycles.setEnabled(validWireScan);
int type = comboScanType.getSelectedIndex();
boolean isX = (type==0) || (type==2) || (type>=4);
boolean isY = (type==1) || (type==3) || (type>=4);
spinnerStartX.setEnabled(validWireScan && isX);
spinnerEndX.setEnabled(validWireScan && isX);
spinnerStartY.setEnabled(validWireScan && isY);
spinnerEndY.setEnabled(validWireScan && isY);
spinnerVel.setEnabled(validWireScan && !isBackground());
spinnerCycles.setEnabled(validWireScan && !isBackground());
spinnerStartX.setEnabled(validWireScan && isX());
spinnerEndX.setEnabled(spinnerStartX.isEnabled());
spinnerStartY.setEnabled(validWireScan && isY());
spinnerEndY.setEnabled(spinnerStartY.isEnabled());
}
@Override
@@ -210,16 +203,57 @@ public class WireScan extends Panel {
}
int getWireSet(){
int i = comboScanType.getSelectedIndex();
switch (i){
case 2:
case 3:
case 5:
switch (comboScanType.getSelectedIndex()){
case 0: case 1: case 4:
return 1;
case 2: case 3: case 5:
return 2;
}
return 1;
}
return 0;
}
boolean isSet(){
switch (comboScanType.getSelectedIndex()){
case 4: case 5:
return true;
}
return false;
}
boolean isSet1(){
switch (comboScanType.getSelectedIndex()){
case 0: case 1: case 4:
return true;
}
return false;
}
boolean isX(){
switch (comboScanType.getSelectedIndex()){
case 0: case 2: case 4: case 5:
return true;
}
return false;
}
boolean isY(){
switch (comboScanType.getSelectedIndex()){
case 1: case 3: case 4: case 5:
return true;
}
return false;
}
boolean isBackground(){
switch (comboScanType.getSelectedIndex()){
case 6: case 7:
return true;
}
return false;
}
void updatePosition(Double value){
if (value!=null && !Double.isNaN((Double)value)){
try {
@@ -290,6 +324,7 @@ public class WireScan extends Panel {
jLabel19 = new javax.swing.JLabel();
spinnerBackground = new javax.swing.JSpinner();
jLabel20 = new javax.swing.JLabel();
buttonParkAll = new javax.swing.JButton();
comboWireScanner.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -439,104 +474,114 @@ public class WireScan extends Panel {
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel20.setText("Wire Scanner:");
buttonParkAll.setText("ParkAll");
buttonParkAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonParkAllActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPark)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addComponent(jLabel13)
.addComponent(jLabel14)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(buttonScan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel11)
.addComponent(jLabel13)
.addComponent(jLabel14)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.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)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.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)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboWireScanner, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9))
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerStartX)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel7))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel19)
.addComponent(labelEndY))))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerEndX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerEndY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerCycles, javax.swing.GroupLayout.Alignment.TRAILING))))))
.addComponent(jLabel8))
.addGap(0, 0, 0)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboWireScanner, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9))
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerStartX)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel7))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel19)
.addComponent(labelEndY))))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerEndX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerEndY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerCycles, javax.swing.GroupLayout.Alignment.TRAILING)))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(154, 154, 154))
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPark)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonParkAll)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonMoveStart)
.addGap(0, 0, 0)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
.addGap(11, 11, 11))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonParkAll, buttonScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
@@ -634,10 +679,13 @@ public class WireScan extends Panel {
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)
.addComponent(buttonPark)
.addComponent(buttonMoveStart)
.addComponent(buttonPark)))
.addComponent(buttonParkAll))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -714,13 +762,13 @@ public class WireScan extends Panel {
private void comboScanTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboScanTypeActionPerformed
try {
int type = comboScanType.getSelectedIndex();
boolean isSet = (type>=4);
boolean isSet1 = (type==0) || (type==1) || (type==4);
spinnerStartX.setValue(Epics.get(currentScannner + (isSet1 ? ":W1X" : ":W2X") + "_START_SP", Double.class));
spinnerEndX.setValue(Epics.get(currentScannner + (isSet1 ? ":W1X" : ":W2X") + "_END_SP", Double.class));
spinnerStartY.setValue(Epics.get(currentScannner + (isSet1 ? ":W1Y" : ":W2Y") + "_START_SP", Double.class));
spinnerEndY.setValue(Epics.get(currentScannner + (isSet1 ? ":W1Y" : ":W2Y") + "_END_SP", Double.class));
if (!isBackground()){
boolean set1 = isSet1();
spinnerStartX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_START_SP", Double.class));
spinnerEndX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_END_SP", Double.class));
spinnerStartY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_START_SP", Double.class));
spinnerEndY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_END_SP", Double.class));
}
} catch (Exception ex) {
showException(ex);
}
@@ -733,54 +781,76 @@ public class WireScan extends Panel {
}//GEN-LAST:event_comboScanTypeActionPerformed
private void buttonScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList range = new ArrayList();
range.add(spinnerStartX.getValue());
range.add(spinnerEndX.getValue());
range.add(spinnerStartY.getValue());
range.add(spinnerEndY.getValue());
parameters.add(range);
parameters.add(spinnerCycles.getValue());
parameters.add(spinnerVel.getValue());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
bpms.add(cb.getSelectedItem().toString());
}
}
parameters.add(bpms);
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
try {
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
//SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
/*
JPanel pn = new JPanel(new BorderLayout());
((BorderLayout) pn.getLayout()).setHgap(5);
pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH);
JTextField tf = new JTextField(getContext().getDataManager().getLastOutput());
tf.setPreferredSize(new Dimension(600, tf.getPreferredSize().height));
tf.setEditable(false);
pn.add(tf, BorderLayout.SOUTH);
JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
*/
ArrayList parameters = new ArrayList();
System.out.println("Background: " + isBackground());
if (isBackground()){
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
return ret;
});
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
runAsync("Diagnostics/WireScanBackground", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
}
return ret;
});
} else {
parameters.add(currentScannner);
parameters.add(comboScanType.getSelectedItem().toString());
ArrayList range = new ArrayList();
range.add(spinnerStartX.getValue());
range.add(spinnerEndX.getValue());
range.add(spinnerStartY.getValue());
range.add(spinnerEndY.getValue());
parameters.add(range);
parameters.add(spinnerCycles.getValue());
parameters.add(spinnerVel.getValue());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
bpms.add(cb.getSelectedItem().toString());
}
}
parameters.add(bpms);
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
//SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
/*
JPanel pn = new JPanel(new BorderLayout());
((BorderLayout) pn.getLayout()).setHgap(5);
pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH);
JTextField tf = new JTextField(getContext().getDataManager().getLastOutput());
tf.setPreferredSize(new Dimension(600, tf.getPreferredSize().height));
tf.setEditable(false);
pn.add(tf, BorderLayout.SOUTH);
JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
*/
}
return ret;
});
}
} catch (Exception ex) {
showException(ex);
}
@@ -795,15 +865,14 @@ public class WireScan extends Panel {
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed
try {
try {
int type = comboScanType.getSelectedIndex();
boolean isSet1 = (type==0) || (type==1) || (type==4);
boolean isX = (type==0) || (type==2) || (type>=4);
if (isSet1){
Epics.putq(currentScannner + ":WIRE_SP", isX ? 1 : 2);
if (isBackground()){
Epics.putq(currentScannner + ":WIRE_SP", (type==7) ? 5 : 0);
} else if (isSet1()){
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 1 : 2);
} else {
Epics.putq(currentScannner + ":WIRE_SP", isX ? 3 : 4);
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 3 : 4);
}
Epics.putq(currentScannner + ":INIT.PROC", 1);
} catch (Exception ex) {
@@ -848,12 +917,30 @@ public class WireScan extends Panel {
}
}//GEN-LAST:event_buttonHomingActionPerformed
private void buttonParkAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkAllActionPerformed
try {
runAsync("Diagnostics/ParkAllWireScanners").handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
SwingUtils.showMessage(getTopLevel(), "Success", "Finished parking wire scanners");
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonParkAllActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
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;
private javax.swing.JButton buttonScan;
private javax.swing.JButton buttonScannerPanel;
private javax.swing.JComboBox comboBlm1;

View File

@@ -87,7 +87,7 @@ def get_scan_selection(scan_type, index = 0):
class WireScanner(WireScanInfo):
ScanType = [WireX1, WireY1, WireX2, WireY2, Set1, Set2] = ['X1', 'Y1', 'X2', 'Y2', 'Set1', 'Set2']
ScanType = [WireX1, WireY1, WireX2, WireY2, Set1, Set2, BackGarage, BackFoil] = ['X1', 'Y1', 'X2', 'Y2', 'Set1', 'Set2', 'BackgroundGarage', 'BackgroundFoil']
Selection = [Garage, W1X, W1Y, W2X, W2Y, Foil] = "GARAGE", "W1X", "W1Y", "W2X", "W2Y", "FOIL"
def __init__(self, prefix, scan_range, cycles=None, velocity=None, continuous = None):

View File

@@ -0,0 +1,70 @@
#import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
import ch.psi.pshell.bs.Scalar as Scalar
import ch.psi.pshell.epics.DiscretePositioner as DiscretePositioner
#Arguments
SAMPLES = 10
GAINS = ["SINDI02-DBLM084:M06-1-CH03-V-MM","SINDI02-DBLM084:M06-1-CH03-V-MM2",]
BLMS = ["SINDI02-DBLM025", "SINDI02-DBLM085", "S10DI01-DBLM045"]
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
SETTLING_TIME = 0.5
gain_positioners = []
for i in range(len(GAINS)):
#gain_positioners.append(Channel(GAINS[i], alias = "gain " + str(i+1)))
gain_positioners.append( DummyPositioner("gain " + str(i+1)))
attenuators = []
for i in range(len(ATTENUATORS)):
att = DiscretePositioner("Att"+str(i+1), ATTENUATORS[i])
att.initialize()
attenuators.append(att)
#Channel-based
#blm1 = ChannelDouble("blm1", "SINDI02-DBLM025:B1_LOSS"); blm1.setMonitored(True); blm1.initialize()
#blm2 = ChannelDouble("blm2", "SINDI02-DBLM085:B1_LOSS"); blm2.setMonitored(True); blm2.initialize()
#Stream creation
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 10, 0)
av = create_averager(blm, SAMPLES, interval = -1)
av.setMonitored(i>0)
sensors.append(av)
sensors.append(av.stdev)
sensors.append(av.samples)
line_plots.append(av.samples)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
"""
#Averaging
ablm1 = create_averager(blm1, SAMPLES, interval = -1)
ablm2 = create_averager(blm2, SAMPLES, interval = -1)
ablm2.setMonitored(True)
"""
#Plot setup
setup_plotting( line_plots = line_plots)
#Metadata
set_attribute("/", "BLM" , BLMS)
set_attribute("/", "Gain" , GAINS)
for att in attenuators:
set_attribute("/", att.setpoint.channelName, att.read())
try:
r=lscan(gain_positioners, sensors, [RANGE[0],] * len(gain_positioners), [RANGE[1],] * len(gain_positioners), [STEP_SIZE,] * len(gain_positioners), latency = SETTLING_TIME)
finally:
st.close()

View File

@@ -69,6 +69,13 @@ st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
class Timestamp(Readable):
def read(self):
return st.getTimestamp()
#Pseudo-device returning the wire position
class w_pos(Readable):
@@ -106,7 +113,7 @@ def do_background():
path = get_exec_pars().group + "/"+ r.getReadables()[i].name
set_attribute(path, "Mean", mean(d))
set_attribute(path, "Sigma", stdev(d) )
#Scan
def do_scan(index):
global scan_complete, cur_cycle, wire
@@ -127,7 +134,7 @@ def do_scan(index):
try:
scanner.scan() #scanner.waitState(State.Busy, 60000) Not needed as stream filter will make the wait
st.getChild("scanning").waitValue(1.0, 10000)
mscan (st, [w_pos()] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan)
mscan (st, [w_pos()] + st.getReadables() + [Timestamp(),], -1, -1, take_initial = True, after_read = check_end_scan)
except:
if not scanner.isReady():
print "Aborting scan"
@@ -162,15 +169,16 @@ def calculate():
sp = blm_remove_spikes(data)
sig = sp if bg is None else [v-bg for v in sp]
[rms_com, rms] = profile_rms_stats(pos, sig,noise_std=0, n_sigma=3.5)
set_attribute(path, "RMS", float("nan") if (rms is None) else rms)
set_attribute(path, "RMS centroid", float("nan") if (rms_com is None) else rms_com)
[rms_com, rms_sigma] = profile_rms_stats(pos, sig,noise_std=0, n_sigma=3.5)
set_attribute(path, "RMS COM", float("nan") if (rms_com is None) else rms_com)
set_attribute(path, "RMS Sigma", float("nan") if (rms_sigma is None) else rms_sigma)
#print [com, rms]
[off, amp, com, sigma] = profile_gauss_stats(pos, sig, off=None, amp=None, com=None, sigma=None)
set_attribute(path, "Gauss COM", float("nan") if (com is None) else com)
set_attribute(path, "Gauss Sigma", float("nan") if (sigma is None) else sigma)
samples[0].append(rms_com);samples[1].append(rms);samples[2].append(com);samples[3].append(sigma)
samples[0].append(rms_com);samples[1].append(rms_sigma);samples[2].append(com);samples[3].append(sigma)
#print [off, amp, com, sigma]
#from mathutils import Gaussian
@@ -185,10 +193,10 @@ def calculate():
plt.addMarker(stats[i][2][0], None, "Gcom=" + "%.2f" % stats[i][2][0], plt.getSeries(i).color)
plt.addMarker(stats[i][1][0], None, "Rcom=" + "%.2f" % stats[i][1][0], plt.getSeries(i).color.brighter())
msg += " RMS: " + "%.4f" % stats[i][0][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][0][1] + "\n"
msg += " RMS COM: " + "%.4f" % stats[i][1][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][1][1] + "\n"
msg += " Gauss COM: " + "%.4f" % stats[i][2][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][2][1] + "\n"
msg += " Gauss Sigma: " + "%.4f" % stats[i][3][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][3][1] + "\n"
msg += " RMS COM: " + "%.4f" % stats[i][0][0] + " +- " +"%.4f" % stats[i][0][1] + "\n" #unichr(0x03C3) + "="
msg += " RMS Sigma: " + "%.4f" % stats[i][1][0] + " +- " + "%.4f" % stats[i][1][1] + "\n"
msg += " Gauss COM: " + "%.4f" % stats[i][2][0] + " +- " + "%.4f" % stats[i][2][1] + "\n"
msg += " Gauss Sigma: " + "%.4f" % stats[i][3][0] + " +- " + "%.4f" % stats[i][3][1] + "\n"
except Exception, e:
print >> sys.stderr, traceback.format_exc()
msg += str(e)+ "\n"
@@ -218,6 +226,7 @@ if do_elog:
gsa_log_msg = gsa_log_msg + "\nRange: " + str(scan_range)
gsa_log_msg = gsa_log_msg + "\nCycles: " + str(cycles)
gsa_log_msg = gsa_log_msg + "\nWire Velocity: " + str(velocity)
gsa_log_msg = gsa_log_msg + msg
gsa_log_msg = gsa_log_msg + "\nBackground Measures: " + str(bkgrd)
gsa_log_msg = gsa_log_msg + "\n" + msg
elog("Wire Scan", gsa_log_msg, snapshots)

View File

@@ -0,0 +1,90 @@
import traceback
is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run"
run("Devices/Elements")
run("Devices/WireScanner")
#Paramter parsing
prefix = args[0] if is_panel else "S30CB09-DWSC440" #"SINDI01-DWSC090"
scan_type = args[1] if is_panel else WireScanner.BackGarage
blms = args[2] if is_panel else get_wire_scanners_blms(prefix)
bkgrd = args[3] if is_panel else 50
plt = args[4] if is_panel else plot(None, title = "Wire Scan")[0]
do_elog = True if is_panel else True
print "WireScan parameters: ", prefix, scan_type, blms, bkgrd, plt, do_elog
#Plot setup
plt.clear()
plt.removeMarker(None)
plt.getAxis(plt.AxisId.X).setLabel("Sample");
plt.getAxis(plt.AxisId.Y).setLabel("");
plt.getAxis(plt.AxisId.Y2).setLabel("");
plt.setLegendVisible(True);
plt.getAxis(plt.AxisId.X).setRange(0, bkgrd-1)
snapshots = []
#Creating WireScanner object
print "Creating scanner..."
if prefix not in get_wire_scanners():
raise Exception("Invalid wire scan: " + prefix)
scanner = WireScanner(prefix, None)
if scan_type == WireScanner.BackFoil:
scanner.set_selection(WireScanner.Foil)
scanner.init(True)
else:
scanner.park(True)
#Metadata
set_attribute("/", "Wire Scanner", prefix)
set_attribute("/", "Scan Type", scan_type)
set_attribute("/", "Background Measures", bkgrd)
#Stream creation
print "Starting stream..."
st = Stream("pulse_id", dispatcher)
for i in range (len(blms)):
series = LinePlotSeries(blms[i], None, min(i+1, 2))
plt.addSeries(series)
series.setLinesVisible(True)
series.setPointSize(1)
st.addScalar("blm" + str(i+1), blms[i] + ":B1_LOSS", 10, 0)
st.initialize()
st.start()
def after_sample(record, scan):
for i in range (len(blms)):
plt.getSeries(i).appendData(record.index, record[i])
print "Starting scan..."
class Timestamp(Readable):
def read(self):
return st.getTimestamp()
try:
r = mscan (st, st.getReadables()[1:] + [Timestamp(),], bkgrd, after_read = after_sample)
finally:
print "Closing scanner"
scanner.close()
print "Closing stream"
st.close()
# save the entry in the logbook
if do_elog:
if get_option("Generated data file:\n" + get_exec_pars().path + "\n\n" + "Save to ELOG?", "YesNo") == "Yes":
gsa_log_msg = "Data file: " + get_exec_pars().path
gsa_log_msg = gsa_log_msg + "\nWire Scanner: " + prefix
gsa_log_msg = gsa_log_msg + "\nScan Type: " + str(scan_type)
gsa_log_msg = gsa_log_msg + "\nBackground Measures: " + str(bkgrd)
img_file = os.path.abspath(get_exec_pars().path + ".png")
plt.saveSnapshot(img_file, "png")
elog("Wire Scan", gsa_log_msg, [img_file,])