From 3c3392b48790e8a7adeec13a95684a27093f1b6d Mon Sep 17 00:00:00 2001 From: voulot_d Date: Tue, 4 Apr 2017 09:02:26 +0200 Subject: [PATCH] Closedown --- devices/CurrentCamera.properties | 14 ++++---- plugins/GunScan.form | 8 ++--- plugins/GunScan.java | 62 ++++++++++++++++++++++++++++---- plugins/SchottkyScan.form | 27 +++++++------- plugins/SchottkyScan.java | 26 +++++++------- 5 files changed, 93 insertions(+), 44 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 824b2d6..5bd091c 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -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 diff --git a/plugins/GunScan.form b/plugins/GunScan.form index ccbed98..1622638 100644 --- a/plugins/GunScan.form +++ b/plugins/GunScan.form @@ -29,7 +29,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -293,9 +293,9 @@ - + - + diff --git a/plugins/GunScan.java b/plugins/GunScan.java index 8d5f2d3..f67e3fc 100644 --- a/plugins/GunScan.java +++ b/plugins/GunScan.java @@ -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") // //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 { }// //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; diff --git a/plugins/SchottkyScan.form b/plugins/SchottkyScan.form index 12ca642..9970d66 100644 --- a/plugins/SchottkyScan.form +++ b/plugins/SchottkyScan.form @@ -89,29 +89,30 @@ - + - - - - - - - - - - - + - + + + + + + + + + + + + diff --git a/plugins/SchottkyScan.java b/plugins/SchottkyScan.java index 878923e..6ad8aa4 100644 --- a/plugins/SchottkyScan.java +++ b/plugins/SchottkyScan.java @@ -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)) );