This commit is contained in:
sfop
2017-04-25 13:59:03 +02:00
parent 4c66ec7b6f
commit 0cc8ec5c9e
12 changed files with 683 additions and 383 deletions

View File

@@ -1,16 +1,16 @@
#Fri Apr 21 15:05:25 CEST 2017
#Tue Apr 25 13:06:46 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=NaN
colormapMin=NaN
colormapMax=318.0
colormapMin=9.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=1680
imageWidth=1744
imageHeight=2160
imageWidth=2560
invert=false
regionStartX=433
regionStartY=241
regionStartX=1
regionStartY=1
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-1057.4895329398094
spatialCalOffsetY=-1420.5549062527236
spatialCalScaleX=-8.510638153514359
spatialCalScaleY=-8.235817137431614
spatialCalOffsetX=-1057.0
spatialCalOffsetY=-1420.0
spatialCalScaleX=-8.51063829787234
spatialCalScaleY=-8.559201141226819
spatialCalUnits=mm
transpose=false

View File

@@ -1,5 +1,5 @@
#Tue Apr 18 08:29:45 CEST 2017
maxValue=180.0
#Tue Apr 25 10:33:55 CEST 2017
maxValue=360.0
minValue=-180.0
offset=0.0
precision=3

View File

@@ -29,8 +29,8 @@
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="panelPars" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
<Component id="panelScanPars" max="32767" attributes="0"/>
<Component id="panelBeamPars" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="plot" pref="531" max="32767" attributes="0"/>
@@ -45,9 +45,9 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="plot" pref="419" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="panelPars" min="-2" max="-2" attributes="0"/>
<Component id="panelScanPars" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<Component id="panelBeamPars" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -61,7 +61,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panelPars">
<Container class="javax.swing.JPanel" name="panelScanPars">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
@@ -80,27 +80,27 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="latencyLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerLatency" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="stopLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelStop" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStop" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="startLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStart" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="samplesLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerSamples" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="stepLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStep" min="-2" max="-2" attributes="0"/>
</Group>
@@ -115,27 +115,27 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="startLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="stopLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStop" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStep" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="stepLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerSamples" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="samplesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerLatency" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="latencyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -143,12 +143,12 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="startLabel">
<Component class="javax.swing.JLabel" name="labelStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="stopLabel">
<Component class="javax.swing.JLabel" name="labelStop">
<Properties>
<Property name="text" type="java.lang.String" value="Stop:"/>
</Properties>
@@ -163,7 +163,7 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="stepLabel">
<Component class="javax.swing.JLabel" name="labelStep">
<Properties>
<Property name="text" type="java.lang.String" value="Step:"/>
</Properties>
@@ -178,7 +178,7 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="samplesLabel">
<Component class="javax.swing.JLabel" name="labelSamples">
<Properties>
<Property name="text" type="java.lang.String" value="Nb Samples:"/>
</Properties>
@@ -193,7 +193,7 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="latencyLabel">
<Component class="javax.swing.JLabel" name="labelLatency">
<Properties>
<Property name="text" type="java.lang.String" value="Latency:"/>
</Properties>
@@ -223,7 +223,7 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Container class="javax.swing.JPanel" name="panelBeamPars">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
@@ -239,12 +239,12 @@
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="energyLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelEnergy" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="spinnerEnergy" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="dispersionLabel" min="-2" max="-2" attributes="0"/>
<Component id="labelDispersion" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="spinnerDispersion" min="-2" max="-2" attributes="0"/>
</Group>
@@ -259,12 +259,12 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerDispersion" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="dispersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelDispersion" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="energyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -275,14 +275,14 @@
<Component class="javax.swing.JSpinner" name="spinnerDispersion">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
<SpinnerModel initial="-0.32" maximum="100.0" minimum="-100.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="energyLabel">
<Component class="javax.swing.JLabel" name="labelEnergy">
<Properties>
<Property name="text" type="java.lang.String" value="Energy:"/>
</Properties>
@@ -290,14 +290,14 @@
<Component class="javax.swing.JSpinner" name="spinnerEnergy">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="10000.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
<SpinnerModel initial="7.1" maximum="100.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="dispersionLabel">
<Component class="javax.swing.JLabel" name="labelDispersion">
<Properties>
<Property name="text" type="java.lang.String" value="Dispersion:"/>
</Properties>

View File

@@ -27,27 +27,19 @@ public class GunScan extends Panel {
double energy0;
public GunScan() {
initComponents();
initComponents();
plot.setStyle(LinePlotJFree.Style.ErrorY);
plot.addSeries(seriesEnergy);
plot.addSeries(seriesEnergySpread);
plot.getAxis(Plot.AxisId.X).setLabel("Gun Phase");
plot.getAxis(Plot.AxisId.Y).setLabel("MeV");
plot.setLegendVisible(true);
setPersistedComponents(SwingUtils.getComponentsByType(panelPars, JSpinner.class));
setPersistedComponents(SwingUtils.getComponentsByType(panelScanPars, JSpinner.class));
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
try {
spinnerDispersion.setValue(Epics.get("SINBD01-DSCR010:DISPERSION-SIM", Double.class));
spinnerEnergy.setValue(Epics.get("SINBD01-DSCR010:ENERGY-SIM", Double.class));
} catch (Exception ex) {
ex.printStackTrace();
showException(ex);
}
}
@Override
@@ -94,19 +86,18 @@ public class GunScan extends Panel {
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
if ("GunScan".equals(getContext().getExecutionPars().getName())) {
double phase = (Double) record.getPositions()[0];
double energy_mean = ((DescStatsDouble) record.getValues()[0]).getMean();
double energy_std = ((DescStatsDouble) record.getValues()[0]).getStdev();
double energy_sp_mean = ((DescStatsDouble) record.getValues()[1]).getMean();
double energy_sp_std = ((DescStatsDouble) record.getValues()[1]).getStdev();
seriesEnergy.appendData(phase,
energy0 * (1 +energy_mean / 1e6 / dispersion),
double phase = (Double) record.getPositions()[0];
double energy_mean = ((DescStatsDouble) record.getValues()[0]).getMean();
double energy_std = ((DescStatsDouble) record.getValues()[0]).getStdev();
double energy_spread_mean = ((DescStatsDouble) record.getValues()[1]).getMean();
double energy_spread_std = ((DescStatsDouble) record.getValues()[1]).getStdev();
seriesEnergy.appendData(phase,
energy0 * (1 + energy_mean / 1e6 / dispersion),
energy0 * (energy_std / 1e6 / dispersion)
);
seriesEnergySpread.appendData(phase,
energy0 * (energy_sp_mean / 1e6 / dispersion),
energy0 * (energy_sp_std / 1e6 / dispersion)
energy0 * (energy_spread_mean / 1e6 / dispersion),
energy0 * (energy_spread_std / 1e6 / dispersion)
);
}
}
@@ -120,48 +111,48 @@ public class GunScan extends Panel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelPars = new javax.swing.JPanel();
startLabel = new javax.swing.JLabel();
stopLabel = new javax.swing.JLabel();
panelScanPars = new javax.swing.JPanel();
labelStart = new javax.swing.JLabel();
labelStop = new javax.swing.JLabel();
spinnerStep = new javax.swing.JSpinner();
stepLabel = new javax.swing.JLabel();
labelStep = new javax.swing.JLabel();
spinnerStart = new javax.swing.JSpinner();
samplesLabel = new javax.swing.JLabel();
labelSamples = new javax.swing.JLabel();
spinnerSamples = new javax.swing.JSpinner();
latencyLabel = new javax.swing.JLabel();
labelLatency = new javax.swing.JLabel();
spinnerLatency = new javax.swing.JSpinner();
spinnerStop = new javax.swing.JSpinner();
jPanel2 = new javax.swing.JPanel();
panelBeamPars = new javax.swing.JPanel();
spinnerDispersion = new javax.swing.JSpinner();
energyLabel = new javax.swing.JLabel();
labelEnergy = new javax.swing.JLabel();
spinnerEnergy = new javax.swing.JSpinner();
dispersionLabel = new javax.swing.JLabel();
labelDispersion = new javax.swing.JLabel();
plot = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(737, 445));
panelPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Parameters"));
panelScanPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Parameters"));
startLabel.setText("Start:");
labelStart.setText("Start:");
stopLabel.setText("Stop:");
labelStop.setText("Stop:");
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 1.0d, 90.0d, 1.0d));
spinnerStep.setPreferredSize(new java.awt.Dimension(64, 20));
stepLabel.setText("Step:");
labelStep.setText("Step:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d));
spinnerStart.setPreferredSize(new java.awt.Dimension(64, 20));
samplesLabel.setText("Nb Samples:");
labelSamples.setText("Nb Samples:");
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1.0d, 1.0d, 50.0d, 1.0d));
spinnerSamples.setPreferredSize(new java.awt.Dimension(64, 20));
latencyLabel.setText("Latency:");
labelLatency.setText("Latency:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d));
spinnerLatency.setPreferredSize(new java.awt.Dimension(64, 20));
@@ -170,101 +161,101 @@ public class GunScan extends Panel {
spinnerStop.setMinimumSize(new java.awt.Dimension(53, 20));
spinnerStop.setPreferredSize(new java.awt.Dimension(64, 20));
javax.swing.GroupLayout panelParsLayout = new javax.swing.GroupLayout(panelPars);
panelPars.setLayout(panelParsLayout);
panelParsLayout.setHorizontalGroup(
panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParsLayout.createSequentialGroup()
javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars);
panelScanPars.setLayout(panelScanParsLayout);
panelScanParsLayout.setHorizontalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(latencyLabel)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelLatency)
.addGap(2, 2, 2)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(stopLabel)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStop)
.addGap(2, 2, 2)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(startLabel)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStart)
.addGap(2, 2, 2)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(samplesLabel)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelSamples)
.addGap(2, 2, 2)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(stepLabel)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStep)
.addGap(2, 2, 2)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelParsLayout.setVerticalGroup(
panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParsLayout.createSequentialGroup()
panelScanParsLayout.setVerticalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(startLabel))
.addComponent(labelStart))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(stopLabel))
.addComponent(labelStop))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(stepLabel))
.addComponent(labelStep))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(samplesLabel))
.addComponent(labelSamples))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(latencyLabel))
.addComponent(labelLatency))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters"));
panelBeamPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters"));
spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 10.0d, 0.01d));
spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(-0.32d, -100.0d, 100.0d, 0.01d));
spinnerDispersion.setPreferredSize(new java.awt.Dimension(64, 20));
energyLabel.setText("Energy:");
labelEnergy.setText("Energy:");
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 10000.0d, 0.1d));
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(7.1d, 0.0d, 100.0d, 0.1d));
spinnerEnergy.setPreferredSize(new java.awt.Dimension(64, 20));
dispersionLabel.setText("Dispersion:");
labelDispersion.setText("Dispersion:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
javax.swing.GroupLayout panelBeamParsLayout = new javax.swing.GroupLayout(panelBeamPars);
panelBeamPars.setLayout(panelBeamParsLayout);
panelBeamParsLayout.setHorizontalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamParsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(energyLabel)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelBeamParsLayout.createSequentialGroup()
.addComponent(labelEnergy)
.addGap(0, 0, 0)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(dispersionLabel)
.addGroup(panelBeamParsLayout.createSequentialGroup()
.addComponent(labelDispersion)
.addGap(0, 0, 0)
.addComponent(spinnerDispersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
panelBeamParsLayout.setVerticalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelBeamParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerDispersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dispersionLabel))
.addComponent(labelDispersion))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(energyLabel))
.addComponent(labelEnergy))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -295,8 +286,8 @@ public class GunScan extends Panel {
.addComponent(buttonStart)
.addGap(34, 34, 34)
.addComponent(buttonAbort))
.addComponent(panelPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(panelScanPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelBeamPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
.addContainerGap())
@@ -308,9 +299,9 @@ public class GunScan extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelBeamPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
@@ -318,13 +309,13 @@ public class GunScan extends Panel {
.addGap(14, 14, 14))
);
panelPars.getAccessibleContext().setAccessibleDescription("");
panelScanPars.getAccessibleContext().setAccessibleDescription("");
}// </editor-fold>//GEN-END:initComponents
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
ArrayList parameters = new ArrayList();
dispersion = (Double)spinnerDispersion.getValue();
energy0 = (Double)spinnerEnergy.getValue();
dispersion = (Double) spinnerDispersion.getValue();
energy0 = (Double) spinnerEnergy.getValue();
parameters.add(spinnerStart.getValue());
parameters.add(spinnerStop.getValue());
parameters.add(spinnerStep.getValue());
@@ -337,7 +328,7 @@ public class GunScan extends Panel {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
} else {
}
return ret;
});
@@ -357,13 +348,16 @@ public class GunScan extends Panel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonStart;
private javax.swing.JLabel dispersionLabel;
private javax.swing.JLabel energyLabel;
private javax.swing.JPanel jPanel2;
private javax.swing.JLabel latencyLabel;
private javax.swing.JPanel panelPars;
private javax.swing.JLabel labelDispersion;
private javax.swing.JLabel labelEnergy;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelSamples;
private javax.swing.JLabel labelStart;
private javax.swing.JLabel labelStep;
private javax.swing.JLabel labelStop;
private javax.swing.JPanel panelBeamPars;
private javax.swing.JPanel panelScanPars;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JLabel samplesLabel;
private javax.swing.JSpinner spinnerDispersion;
private javax.swing.JSpinner spinnerEnergy;
private javax.swing.JSpinner spinnerLatency;
@@ -371,8 +365,5 @@ public class GunScan extends Panel {
private javax.swing.JSpinner spinnerStart;
private javax.swing.JSpinner spinnerStep;
private javax.swing.JSpinner spinnerStop;
private javax.swing.JLabel startLabel;
private javax.swing.JLabel stepLabel;
private javax.swing.JLabel stopLabel;
// End of variables declaration//GEN-END:variables
}

View File

@@ -28,7 +28,7 @@
<Component id="panelOutput" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="plot" pref="522" max="32767" attributes="0"/>
<Component id="plot" pref="511" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -88,24 +88,24 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spinnerStart" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spinnerSamples" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spinnerLatency" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelStop" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -123,27 +123,27 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStart" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStop" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStep" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSamples" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerLatency" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
@@ -159,13 +159,13 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Component class="javax.swing.JLabel" name="labelLatency">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Latency:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Component class="javax.swing.JLabel" name="labelStart">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Start:"/>
@@ -178,13 +178,13 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Component class="javax.swing.JLabel" name="labelStep">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Step:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Component class="javax.swing.JLabel" name="labelStop">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Stop:"/>
@@ -204,7 +204,7 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Component class="javax.swing.JLabel" name="labelSamples">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Nb Samples:"/>
@@ -240,7 +240,7 @@
<EmptySpace pref="25" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="labelRefPhase" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerPhaseRef" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
@@ -255,7 +255,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelRefPhase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPhaseRef" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
@@ -266,7 +266,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel7">
<Component class="javax.swing.JLabel" name="labelRefPhase">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Ref Phase:"/>
@@ -275,7 +275,7 @@
<Component class="javax.swing.JSpinner" name="spinnerPhaseRef">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="360.0" minimum="-45.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
<SpinnerModel initial="0.0" maximum="360.0" minimum="-180.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>

View File

@@ -12,6 +12,7 @@ import ch.psi.pshell.scan.Scan;
import ch.psi.pshell.scan.ScanListener;
import ch.psi.pshell.scan.ScanRecord;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
@@ -22,18 +23,19 @@ import javax.swing.JSpinner;
*
*/
public class SchottkyScan extends Panel {
LinePlotErrorSeries series = new LinePlotErrorSeries("Values");
LinePlotErrorSeries series = new LinePlotErrorSeries("Values");
public SchottkyScan() {
initComponents();
plot.setStyle(LinePlotJFree.Style.ErrorY);
plot.addSeries(series);
plot.getAxis(Plot.AxisId.X).setLabel("Gun Phase");
plot.getAxis(Plot.AxisId.Y).setLabel("SINEG01-DICT215:B1_CHARGE");
//setPersistedComponents(SwingUtils.getComponentsByType(panelPars, JSpinner.class));
plot.getAxis(Plot.AxisId.Y).setLabel("SINEG01-DICT215:B1_CHARGE");
setPersistedComponents(SwingUtils.getComponentsByType(panelPars, JSpinner.class));
}
//Overridable callbacks
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@@ -49,7 +51,7 @@ public class SchottkyScan extends Panel {
spinnerSamples.setEnabled(buttonStart.isEnabled());
spinnerLatency.setEnabled(buttonStart.isEnabled());
spinnerPhaseRef.setEnabled(buttonStart.isEnabled());
}
}
@Override
public void onExecutedFile(String fileName, Object result) {
@@ -59,7 +61,7 @@ public class SchottkyScan extends Panel {
@Override
protected void doUpdate() {
}
@Override
public void onStart() {
super.onStart();
@@ -67,30 +69,32 @@ public class SchottkyScan extends Panel {
}
@Override
public void onStop() {
public void onStop() {
getContext().removeScanListener(scanListener);
super.onStop();
}
ScanListener scanListener = new ScanListener() {
@Override
public void onScanStarted(Scan scan, String plotTitle) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())){
series.clear();
}
}
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())){
series.appendData((Double)record.getPositions()[0], ((DescStatsDouble)record.getValues()[0]).getMean(),
((DescStatsDouble)record.getValues()[0]).getStdev());
public void onScanStarted(Scan scan, String plotTitle) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())) {
series.clear();
}
}
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())) {
series.appendData((Double) record.getPositions()[0], ((DescStatsDouble) record.getValues()[0]).getMean(),
((DescStatsDouble) record.getValues()[0]).getStdev());
}
}
@Override
public void onScanEnded(Scan scan, Exception ex) {
}
};
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -99,18 +103,18 @@ public class SchottkyScan extends Panel {
buttonAbort = new javax.swing.JButton();
panelPars = new javax.swing.JPanel();
spinnerStep = new javax.swing.JSpinner();
jLabel5 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
labelLatency = new javax.swing.JLabel();
labelStart = new javax.swing.JLabel();
spinnerStop = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
labelStep = new javax.swing.JLabel();
labelStop = new javax.swing.JLabel();
spinnerLatency = new javax.swing.JSpinner();
spinnerSamples = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
labelSamples = new javax.swing.JLabel();
spinnerStart = new javax.swing.JSpinner();
plot = new ch.psi.pshell.plot.LinePlotJFree();
panelOutput = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
labelRefPhase = new javax.swing.JLabel();
spinnerPhaseRef = new javax.swing.JSpinner();
buttonSet = new javax.swing.JButton();
@@ -132,26 +136,26 @@ public class SchottkyScan extends Panel {
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(5.0d, 1.0d, 90.0d, 1.0d));
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Latency:");
labelLatency.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelLatency.setText("Latency:");
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Start:");
labelStart.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelStart.setText("Start:");
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -180.0d, 360.0d, 1.0d));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Step:");
labelStep.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelStep.setText("Step:");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Stop:");
labelStop.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelStop.setText("Stop:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d));
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1, 1, 50, 1));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Nb Samples:");
labelSamples.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelSamples.setText("Nb Samples:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d));
@@ -163,21 +167,21 @@ public class SchottkyScan extends Panel {
.addContainerGap()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(jLabel1)
.addComponent(labelStart)
.addGap(0, 0, 0)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(jLabel4)
.addComponent(labelSamples)
.addGap(0, 0, 0)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(jLabel5)
.addComponent(labelLatency)
.addGap(0, 0, 0)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addComponent(labelStop)
.addComponent(labelStep))
.addGap(1, 1, 1)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -185,7 +189,7 @@ public class SchottkyScan extends Panel {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelParsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4, jLabel5});
panelParsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelLatency, labelSamples, labelStart, labelStep, labelStop});
panelParsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerLatency, spinnerSamples, spinnerStart, spinnerStep, spinnerStop});
@@ -194,23 +198,23 @@ public class SchottkyScan extends Panel {
.addGroup(panelParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(labelStart)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(labelStop)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(labelStep)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(labelSamples)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(labelLatency)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -219,10 +223,10 @@ public class SchottkyScan extends Panel {
panelOutput.setBorder(javax.swing.BorderFactory.createTitledBorder("Output"));
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel7.setText("Ref Phase:");
labelRefPhase.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelRefPhase.setText("Ref Phase:");
spinnerPhaseRef.setModel(new javax.swing.SpinnerNumberModel(0.0d, -45.0d, 360.0d, 1.0d));
spinnerPhaseRef.setModel(new javax.swing.SpinnerNumberModel(0.0d, -180.0d, 360.0d, 1.0d));
spinnerPhaseRef.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerPhaseRefStateChanged(evt);
@@ -244,7 +248,7 @@ public class SchottkyScan extends Panel {
.addContainerGap(25, Short.MAX_VALUE)
.addGroup(panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelOutputLayout.createSequentialGroup()
.addComponent(jLabel7)
.addComponent(labelRefPhase)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerPhaseRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(buttonSet, javax.swing.GroupLayout.Alignment.TRAILING))
@@ -258,7 +262,7 @@ public class SchottkyScan extends Panel {
.addGroup(panelOutputLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(labelRefPhase)
.addComponent(spinnerPhaseRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSet)
@@ -279,7 +283,7 @@ public class SchottkyScan extends Panel {
.addComponent(panelPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 522, Short.MAX_VALUE)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
.addContainerGap())
);
@@ -305,29 +309,29 @@ public class SchottkyScan extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
//((Plugin)this).
plot.removeMarker(null);
spinnerPhaseRef.setValue(0.0);
ArrayList parameters = new ArrayList();
parameters.add(spinnerStart.getValue());
parameters.add(spinnerStop.getValue());
parameters.add(spinnerStep.getValue());
parameters.add(spinnerSamples.getValue());
parameters.add(spinnerLatency.getValue());
plot.removeMarker(null);
spinnerPhaseRef.setValue(0.0);
ArrayList parameters = new ArrayList();
parameters.add(spinnerStart.getValue());
parameters.add(spinnerStop.getValue());
parameters.add(spinnerStep.getValue());
parameters.add(spinnerSamples.getValue());
parameters.add(spinnerLatency.getValue());
try {
//How to get a callback on the end of execution
runAsync("RFscan/SchottkyScan", parameters).handle((ret, ex) -> {
if (ex != null){
runAsync("RFscan/SchottkyScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
} else {
spinnerPhaseRef.setValue(ret);
spinnerPhaseRef.setValue(Convert.roundDouble((Double) ret, 1));
}
return ret;
});
});
//runAsync("RFscan/SchottkyScan", parameters);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
@@ -341,40 +345,40 @@ public class SchottkyScan extends Panel {
private void spinnerPhaseRefStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerPhaseRefStateChanged
try {
plot.removeMarker(null);
plot.addMarker((Double)spinnerPhaseRef.getValue(), Plot.AxisId.X, "Ref Phase",Color.GREEN);
plot.addMarker((Double) spinnerPhaseRef.getValue(), Plot.AxisId.X, "Ref Phase", Color.GREEN);
} catch (Exception ex) {
showException(ex);
}
}
}//GEN-LAST:event_spinnerPhaseRefStateChanged
private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
try {
double phaseOffset = -((Double)spinnerPhaseRef.getValue());
String cmd = "caput('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE', " + phaseOffset + ")";
cmd += "; " + "caput('SINEG01-RSYS:CMD-LOAD-CALIB-BEAM', 1)";
evalAsync(cmd).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
double phaseOffset = -((Double) spinnerPhaseRef.getValue());
String cmd = "caput('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE', " + phaseOffset + ");";
cmd += "caput('SINEG01-RSYS:CMD-LOAD-CALIB-BEAM', 1)";
evalAsync(cmd).handle((ret, ex) -> {
if (ex != null) {
showException((Exception) ex);
} else {
SwingUtils.showMessage(this, "Success", "Success setting ref phase");
}
return ret;
});
});
} catch (Exception ex) {
showException(ex);
}
}
}//GEN-LAST:event_buttonSetActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonSet;
private javax.swing.JButton buttonStart;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelRefPhase;
private javax.swing.JLabel labelSamples;
private javax.swing.JLabel labelStart;
private javax.swing.JLabel labelStep;
private javax.swing.JLabel labelStop;
private javax.swing.JPanel panelOutput;
private javax.swing.JPanel panelPars;
private ch.psi.pshell.plot.LinePlotJFree plot;

View File

@@ -17,35 +17,37 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboWireScan" max="32767" attributes="0"/>
</Group>
<Component id="jLabel8" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="buttonMoveStart" min="-2" pref="120" max="-2" attributes="0"/>
<Component id="buttonPark" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonScan" min="-2" pref="120" max="-2" attributes="0"/>
<Component id="buttonMoveStart" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" min="-2" pref="120" max="-2" 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="1" 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="jLabel4" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel5" 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"/>
<Group type="102" alignment="0" 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"/>
</Group>
<Component id="jLabel4" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel5" linkSize="1" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboSelection" max="32767" attributes="0"/>
<Component id="textBpm1" max="32767" attributes="0"/>
<Component id="textBpm2" max="32767" attributes="0"/>
<Component id="comboBpm3" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
@@ -67,11 +69,33 @@
</Group>
</Group>
<Component id="panelStatus" alignment="0" max="32767" attributes="0"/>
<Component id="comboBpm1" max="32767" attributes="0"/>
<Component id="comboBpm2" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel11" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="panelPosition" min="-2" pref="117" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="ledHomed" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonHoming" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMotorPanel" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="buttonScannerPanel" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="plot" pref="451" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="plot" pref="457" max="32767" attributes="0"/>
<EmptySpace min="11" pref="11" max="-2" attributes="0"/>
</Group>
</Group>
@@ -110,31 +134,45 @@
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textBpm1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboBpm1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboBpm2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textBpm2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<Component id="comboBpm3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboBpm3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="95" max="32767" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPosition" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonScannerPanel" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel12" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledHomed" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonMotorPanel" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonHoming" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel10" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelStatus" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="separate" 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" pref="364" max="32767" attributes="0"/>
<Component id="plot" pref="416" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -170,16 +208,6 @@
<Property name="text" type="java.lang.String" value="BPM 1:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textBpm1">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textBpm2">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
@@ -283,5 +311,62 @@
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboBpm1">
</Component>
<Component class="javax.swing.JComboBox" name="comboBpm2">
</Component>
<Component class="javax.swing.JButton" name="buttonPark">
<Properties>
<Property name="text" type="java.lang.String" value="Park"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonParkActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Position:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelPosition">
</Component>
<Component class="javax.swing.JButton" name="buttonMotorPanel">
<Properties>
<Property name="text" type="java.lang.String" value="Motor Panel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMotorPanelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonScannerPanel">
<Properties>
<Property name="text" type="java.lang.String" value="Scanner Panel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScannerPanelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="text" type="java.lang.String" value="Homed:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledHomed">
<Properties>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="40" green="40" id="darkGray" palette="1" red="40" type="palette"/>
</Property>
<Property name="ledSize" type="int" value="18"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonHoming">
<Properties>
<Property name="text" type="java.lang.String" value="Homing"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHomingActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -3,6 +3,7 @@
*/
import ch.psi.pshell.device.Device;
import ch.psi.pshell.epics.ChannelDouble;
import ch.psi.pshell.epics.Epics;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
@@ -14,17 +15,29 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
/**
*
*/
public class WireScan extends Panel {
final String[] seriesNames = new String[]{"bpm1_x", "bpm1_y", "bpm1_q", "bpm2_x", "bpm2_y", "bpm2_q"};
final JComboBox[] bpmCombos;
final int[] seriesYAxis = new int[]{1, 1, 2, 1, 1, 2};
LinePlotSeries[] series = new LinePlotSeries[seriesNames.length];
boolean homed;
public WireScan() {
initComponents();
@@ -35,15 +48,19 @@ public class WireScan extends Panel {
plot.getAxis(Plot.AxisId.X).setLabel("Position");
plot.getAxis(Plot.AxisId.Y).setLabel("mm");
plot.getAxis(Plot.AxisId.Y2).setLabel("pc");
plot.setLegendVisible(true);
plot.setLegendVisible(true);
bpmCombos = new JComboBox[]{comboBpm1, comboBpm2, comboBpm3};
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
try {
startTimer(1000, 10);
DefaultComboBoxModel model = new DefaultComboBoxModel();
eval("run('Devices/Elements')", true);
model.addElement("");
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans()", true);
for (String scan: ret){
model.addElement(scan);
@@ -53,33 +70,72 @@ public class WireScan extends Panel {
model = new DefaultComboBoxModel();
ret = (List<String>) ((Plugin)this).eval("WireScanner.Selection", true);
for (String scan: ret){
model.addElement(scan);
if (!scan.equals("GARAGE")){
model.addElement(scan);
}
}
comboSelection.setModel(model);
comboWireScanActionPerformed(null);
model = new DefaultComboBoxModel();
ret = (List<String>) ((Plugin)this).eval("get_bpms()", true);
model.addElement("");
for (String scan: ret){
model.addElement(scan);
ret = (List<String>) ((Plugin)this).eval("get_bpms()", true);
for (JComboBox cb : bpmCombos){
model = new DefaultComboBoxModel();
model.addElement("");
for (String scan: ret){
model.addElement(scan);
}
cb.setModel(model);
}
comboBpm3.setModel(model);
if (App.hasArgument("ws")){
comboWireScan.setSelectedItem(App.getArgumentValue("ws"));
}
}
comboWireScanActionPerformed(null);
} catch (Exception ex) {
showException(ex);
}
}
@Override
protected void onTimer(){
try{
boolean validWireScan = !comboWireScan.getSelectedItem().toString().isEmpty();
if (validWireScan){
homed = (Epics.get(comboWireScan.getSelectedItem().toString() + ":MOTOR_1_HOMED", Integer.class) == 1);
if (homed){
ledHomed.setColor(Color.GREEN);
} else if (Epics.get(comboWireScan.getSelectedItem().toString() + ":MOTOR_1_HOMING", Integer.class) == 1){
ledHomed.setColor(Color.YELLOW);
} else {
ledHomed.setColor(Color.RED);
}
} else {
ledHomed.setColor(Color.darkGray);
homed = false;
}
onStateChange(getState(), getState());
} catch (Exception ex){
}
}
//S20CB01-DWSC440:MOTOR_1_HOME.PROC
@Override
public void onStateChange(State state, State former) {
buttonMoveStart.setEnabled(state==State.Ready);
buttonScan.setEnabled(state==State.Ready);
boolean validWireScan = !comboWireScan.getSelectedItem().toString().isEmpty();
buttonMoveStart.setEnabled((state==State.Ready) && validWireScan && homed);
buttonPark.setEnabled((state==State.Ready) && validWireScan && homed);
buttonScan.setEnabled((state==State.Ready) && validWireScan && homed);
buttonAbort.setEnabled(state==State.Busy);
comboSelection.setEnabled(validWireScan);
comboBpm1.setEnabled(validWireScan);
comboBpm2.setEnabled(validWireScan);
comboBpm3.setEnabled(validWireScan);
buttonMotorPanel.setEnabled(validWireScan);
buttonScannerPanel.setEnabled(validWireScan);
buttonHoming.setEnabled(validWireScan);
for (Component c: SwingUtils.getComponentsByType(this, JSpinner.class)){
c.setEnabled(validWireScan);
}
}
@Override
@@ -135,8 +191,6 @@ public class WireScan extends Panel {
jLabel2 = new javax.swing.JLabel();
comboSelection = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
textBpm1 = new javax.swing.JTextField();
textBpm2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
comboBpm3 = new javax.swing.JComboBox();
@@ -154,6 +208,16 @@ public class WireScan extends Panel {
spinnerCycles = new javax.swing.JSpinner();
panelStatus = new ch.psi.pshell.swing.DeviceValuePanel();
plot = new ch.psi.pshell.plot.LinePlotJFree();
comboBpm1 = new javax.swing.JComboBox();
comboBpm2 = new javax.swing.JComboBox();
buttonPark = new javax.swing.JButton();
jLabel11 = new javax.swing.JLabel();
panelPosition = new ch.psi.pshell.swing.DeviceValuePanel();
buttonMotorPanel = new javax.swing.JButton();
buttonScannerPanel = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
ledHomed = new ch.psi.pshell.swing.Led();
buttonHoming = new javax.swing.JButton();
comboWireScan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -176,10 +240,6 @@ public class WireScan extends Panel {
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("BPM 1:");
textBpm1.setEditable(false);
textBpm2.setEditable(false);
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("BPM 2:");
@@ -232,37 +292,74 @@ public class WireScan extends Panel {
plot.setTitle("");
buttonPark.setText("Park");
buttonPark.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonParkActionPerformed(evt);
}
});
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel11.setText("Position:");
buttonMotorPanel.setText("Motor Panel");
buttonMotorPanel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMotorPanelActionPerformed(evt);
}
});
buttonScannerPanel.setText("Scanner Panel");
buttonScannerPanel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonScannerPanelActionPerformed(evt);
}
});
jLabel12.setText("Homed:");
ledHomed.setForeground(java.awt.Color.darkGray);
ledHomed.setLedSize(18);
buttonHoming.setText("Homing");
buttonHoming.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHomingActionPerformed(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, false)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboWireScan, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel8)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(buttonMoveStart, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPark)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonScan, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.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(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, 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(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.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(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))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboSelection, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textBpm1)
.addComponent(textBpm2)
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -278,13 +375,34 @@ public class WireScan extends Panel {
.addComponent(jLabel9)
.addGap(8, 8, 8)
.addComponent(spinnerCycles))))
.addComponent(panelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(panelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 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)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel11)
.addComponent(jLabel12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHoming)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMotorPanel, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(buttonScannerPanel, javax.swing.GroupLayout.Alignment.TRAILING))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
.addGap(11, 11, 11))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel10, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel10, jLabel11, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -315,48 +433,81 @@ public class WireScan extends Panel {
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(textBpm1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(comboBpm1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(textBpm2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(comboBpm2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(comboBpm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 95, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboBpm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel11)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonScannerPanel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel12)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMotorPanel)
.addComponent(buttonHoming))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel10)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)
.addComponent(buttonMoveStart)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE))
.addComponent(buttonMoveStart)
.addComponent(buttonPark)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void comboWireScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboWireScanActionPerformed
try {
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans_bpms('" + comboWireScan.getSelectedItem().toString()+ "')", true);
textBpm1.setText((ret==null) ? "" : ret.get(0));
textBpm2.setText((ret==null) ? "" : ret.get(1));
comboSelection.setSelectedIndex(Epics.get(comboWireScan.getSelectedItem().toString() + ":WIRE_SP", Integer.class));
spinnerVel.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":SCAN_VELO_SP", Double.class));
spinnerCycles.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":NB_CYCL_SP", Integer.class));
if (panelStatus.getDevice()!=null){
panelStatus.getDevice().close();
panelStatus.setDevice(null);
}
Device dev= (Device)eval("newScanInfoDevice(None, '" + comboWireScan.getSelectedItem().toString()+ "')", true);
panelStatus.setDevice(dev);
} catch (Exception ex) {
panelStatus.setDevice(null);
if (panelPosition.getDevice()!=null){
panelPosition.getDevice().close();
panelPosition.setDevice(null);
}
ledHomed.setColor(Color.darkGray);
homed = false;
if ( comboWireScan.getSelectedItem().toString().isEmpty()){
for (JComboBox cb : bpmCombos){
cb.setSelectedItem("");
}
} else {
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans_bpms('" + comboWireScan.getSelectedItem().toString()+ "')", true);
comboBpm1.setSelectedItem((ret==null) ? "" : ret.get(0));
comboBpm2.setSelectedItem((ret==null) ? "" : ret.get(1));
comboSelection.setSelectedIndex(Epics.get(comboWireScan.getSelectedItem().toString() + ":WIRE_SP", Integer.class));
spinnerVel.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":SCAN_VELO_SP", Double.class));
spinnerCycles.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":NB_CYCL_SP", Integer.class));
Device dev= (Device)eval("newScanInfoDevice(None, '" + comboWireScan.getSelectedItem().toString()+ "')", true);
panelStatus.setDevice(dev);
dev = new ChannelDouble (null, comboWireScan.getSelectedItem().toString() + ":ENC_1_BS", 3);
dev.setMonitored(true);
dev.initialize();
panelPosition.setDevice(dev);
}
} catch (Exception ex) {
showException(ex);
comboWireScan.setSelectedItem("");
for (JComboBox cb : bpmCombos){
cb.setSelectedItem("");
}
}
onStateChange(getState(), getState());
}//GEN-LAST:event_comboWireScanActionPerformed
private void comboSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSelectionActionPerformed
@@ -377,7 +528,12 @@ public class WireScan extends Panel {
parameters.add(spinnerEnd.getValue());
parameters.add(spinnerCycles.getValue());
parameters.add(spinnerVel.getValue());
parameters.add(comboBpm3.getSelectedItem().toString().isEmpty() ? null: comboBpm3.getSelectedItem().toString());
ArrayList bpms = new ArrayList();
for (JComboBox cb : bpmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
bpms.add(cb.getSelectedItem().toString());
}
}
getContext().addScanListener(scanListener);
try {
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
@@ -385,7 +541,15 @@ public class WireScan extends Panel {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
//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;
});
@@ -410,15 +574,59 @@ public class WireScan extends Panel {
}
}//GEN-LAST:event_buttonMoveStartActionPerformed
private void buttonParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkActionPerformed
try {
Epics.putq(comboWireScan.getSelectedItem().toString() + ":GARAGE_SEL.PROC", 1);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonParkActionPerformed
String caqtdm = "caqtdm -noMsg -stylefile sfop.qss -attach";
private void buttonMotorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMotorPanelActionPerformed
try {
String cmd = caqtdm + " -macro 'P=" + comboWireScan.getSelectedItem() + ":,M=MOTOR_1' /sf/common/config/qt/motorx_all.ui";
Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonMotorPanelActionPerformed
private void buttonScannerPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScannerPanelActionPerformed
try {
String cmd = caqtdm + " -macro 'DEVICE=" + comboWireScan.getSelectedItem() + "' /sf/op/config/qt/S_DI_WSC.ui";
Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonScannerPanelActionPerformed
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
try {
Epics.putq(comboWireScan.getSelectedItem().toString() + ":MOTOR_1_HOME.PROC", 1);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonHomingActionPerformed
// 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 buttonScan;
private javax.swing.JButton buttonScannerPanel;
private javax.swing.JComboBox comboBpm1;
private javax.swing.JComboBox comboBpm2;
private javax.swing.JComboBox comboBpm3;
private javax.swing.JComboBox comboSelection;
private javax.swing.JComboBox comboWireScan;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@@ -427,13 +635,13 @@ public class WireScan extends Panel {
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private ch.psi.pshell.swing.Led ledHomed;
private ch.psi.pshell.swing.DeviceValuePanel panelPosition;
private ch.psi.pshell.swing.DeviceValuePanel panelStatus;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerCycles;
private javax.swing.JSpinner spinnerEnd;
private javax.swing.JSpinner spinnerStart;
private javax.swing.JSpinner spinnerVel;
private javax.swing.JTextField textBpm1;
private javax.swing.JTextField textBpm2;
// End of variables declaration//GEN-END:variables
}

View File

@@ -167,6 +167,17 @@ elements = (
(DBPM, "SARBD02-DBPM040", 598.3943),
)
def get_section(element):
return element[1:3]
def get_section_type(element):
section = get_section(element)
if section == "AR": return "ARAMIS"
if section == "AT": return "ATH0S"
if section == "IN": return "INJECTOR"
if section in["10", "20", "30"] : return "LINAC"
return None
def get_bpms():
ret = []
@@ -184,17 +195,20 @@ def get_wire_scans():
def get_wire_scans_bpms(wire_scans):
def get_wire_scans_bpms(wire_scan):
last = None
ret = []
for element in elements:
if element[0]==DWSC and element[1] == wire_scans:
if element[0]==DWSC and element[1] == wire_scan:
ret = [last,]
else:
if len(ret) > 0:
return [ret[0],element[1]]
last = element[1]
if get_section_type(element[1]) == get_section_type(wire_scan):
if len(ret) > 0:
return [ret[0],element[1]]
last = element[1]
return None
#for w in get_wire_scans():
# print w, get_wire_scans_bpms(w)

View File

@@ -12,8 +12,8 @@ start = args[2] if is_panel else -200
end = args[3] if is_panel else 200
cycles = args[4] if is_panel else 5
velocity = args[5] if is_panel else 200
bpm3 = args[6] if is_panel else None
print "WireScan parameters: ", prefix, sel, start, end, cycles, cycles, bpm3
bpms = args[6] if is_panel else get_wire_scans_bpms(prefix)
print "WireScan parameters: ", prefix, sel, start, end, cycles, cycles, bpms
#Creating WireScanner object
print "Creating scanner..."
@@ -27,11 +27,8 @@ scanner.waitValue("At start", 60000)
channels = [("w_pos", scanner.motor_bs_readback.get_name()),
("cur_cycle", scanner.curr_cycl.get_name()),
("scanning", scanner.status_channels[0].get_name())]
bpms = get_wire_scans_bpms(prefix)
if bpms is None:
raise Exception("Cannot determine wire scan bpms: " + prefix)
if bpm3 is not None:
bpms.append(bpm3)
#bpms = ["SINDI01-DBPM060", "SINDI02-DBPM010"] #For testing
for i in range (len(bpms)):
for sensor in BPM_SENSORS:

View File

@@ -1,33 +1,34 @@
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
import ch.psi.pshell.epics.Camtool as Camtool
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
import ch.psi.pshell.epics.Camtool as Camtool
if get_exec_pars().source == CommandSource.ui:
start = 55.0
stop = 75.0
start = -34.0
stop = -14.0
step = 2.0
nb = 5
lat = 0.5
disp = caget("SINBD01-DSCR010:DISPERSION")
energy0 = caget("SINBD01-DSCR010:ENERGY")
nb = 1
lat = 0.3
disp = -0.32
energy0 = 7.1
else:
start = args[0]
stop = args[1]
step = args[2]
nb = int(args[3])
lat = args[4]
start = args[0]
stop = args[1]
step = args[2]
nb = int(args[3])
lat = args[4]
disp = args[5]
energy0 = args[6]
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
phase.initialize()
#kill_camtool()
phase0 = phase.read()
kill_camtool()
check_camtool()
camtool.start("SINBD01-DSCR010")
wait_camtool_message()
@@ -44,6 +45,7 @@ try:
E = [energy0 * (1 + val.mean / 1e6 / disp) for val in r.getReadable(0)]
dE = [energy0 * ( val.mean / 1e6 / disp) for val in r.getReadable(1)]
finally:
phase.write(phase0)
phase.close()
camtool.stop() # stops camtool but does not close it camtool is a global object

View File

@@ -13,10 +13,9 @@ else:
nb = int(args[3])
lat = args[4]
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
@@ -24,7 +23,7 @@ phase.initialize()
#st = Stream("ICTstream", dispatcher)
#q = st.addScalar("Charge", "SINEG01-DICT215:B1_CHARGE", 1, 0)
#st.initialize()
#st.start(True)
#st.start()
q = Channel("SINEG01-DICT215:B1_CHARGE", type = 'd', alias='ICT-Q')
phase0 = phase.read()
@@ -44,8 +43,8 @@ finally:
q.close()
#Setting the return value
y = charge
x = rf_phase
y = charge
index_max = y.index(max(y))
phase_ref = x[index_max] - 80