From bc75b442d9a36254101af3ac62fbfd594c14f4b0 Mon Sep 17 00:00:00 2001 From: X11MA Date: Thu, 3 Dec 2015 17:43:48 +0100 Subject: [PATCH] Closedown --- config/devices.properties | 2 +- plugins/EnergyScan.form | 171 +++++++++-------------- plugins/EnergyScan.java | 283 +++++++++----------------------------- script/EnergyScan.py | 15 +- script/local.py | 4 +- 5 files changed, 147 insertions(+), 328 deletions(-) diff --git a/config/devices.properties b/config/devices.properties index 219787f..0a269f7 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -2,4 +2,4 @@ energy=ch.psi.pshell.epics.ChannelDouble|X11MA-PGM:rbkenergy|Read||true keithley_1a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true keithley_2a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true keithley_3a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true -otf_start=ch.psi.pshell.epics.ChannelInteger|X11MA-OTF:GO|Read|1000|true +otf_start=ch.psi.pshell.epics.ChannelInteger|X11MA-OTF:GO|Read||true diff --git a/plugins/EnergyScan.form b/plugins/EnergyScan.form index 402cfab..f33cc53 100644 --- a/plugins/EnergyScan.form +++ b/plugins/EnergyScan.form @@ -20,22 +20,15 @@ - - - - - + - - - - + @@ -60,48 +53,60 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + + - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + - @@ -128,14 +133,18 @@ - + - - - - + + + + + + + + @@ -229,10 +238,13 @@ - + + + + @@ -250,79 +262,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + - - - - + - - - - - - - - - - - @@ -339,12 +302,12 @@ - + - + diff --git a/plugins/EnergyScan.java b/plugins/EnergyScan.java index c3faf72..0fe3ce6 100644 --- a/plugins/EnergyScan.java +++ b/plugins/EnergyScan.java @@ -5,25 +5,15 @@ import java.awt.Component; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.HashMap; import java.util.logging.Level; import javax.swing.JLabel; import ch.psi.utils.State; import ch.psi.utils.swing.Editor.EditorDialog; -import ch.psi.pshell.data.PlotDescriptor; -import ch.psi.pshell.device.Device; -import ch.psi.pshell.device.DeviceAdapter; -import ch.psi.pshell.epics.ChannelDouble; -import ch.psi.pshell.epics.ChannelInteger; -import ch.psi.pshell.plot.LinePlot; import ch.psi.pshell.plot.LinePlotBase; import ch.psi.pshell.plot.LinePlotSeries; import ch.psi.pshell.plot.Plot; import ch.psi.pshell.ui.Panel; -import ch.psi.utils.Chrono; -import java.util.logging.Logger; -import javax.swing.SwingUtilities; /** * @@ -34,12 +24,6 @@ public class EnergyScan extends Panel { initComponents(); } - long start; - ChannelDouble k1; - ChannelDouble k2; - ChannelDouble k3; - ChannelDouble energy; - ChannelInteger otf_start; double[] offsets = new double[4]; double energyCache = 0; @@ -48,57 +32,6 @@ public class EnergyScan extends Panel { @Override public void onInitialize(int runCount) { super.onInitialize(runCount); - - k1 = (ChannelDouble) getController().getDevicePool().getByName("keithley_1a"); - k2 = (ChannelDouble) getController().getDevicePool().getByName("keithley_2a"); - k3 = (ChannelDouble) getController().getDevicePool().getByName("keithley_3a"); - energy = (ChannelDouble) getController().getDevicePool().getByName("energy"); - otf_start = (ChannelInteger) getController().getDevicePool().getByName("otf_start"); - /* - otf_start.addListener(new DeviceAdapter() { - @Override - public void onValueChanged(Device device, Object value, Object former) { - if (((Integer) value) == 1) { - SwingUtilities.invokeLater(() -> { - try { - startPlot(); - } catch (Exception ex) { - Logger.getLogger(EnergyScan.class.getName()).log(Level.SEVERE, null, ex); - } - }); - } - } - });*/ - for (Device dev : new Device[]{energy}) { - dev.addListener(new DeviceAdapter() { - @Override - public void onValueChanged(Device device, Object value, Object former) { - try { - if (Math.abs(energyCache - ((Double) value)) > 0.1) { - if (radioK3.isSelected()) { - k3.update(); - } else { - k1.update(); - } - k2.update(); - energyCache = (Double) value; - if (otf_start.take() == 1) { - SwingUtilities.invokeLater(() -> { - plot(); - }); - update(); - } - } - } catch (Exception ex) { - Logger.getLogger(EnergyScan.class.getName()).log(Level.SEVERE, null, ex); - } - } - }); - } - - start = System.currentTimeMillis(); - - plot(); } @Override @@ -145,30 +78,10 @@ public class EnergyScan extends Panel { } } //spinnerAlpha.setEnabled(enabled && comboMode.getSelectedItem().equals("LINEAR")); - } + } double last = 0; - void plot() { - try { - if ((scanPlot != null) && (scanSeries != null)) { - //if ((scanPlot != null) && (scanSeries != null) && scanPlot.isShowing() && (count != null)) { - double x = energy.take(); - if (last < (x -10.0)){ - if (scanSeries!=null){ - scanSeries.clear(); - } - } - last = x; - double y = k2.take() / ((radioK3.isSelected()) ? k3.take() : k1.take()); - scanSeries.appendData(x, y); - - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - void run() throws Exception { HashMap args = new HashMap(); @@ -182,7 +95,8 @@ public class EnergyScan extends Panel { args.put("OFFSET2", (Double) spinnerOffset2.getValue()); args.put("RUNTYPE", comboRunType.getSelectedItem().toString()); args.put("ROUNDS", (Integer) spinnerRounds.getValue()); - + args.put("PLOT_TYPE", radioK1.isSelected() ? 1 : 2); + buttonAbort.setEnabled(true); runAsync("EnergyScan", args).handle((ok, ex) -> { @@ -204,14 +118,6 @@ public class EnergyScan extends Panel { } } - void startPlot() throws Exception { - PlotDescriptor descriptors = new PlotDescriptor("Energy Scan"); - //ArrayList plots = getController().plot(new PlotDescriptor[]{descriptors}, Chrono.getTimeStr(System.currentTimeMillis(), "hh:mm:ss")); - ArrayList plots = getController().plot(new PlotDescriptor[]{descriptors}, null); - scanPlot = (LinePlotBase) plots.get(0); - scanSeries = scanPlot.getSeries(0); - } - @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -234,10 +140,9 @@ public class EnergyScan extends Panel { comboRunType = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); spinnerRounds = new javax.swing.JSpinner(); - jPanel2 = new javax.swing.JPanel(); + jLabel12 = new javax.swing.JLabel(); radioK1 = new javax.swing.JRadioButton(); radioK3 = new javax.swing.JRadioButton(); - buttonPlot = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); buttonExecute = new javax.swing.JButton(); buttonAbort = new javax.swing.JButton(); @@ -276,13 +181,23 @@ public class EnergyScan extends Panel { jLabel11.setText("Run Type:"); - comboRunType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "+/-", "+", "-" })); + comboRunType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "+/-", "+", "-", "LH/LV", "LH", "LV" })); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("Rounds:"); spinnerRounds.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1)); + jLabel12.setText("Plot Type:"); + + buttonGroupPlot.add(radioK1); + radioK1.setSelected(true); + radioK1.setText("K2 / K1"); + radioK1.setMinimumSize(new java.awt.Dimension(100, 22)); + + buttonGroupPlot.add(radioK3); + radioK3.setText("K2 / K3"); + javax.swing.GroupLayout panelParametersLayout = new javax.swing.GroupLayout(panelParameters); panelParameters.setLayout(panelParametersLayout); panelParametersLayout.setHorizontalGroup( @@ -291,38 +206,47 @@ public class EnergyScan extends Panel { .addContainerGap() .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelParametersLayout.createSequentialGroup() - .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(panelParametersLayout.createSequentialGroup() - .addComponent(jLabel8) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(spinnerOffset1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelParametersLayout.createSequentialGroup() + .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(panelParametersLayout.createSequentialGroup() + .addComponent(jLabel8) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinnerOffset1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(panelParametersLayout.createSequentialGroup() + .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spinnerE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(spinnerTime, javax.swing.GroupLayout.Alignment.TRAILING, 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(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(spinnerE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(spinnerTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE) - .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(spinnerE2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(spinnerDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(spinnerOffset2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(spinnerE2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(spinnerDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(spinnerOffset2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(panelParametersLayout.createSequentialGroup() + .addComponent(jLabel11) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(panelParametersLayout.createSequentialGroup() - .addComponent(jLabel11) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(41, Short.MAX_VALUE)) + .addComponent(jLabel12) + .addGap(18, 18, 18) + .addComponent(radioK1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(radioK3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerE1, spinnerTime}); @@ -331,6 +255,8 @@ public class EnergyScan extends Panel { panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerDelay, spinnerE2, spinnerOffset1, spinnerOffset2, spinnerRounds}); + panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {radioK1, radioK3}); + panelParametersLayout.setVerticalGroup( panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelParametersLayout.createSequentialGroup() @@ -351,67 +277,17 @@ public class EnergyScan extends Panel { .addComponent(spinnerOffset1) .addComponent(jLabel13) .addComponent(spinnerOffset2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(55, 55, 55) + .addGap(35, 35, 35) .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) - .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap()) - ); - - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Plot Options")); - - buttonGroupPlot.add(radioK1); - radioK1.setSelected(true); - radioK1.setText("K1"); - radioK1.setMinimumSize(new java.awt.Dimension(100, 22)); - radioK1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - radioPlotActionPerformed(evt); - } - }); - - buttonGroupPlot.add(radioK3); - radioK3.setText("K3"); - radioK3.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - radioPlotActionPerformed(evt); - } - }); - - buttonPlot.setText("Clear"); - buttonPlot.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonPlotActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(buttonPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(radioK1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(radioK3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(30, Short.MAX_VALUE)) - ); - - jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {radioK1, radioK3}); - - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(radioK1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(radioK3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 129, Short.MAX_VALUE) - .addComponent(buttonPlot) + .addComponent(jLabel5) + .addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(20, 20, 20) + .addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(radioK1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(radioK3)) .addContainerGap()) ); @@ -437,11 +313,11 @@ public class EnergyScan extends Panel { jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap(231, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonExecute, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(231, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -457,31 +333,22 @@ public class EnergyScan extends Panel { this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(16, 16, 16) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - - layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jPanel2, panelParameters}); - }// //GEN-END:initComponents private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed try { - startPlot(); run(); } catch (Exception ex) { showException(ex); @@ -493,38 +360,20 @@ public class EnergyScan extends Panel { }//GEN-LAST:event_buttonAbortActionPerformed EditorDialog dlgConfig; - private void buttonPlotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPlotActionPerformed - try { - //startPlot(); - //plot(); - if (scanSeries!=null){ - scanSeries.clear(); - } - } catch (Exception ex) { - showException(ex); - } - - }//GEN-LAST:event_buttonPlotActionPerformed - - private void radioPlotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioPlotActionPerformed - plot(); - }//GEN-LAST:event_radioPlotActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAbort; private javax.swing.JButton buttonExecute; private javax.swing.ButtonGroup buttonGroupPlot; - private javax.swing.JButton buttonPlot; private javax.swing.JComboBox comboRunType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel8; - private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel panelParameters; private javax.swing.JRadioButton radioK1; diff --git a/script/EnergyScan.py b/script/EnergyScan.py index 6409327..8dbe02c 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -146,12 +146,19 @@ for scan_no in range(number_of_scans): startPlot(PLOT_TYPE) #Start the OTF scan - caput(OTF_START, 'GO') + #caput(OTF_START, 'GO') + otf_start.write(1) - #Wait until scan is done - wait_channel(OTF_START, 'STOP', type = 's') + try: + #wait_channel(OTF_START, 'STOP', timeout = int(TIME*60), type = 's') + otf_start.waitValue(0, 30 + int(TIME*60)) + except: + print "******** OTF STOP TIMEOUT **********" + otf_start.write(0) + finally: + stopPlot() time.sleep(3.0) - stopPlot() + #Convert file output_file = output_path+"os"+file_prefix+"_" + suffix + ".dat" diff --git a/script/local.py b/script/local.py index 4fac238..e6bc5d0 100644 --- a/script/local.py +++ b/script/local.py @@ -45,9 +45,9 @@ def get_next_fid(folder, prefix): except: return 0 -def wait_channel(name, value, type): +def wait_channel(name, value, timeout =None, type='s'): print "Waiting " + str(name) + " = " + str(value) - cawait(name, value, type = type) + cawait(name, value, timeout, type) print "Done" def convert_file(input_file_name, output_file_name, field = 0, pol = 0, keithley_3 = False):