Closedown

This commit is contained in:
X11MA
2015-12-03 17:43:48 +01:00
parent 3631192d0b
commit bc75b442d9
5 changed files with 147 additions and 328 deletions
+1 -1
View File
@@ -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
+67 -104
View File
@@ -20,22 +20,15 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="panelParameters" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
</Group>
<Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
<Component id="panelParameters" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" linkSize="12" max="-2" attributes="0"/>
<Component id="panelParameters" linkSize="12" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
@@ -60,48 +53,60 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel8" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerOffset1" linkSize="5" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel8" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerOffset1" linkSize="5" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE1" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE1" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerE2" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset2" linkSize="5" alignment="1" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="comboRunType" min="-2" pref="105" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRounds" linkSize="5" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="82" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE2" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset2" linkSize="5" alignment="1" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="comboRunType" min="-2" pref="105" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRounds" linkSize="5" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="radioK1" linkSize="7" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="radioK3" linkSize="7" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="41" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -128,14 +133,18 @@
<Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboRunType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="3" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRounds" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRounds" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="radioK1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="radioK3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -229,10 +238,13 @@
<Component class="javax.swing.JComboBox" name="comboRunType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringArray count="6">
<StringItem index="0" value="+/-"/>
<StringItem index="1" value="+"/>
<StringItem index="2" value="-"/>
<StringItem index="3" value="LH/LV"/>
<StringItem index="4" value="LH"/>
<StringItem index="5" value="LV"/>
</StringArray>
</Property>
</Properties>
@@ -250,79 +262,30 @@
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<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">
<TitledBorder title="Plot Options"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonPlot" max="32767" attributes="0"/>
<Component id="radioK1" linkSize="7" alignment="0" max="32767" attributes="0"/>
<Component id="radioK3" linkSize="7" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="radioK1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="radioK3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="129" max="32767" attributes="0"/>
<Component id="buttonPlot" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="text" type="java.lang.String" value="Plot Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="radioK1">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="K1"/>
<Property name="text" type="java.lang.String" value="K2 / K1"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 22]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioK3">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="K3"/>
<Property name="text" type="java.lang.String" value="K2 / K3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioPlotActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPlot">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPlotActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
@@ -339,12 +302,12 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="231" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonAbort" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="buttonExecute" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="231" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
+66 -217
View File
@@ -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<LinePlot> plots = getController().plot(new PlotDescriptor[]{descriptors}, Chrono.getTimeStr(System.currentTimeMillis(), "hh:mm:ss"));
ArrayList<LinePlot> plots = getController().plot(new PlotDescriptor[]{descriptors}, null);
scanPlot = (LinePlotBase) plots.get(0);
scanSeries = scanPlot.getSeries(0);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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});
}// </editor-fold>//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;
+11 -4
View File
@@ -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"
+2 -2
View File
@@ -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):