Closedown
This commit is contained in:
@@ -2,4 +2,3 @@ Fe=690.0;755.0;2.0;10.0;0.0;2.0;2.0;2.0
|
||||
Ti=400.0;475.0;2.0;10.0;0.0;2.0;2.0;2.0
|
||||
Er=1380.0;1470.0;3.0;10.0;-11.0;-5.5;4.0;4.0
|
||||
Ta=1700.0;1820.0;3.0;10.0;-11.0;-5.5;4.0;4.0
|
||||
Fe 123=0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0
|
||||
|
||||
@@ -457,7 +457,7 @@
|
||||
<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="Data"/>
|
||||
<TitledBorder title="File"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
@@ -468,16 +468,10 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel7" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="textFolder" max="32767" attributes="0"/>
|
||||
<Component id="textFile" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="textFile" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -492,11 +486,6 @@
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textFile" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<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="textFolder" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDefaults" alignment="3" min="-2" pref="27" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@@ -507,7 +496,7 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="buttonDefaults">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Defaults"/>
|
||||
<Property name="text" type="java.lang.String" value="Default"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDefaultsActionPerformed"/>
|
||||
@@ -521,14 +510,6 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textFile">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Folder:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textFolder">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
|
||||
@@ -3,17 +3,14 @@
|
||||
*/
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JLabel;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.DsvEditor;
|
||||
import ch.psi.utils.swing.Editor.EditorDialog;
|
||||
@@ -28,6 +25,9 @@ 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 java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,17 +46,19 @@ public class EnergyScan extends Panel {
|
||||
ChannelInteger count;
|
||||
|
||||
double[] offsets = new double[4];
|
||||
|
||||
/*
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
*/
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
super.onInitialize(runCount);
|
||||
|
||||
loadConfig();
|
||||
|
||||
count = (ChannelInteger) getController().getDevicePool().getByName("count");
|
||||
data = (ChannelDoubleArray) getController().getDevicePool().getByName("data");
|
||||
@@ -145,7 +147,6 @@ public class EnergyScan extends Panel {
|
||||
comboRunType.setEnabled(value);
|
||||
buttonConfigure.setEnabled(value);
|
||||
textFile.setEnabled(value);
|
||||
textFolder.setEnabled(value);
|
||||
buttonDefaults.setEnabled(value);
|
||||
buttonPlot.setEnabled(value);
|
||||
checkParameterControls();
|
||||
@@ -237,12 +238,7 @@ public class EnergyScan extends Panel {
|
||||
} else {
|
||||
mode = "lin_" + String.format("%1.0f", (Double) spinnerAlpha.getValue());
|
||||
}
|
||||
|
||||
path = path.replaceAll("\\{date\\}", Chrono.getTimeStr(time, "YYYYMMdd"));
|
||||
path = path.replaceAll("\\{time\\}", Chrono.getTimeStr(time, "HHmmss"));
|
||||
path = path.replaceAll("\\{year\\}", Chrono.getTimeStr(time, "YYYY"));
|
||||
path = path.replaceAll("\\{month\\}", Chrono.getTimeStr(time, "MM"));
|
||||
path = path.replaceAll("\\{day\\}", Chrono.getTimeStr(time, "dd"));
|
||||
path = getController().getSetup().expandPath(path);
|
||||
path = path.replaceAll("\\{el\\}", String.valueOf(comboSetup.getSelectedItem()));
|
||||
path = path.replaceAll("\\{mode\\}", mode);
|
||||
return path;
|
||||
@@ -276,23 +272,31 @@ public class EnergyScan extends Panel {
|
||||
}
|
||||
|
||||
void setElement() throws Exception {
|
||||
Properties prop = new Properties();
|
||||
prop.load(new FileInputStream(getConfigFile().toFile()));
|
||||
String selection = comboSetup.getSelectedItem().toString();
|
||||
String val = prop.getProperty(selection);
|
||||
String[] tokens = val.split(";");
|
||||
if (tokens.length != 8) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
spinnerE1.setValue(Double.valueOf(tokens[0].trim()));
|
||||
spinnerE2.setValue(Double.valueOf(tokens[1].trim()));
|
||||
spinnerTime.setValue(Double.valueOf(tokens[2].trim()));
|
||||
spinnerDelay.setValue(Double.valueOf(tokens[3].trim()));
|
||||
for (String line : Files.readAllLines(getConfigFile())) {
|
||||
if ((line != null) && (!line.trim().isEmpty())) {
|
||||
String[] tokens = line.split("=");
|
||||
if (tokens.length <2) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
if (tokens[0].equals(selection)){
|
||||
tokens = tokens[1].trim().split(";");
|
||||
if (tokens.length != 8) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
spinnerE1.setValue(Double.valueOf(tokens[0].trim()));
|
||||
spinnerE2.setValue(Double.valueOf(tokens[1].trim()));
|
||||
spinnerTime.setValue(Double.valueOf(tokens[2].trim()));
|
||||
spinnerDelay.setValue(Double.valueOf(tokens[3].trim()));
|
||||
|
||||
offsets[0] = Double.valueOf(tokens[4].trim());
|
||||
offsets[1] = Double.valueOf(tokens[5].trim());
|
||||
offsets[2] = Double.valueOf(tokens[6].trim());
|
||||
offsets[3] = Double.valueOf(tokens[7].trim());
|
||||
offsets[0] = Double.valueOf(tokens[4].trim());
|
||||
offsets[1] = Double.valueOf(tokens[5].trim());
|
||||
offsets[2] = Double.valueOf(tokens[6].trim());
|
||||
offsets[3] = Double.valueOf(tokens[7].trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setRunType() throws Exception {
|
||||
@@ -341,8 +345,7 @@ public class EnergyScan extends Panel {
|
||||
|
||||
String file = expandPath(textFile.getText());
|
||||
args.put("FILE", file);
|
||||
|
||||
String folder = expandPath(textFolder.getText());
|
||||
String folder = expandPath("{year}_{month}/{date}");
|
||||
args.put("FOLDER", folder);
|
||||
scanStartTimestamp = System.currentTimeMillis();
|
||||
buttonAbort.setEnabled(true);
|
||||
@@ -404,8 +407,6 @@ public class EnergyScan extends Panel {
|
||||
buttonDefaults = new javax.swing.JButton();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
textFile = new javax.swing.JTextField();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
textFolder = new javax.swing.JTextField();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
buttonExecute = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
@@ -664,9 +665,9 @@ public class EnergyScan extends Panel {
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelData.setBorder(javax.swing.BorderFactory.createTitledBorder("Data"));
|
||||
panelData.setBorder(javax.swing.BorderFactory.createTitledBorder("File"));
|
||||
|
||||
buttonDefaults.setText("Defaults");
|
||||
buttonDefaults.setText("Default");
|
||||
buttonDefaults.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDefaultsActionPerformed(evt);
|
||||
@@ -676,9 +677,6 @@ public class EnergyScan extends Panel {
|
||||
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel6.setText("File:");
|
||||
|
||||
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel7.setText("Folder:");
|
||||
|
||||
javax.swing.GroupLayout panelDataLayout = new javax.swing.GroupLayout(panelData);
|
||||
panelData.setLayout(panelDataLayout);
|
||||
panelDataLayout.setHorizontalGroup(
|
||||
@@ -686,31 +684,20 @@ public class EnergyScan extends Panel {
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(jLabel6)
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addGap(55, 55, 55)
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(textFolder)
|
||||
.addComponent(textFile))))
|
||||
.addComponent(textFile)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDefaults)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelDataLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel6, jLabel7});
|
||||
|
||||
panelDataLayout.setVerticalGroup(
|
||||
panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(textFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonDefaults, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
@@ -821,9 +808,11 @@ public class EnergyScan extends Panel {
|
||||
|
||||
private void comboSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSetupActionPerformed
|
||||
try {
|
||||
setElement();
|
||||
if (!isManualRun()) {
|
||||
setRunType();
|
||||
if (comboSetup.getSelectedItem()!=null){
|
||||
setElement();
|
||||
if (!isManualRun()) {
|
||||
setRunType();
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
@@ -841,6 +830,14 @@ public class EnergyScan extends Panel {
|
||||
dlgConfig = editor.getDialog(getView(), false);
|
||||
editor.load(getConfigFile().toString());
|
||||
editor.setTitle("Energy Scan Configuration");
|
||||
dlgConfig.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
if (System.currentTimeMillis() - new File(dlgConfig.getEditor().getFileName()).lastModified() < 5000){
|
||||
loadConfig();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
dlgConfig.setSize(680, 320);
|
||||
showWindow(dlgConfig);
|
||||
@@ -870,7 +867,6 @@ public class EnergyScan extends Panel {
|
||||
|
||||
private void buttonDefaultsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultsActionPerformed
|
||||
textFile.setText("{el}_{mode}");
|
||||
textFolder.setText("{year}_{month}/{date}");
|
||||
}//GEN-LAST:event_buttonDefaultsActionPerformed
|
||||
|
||||
private void buttonPlotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPlotActionPerformed
|
||||
@@ -901,7 +897,6 @@ public class EnergyScan extends Panel {
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
@@ -921,6 +916,5 @@ public class EnergyScan extends Panel {
|
||||
private javax.swing.JSpinner spinnerOffset;
|
||||
private javax.swing.JSpinner spinnerTime;
|
||||
private javax.swing.JTextField textFile;
|
||||
private javax.swing.JTextField textFolder;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
<Component id="panelParameters" max="32767" attributes="0"/>
|
||||
<Component id="panelData" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
@@ -25,8 +27,12 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelData" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="10" max="32767" attributes="0"/>
|
||||
<Component id="jPanel3" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -197,7 +203,7 @@
|
||||
<Component class="javax.swing.JSpinner" name="spinnerRampRate">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="2.0" maximum="100.0" minimum="0.01" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
<SpinnerModel initial="0.02" maximum="100.0" minimum="0.01" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@@ -223,14 +229,14 @@
|
||||
<Component class="javax.swing.JSpinner" name="spinnerStartField">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="-0.2" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
|
||||
<SpinnerModel initial="-0.01" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerEndField">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0.2" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
|
||||
<SpinnerModel initial="0.01" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@@ -341,5 +347,143 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="panelData">
|
||||
<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="File"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<Component id="textFile" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonDefaults" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textFile" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDefaults" alignment="3" min="-2" pref="27" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="buttonDefaults">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Default"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDefaultsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="File:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textFile">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<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="Setup"/>
|
||||
</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"/>
|
||||
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="comboSetup" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="comboRunType" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="comboSetup" 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="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboRunType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="comboSetup">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboSetupActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel11">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Element:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel12">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Run Type:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<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">
|
||||
<StringItem index="0" value="Manual"/>
|
||||
<StringItem index="1" value="2-loop"/>
|
||||
<StringItem index="2" value="4-loop"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboRunTypeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.core.Controller;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import java.awt.Component;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.script.ScriptException;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
@@ -19,12 +27,13 @@ public class HystScan extends Panel {
|
||||
|
||||
public HystScan() {
|
||||
initComponents();
|
||||
buttonDefaultsActionPerformed(null);
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,6 +61,103 @@ public class HystScan extends Panel {
|
||||
}
|
||||
spinnerE3.setEnabled(value && checkE3.isSelected());
|
||||
}
|
||||
|
||||
Path getConfigFile() {
|
||||
return Paths.get(getController().getSetup().getConfigPath(), "energy_scan.properties");
|
||||
}
|
||||
|
||||
void loadConfig() {
|
||||
DefaultComboBoxModel model = (DefaultComboBoxModel) comboSetup.getModel();
|
||||
model.removeAllElements();
|
||||
try {
|
||||
for (String line : Files.readAllLines(getConfigFile())) {
|
||||
if ((line != null) && (!line.trim().isEmpty())) {
|
||||
String[] tokens = line.split("=");
|
||||
if (tokens.length > 0) {
|
||||
model.addElement(tokens[0].trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
String expandPath(String path) {
|
||||
long time = System.currentTimeMillis();
|
||||
String mode;
|
||||
if (comboMode.getSelectedIndex() == 0) {
|
||||
mode = "plus";
|
||||
} else { //if (comboMode.getSelectedIndex() == 1) {
|
||||
mode = "minus";
|
||||
}
|
||||
path = getController().getSetup().expandPath(path);
|
||||
path = path.replaceAll("\\{el\\}", String.valueOf(comboSetup.getSelectedItem()));
|
||||
path = path.replaceAll("\\{mode\\}", mode);
|
||||
return path;
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
|
||||
plus,
|
||||
minus,
|
||||
}
|
||||
|
||||
Mode[] batch;
|
||||
int batchIndex;
|
||||
double[] offsets = new double[2];
|
||||
|
||||
|
||||
boolean isManualRun() {
|
||||
return (comboRunType.getSelectedIndex() == 0);
|
||||
}
|
||||
|
||||
void setElement() throws Exception {
|
||||
String selection = comboSetup.getSelectedItem().toString();
|
||||
for (String line : Files.readAllLines(getConfigFile())) {
|
||||
if ((line != null) && (!line.trim().isEmpty())) {
|
||||
String[] tokens = line.split("=");
|
||||
if (tokens.length <2) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
if (tokens[0].equals(selection)){
|
||||
tokens = tokens[1].trim().split(";");
|
||||
if (tokens.length != 8) {
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
offsets[0] = Double.valueOf(tokens[4].trim());
|
||||
offsets[1] = Double.valueOf(tokens[5].trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setMode(Mode mode) {
|
||||
switch (mode) {
|
||||
case plus:
|
||||
comboMode.setSelectedIndex(0);
|
||||
spinnerOffset.setValue(offsets[0]);
|
||||
return;
|
||||
case minus:
|
||||
comboMode.setSelectedIndex(1);
|
||||
spinnerOffset.setValue(offsets[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void setRunType() throws Exception {
|
||||
switch (comboRunType.getSelectedIndex()) {
|
||||
case 0: //Manual
|
||||
break;
|
||||
case 1: //2-loop
|
||||
setMode(Mode.plus);
|
||||
break;
|
||||
case 2: //4-loop
|
||||
setMode(Mode.minus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -79,6 +185,15 @@ public class HystScan extends Panel {
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
buttonExecute = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
panelData = new javax.swing.JPanel();
|
||||
buttonDefaults = new javax.swing.JButton();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
textFile = new javax.swing.JTextField();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
comboSetup = new javax.swing.JComboBox();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
jLabel12 = new javax.swing.JLabel();
|
||||
comboRunType = new javax.swing.JComboBox();
|
||||
|
||||
panelParameters.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
|
||||
|
||||
@@ -95,7 +210,7 @@ public class HystScan extends Panel {
|
||||
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel8.setText("Ramp Rate:");
|
||||
|
||||
spinnerRampRate.setModel(new javax.swing.SpinnerNumberModel(2.0d, 0.01d, 100.0d, 1.0d));
|
||||
spinnerRampRate.setModel(new javax.swing.SpinnerNumberModel(0.02d, 0.01d, 100.0d, 1.0d));
|
||||
|
||||
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel9.setText("Energy Change Sleep:");
|
||||
@@ -105,9 +220,9 @@ public class HystScan extends Panel {
|
||||
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel3.setText("Start Field:");
|
||||
|
||||
spinnerStartField.setModel(new javax.swing.SpinnerNumberModel(-0.2d, -10.0d, 10.0d, 0.1d));
|
||||
spinnerStartField.setModel(new javax.swing.SpinnerNumberModel(-0.01d, -10.0d, 10.0d, 0.1d));
|
||||
|
||||
spinnerEndField.setModel(new javax.swing.SpinnerNumberModel(0.2d, -10.0d, 10.0d, 0.1d));
|
||||
spinnerEndField.setModel(new javax.swing.SpinnerNumberModel(0.01d, -10.0d, 10.0d, 0.1d));
|
||||
|
||||
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel4.setText("End Field:");
|
||||
@@ -267,30 +382,124 @@ public class HystScan extends Panel {
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelData.setBorder(javax.swing.BorderFactory.createTitledBorder("File"));
|
||||
|
||||
buttonDefaults.setText("Default");
|
||||
buttonDefaults.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDefaultsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel6.setText("File:");
|
||||
|
||||
javax.swing.GroupLayout panelDataLayout = new javax.swing.GroupLayout(panelData);
|
||||
panelData.setLayout(panelDataLayout);
|
||||
panelDataLayout.setHorizontalGroup(
|
||||
panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel6)
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addGap(55, 55, 55)
|
||||
.addComponent(textFile)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDefaults)
|
||||
.addContainerGap())
|
||||
);
|
||||
panelDataLayout.setVerticalGroup(
|
||||
panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataLayout.createSequentialGroup()
|
||||
.addGroup(panelDataLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(textFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonDefaults, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
|
||||
|
||||
comboSetup.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboSetupActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel11.setText("Element:");
|
||||
|
||||
jLabel12.setText("Run Type:");
|
||||
|
||||
comboRunType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Manual", "2-loop", "4-loop" }));
|
||||
comboRunType.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboRunTypeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel11)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(comboSetup, 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(jLabel12)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel11)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel12)
|
||||
.addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel3, 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)
|
||||
.addComponent(panelData, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, 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)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(panelData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
|
||||
try {
|
||||
String file = expandPath(textFile.getText());
|
||||
eval("FILENAME = '" + file+"'");
|
||||
|
||||
HashMap args = new HashMap();
|
||||
Double e1 = (Double) spinnerE1.getValue();
|
||||
Double e2 = (Double) spinnerE2.getValue();
|
||||
//args.put("E1", e1);
|
||||
//args.put("E2", e2);
|
||||
//args.put("E2", e2);
|
||||
|
||||
ArrayList<Double> energies = new ArrayList<>();
|
||||
energies.add(e1);
|
||||
energies.add(e2);
|
||||
@@ -304,7 +513,7 @@ public class HystScan extends Panel {
|
||||
args.put("RAMP_RATE", (Double) spinnerRampRate.getValue());
|
||||
args.put("ENERGY_CHANGE_SLEEP", (Double) spinnerSleep.getValue());
|
||||
args.put("MODE", comboMode.getSelectedItem().toString());
|
||||
args.put("OFFSET", (Double) spinnerOffset.getValue());
|
||||
args.put("OFFSET", (Double) spinnerOffset.getValue());
|
||||
buttonAbort.setEnabled(true);
|
||||
buttonExecute.setEnabled(false);
|
||||
runAsync("HystScan", args).handle((ok, ex) -> {
|
||||
@@ -312,6 +521,11 @@ public class HystScan extends Panel {
|
||||
if (ex != null) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
try {
|
||||
eval("FILENAME = None");
|
||||
} catch (Exception ex1) {
|
||||
Logger.getLogger(HystScan.class.getName()).log(Level.WARNING, null, ex1);
|
||||
}
|
||||
return ok;
|
||||
});
|
||||
|
||||
@@ -328,20 +542,56 @@ public class HystScan extends Panel {
|
||||
spinnerE3.setEnabled(checkE3.isSelected());
|
||||
}//GEN-LAST:event_checkE3ActionPerformed
|
||||
|
||||
private void buttonDefaultsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultsActionPerformed
|
||||
textFile.setText("{el}_hyst_{mode}");
|
||||
}//GEN-LAST:event_buttonDefaultsActionPerformed
|
||||
|
||||
private void comboSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSetupActionPerformed
|
||||
try {
|
||||
if (comboSetup.getSelectedItem()!=null){
|
||||
setElement();
|
||||
if (!isManualRun()) {
|
||||
setRunType();
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboSetupActionPerformed
|
||||
|
||||
private void comboRunTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboRunTypeActionPerformed
|
||||
try {
|
||||
if (!isManualRun()) {
|
||||
setElement();
|
||||
}
|
||||
setRunType();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboRunTypeActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonDefaults;
|
||||
private javax.swing.JButton buttonExecute;
|
||||
private javax.swing.JCheckBox checkE3;
|
||||
private javax.swing.JComboBox comboMode;
|
||||
private javax.swing.JComboBox comboRunType;
|
||||
private javax.swing.JComboBox comboSetup;
|
||||
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;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel panelData;
|
||||
private javax.swing.JPanel panelParameters;
|
||||
private javax.swing.JSpinner spinnerE1;
|
||||
private javax.swing.JSpinner spinnerE2;
|
||||
@@ -351,5 +601,6 @@ public class HystScan extends Panel {
|
||||
private javax.swing.JSpinner spinnerRampRate;
|
||||
private javax.swing.JSpinner spinnerSleep;
|
||||
private javax.swing.JSpinner spinnerStartField;
|
||||
private javax.swing.JTextField textFile;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
###################################################################################################
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
MODE = None
|
||||
FILENAME = None
|
||||
|
||||
#Uncomment this line to create the simulated devices needed to the tutorial scripts.
|
||||
#run("tutorial/devices")
|
||||
@@ -13,11 +13,9 @@ class Strategy(ch.psi.pshell.data.ScanPersistenceStrategyTable):
|
||||
return time.strftime('%Y%m%d%H%M%S') + '_' + controller.getExecutingContext() + '_logs'
|
||||
|
||||
def getDatasetName(self, scan):
|
||||
print scan
|
||||
mode = None
|
||||
if MODE is not None:
|
||||
mode = "plus" if (MODE == "CIRC +") else "minus"
|
||||
return time.strftime('%Y%m%d%H%M%S') + '_' + controller.getExecutingContext() +'_' + str(mode) + '_' + str(controller.dataManager.getScanIndex()).zfill(4)
|
||||
global FILENAME
|
||||
name = controller.getExecutingContext() if FILENAME is None else FILENAME
|
||||
return time.strftime('%Y%m%d%H%M%S') + '_' + FILENAME + '_' + str(controller.dataManager.getScanIndex()).zfill(4)
|
||||
|
||||
|
||||
controller.dataManager.setScanStrategy(Strategy())
|
||||
|
||||
Reference in New Issue
Block a user