Closedown

This commit is contained in:
voulot_d
2017-04-04 09:02:26 +02:00
parent 2c2a0757c8
commit 3c3392b487
5 changed files with 93 additions and 44 deletions
+7 -7
View File
@@ -1,10 +1,10 @@
#Mon Apr 03 11:46:51 CEST 2017
#Tue Apr 04 08:55:11 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=1000.0
colormapMin=10.0
flipHorizontally=false
flipVertically=false
flipHorizontally=true
flipVertically=true
grayscale=false
imageHeight=2160
imageWidth=2560
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-630.5060320164276
spatialCalOffsetY=-612.5104241897614
spatialCalScaleX=-26.761820720381525
spatialCalScaleY=-26.595744663521685
spatialCalOffsetX=-1223.0
spatialCalOffsetY=-1024.0
spatialCalScaleX=-8.784773060029282
spatialCalScaleY=-8.74794969928923
spatialCalUnits=mm
transpose=false
+4 -4
View File
@@ -29,7 +29,7 @@
<Group type="102" attributes="0">
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStop" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -51,7 +51,7 @@
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@@ -293,9 +293,9 @@
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonStop">
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Stop"/>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
</Component>
</SubComponents>
+55 -7
View File
@@ -2,6 +2,13 @@
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.DescStatsDouble;
import ch.psi.pshell.plot.LinePlotErrorSeries;
import ch.psi.pshell.plot.LinePlotJFree;
import ch.psi.pshell.plot.Plot;
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.State;
@@ -9,20 +16,30 @@ import ch.psi.utils.State;
*
*/
public class GunScan extends Panel {
LinePlotErrorSeries series = new LinePlotErrorSeries("Values");
public GunScan() {
initComponents();
plot.setStyle(LinePlotJFree.Style.ErrorY);
plot.addSeries(series);
plot.getAxis(Plot.AxisId.X).setLabel("Gun Phase");
plot.getAxis(Plot.AxisId.Y).setLabel("MeV");
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
buttonAbort.setEnabled(state.isProcessing());
buttonStart.setEnabled(state == State.Ready);
spinnerStart.setEnabled(buttonStart.isEnabled());
spinnerStop.setEnabled(buttonStart.isEnabled());
spinnerStep.setEnabled(buttonStart.isEnabled());
spinnerSamples.setEnabled(buttonStart.isEnabled());
spinnerLatency.setEnabled(buttonStart.isEnabled());
}
@Override
@@ -34,6 +51,37 @@ public class GunScan extends Panel {
@Override
protected void doUpdate() {
}
@Override
public void onStart() {
super.onStart();
getContext().addScanListener(scanListener);
}
@Override
public void onStop() {
getContext().removeScanListener(scanListener);
super.onStop();
}
ScanListener scanListener = new ScanListener() {
@Override
public void onScanStarted(Scan scan, String plotTitle) {
if ("GunScan".equals(getContext().getExecutionPars().getName())){
series.clear();
}
}
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
if ("GunScan".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
@@ -57,7 +105,7 @@ public class GunScan extends Panel {
dispersionLabel = new javax.swing.JLabel();
plot = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart = new javax.swing.JButton();
buttonStop = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(737, 445));
@@ -184,7 +232,7 @@ public class GunScan extends Panel {
buttonStart.setText("Start");
buttonStop.setText("Stop");
buttonAbort.setText("Abort");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
@@ -198,7 +246,7 @@ public class GunScan extends Panel {
.addGroup(layout.createSequentialGroup()
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStop)))
.addComponent(buttonAbort)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
@@ -216,7 +264,7 @@ public class GunScan extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
.addComponent(buttonStop))))
.addComponent(buttonAbort))))
.addGap(14, 14, 14))
);
@@ -224,8 +272,8 @@ public class GunScan extends Panel {
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonStart;
private javax.swing.JButton buttonStop;
private javax.swing.JLabel dispersionLabel;
private javax.swing.JLabel energyLabel;
private javax.swing.JPanel jPanel1;
+14 -13
View File
@@ -89,29 +89,30 @@
<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"/>
<EmptySpace 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="jLabel2" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStop" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStep" 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"/>
<EmptySpace 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"/>
<EmptySpace 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"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStep" linkSize="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStop" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
+13 -13
View File
@@ -70,7 +70,7 @@ public class SchottkyScan extends Panel {
super.onStop();
}
ScanListener scanListener = new ScanListener() {
ScanListener scanListener = new ScanListener() {
@Override
public void onScanStarted(Scan scan, String plotTitle) {
if ("SchottkyScan".equals(getContext().getExecutionPars().getName())){
@@ -162,24 +162,24 @@ public class SchottkyScan extends Panel {
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(0, 0, 0)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(0, 0, 0)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, 0)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(1, 1, 1)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);