Closedown

This commit is contained in:
gac-x03da
2022-08-04 16:32:06 +02:00
parent b3af6aa114
commit 134b0e7674
10 changed files with 222 additions and 101 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
#Wed Jul 13 05:17:27 CEST 2022
LastRunDate=220713
FileSequentialNumber=13533
#Thu Aug 04 16:14:10 CEST 2022
LastRunDate=220804
FileSequentialNumber=13546
DaySequentialNumber=13
+17 -6
View File
@@ -72,7 +72,7 @@
<Component id="motorPanelPhi" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="32" max="32767" attributes="0"/>
<EmptySpace min="0" pref="36" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
@@ -189,7 +189,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkZigzag" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="103" max="32767" attributes="0"/>
<EmptySpace pref="99" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -357,7 +357,7 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonScientaSetup" pref="212" max="32767" attributes="0"/>
<Component id="buttonScientaSetup" pref="208" max="32767" attributes="0"/>
<Component id="checkImage" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkImageIntegration" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkSpectrum" alignment="0" min="-2" max="-2" attributes="0"/>
@@ -541,12 +541,13 @@
<Component id="textTotalTime" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="dvpAcqTime" linkSize="12" alignment="1" min="-2" pref="76" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="6" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="53" pref="53" max="-2" attributes="0"/>
</Group>
<Component id="buttonQueue" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -559,7 +560,9 @@
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="170" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="buttonQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="labelAcqTime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="dvpAcqTime" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -569,7 +572,7 @@
<Component id="textTotalTime" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="labelTotalTime" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="168" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
@@ -622,6 +625,14 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
+41 -14
View File
@@ -7,6 +7,7 @@ import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.epics.Scienta;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
@@ -14,6 +15,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
@@ -22,7 +24,7 @@ import javax.swing.SpinnerNumberModel;
/**
*
*/
public class HoloScan extends Panel {
public class HoloScan extends ScriptProcessor {
public HoloScan() {
initComponents();
@@ -115,8 +117,14 @@ public class HoloScan extends Panel {
buttonScientaSetup.setEnabled(value);
}
@Override
public String getScript() {
return "HoloScan";
}
void startScan() throws Exception{
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
ArrayList<String> sensors = new ArrayList();
for (Component c : panelSensors.getComponents()) {
@@ -139,10 +147,9 @@ public class HoloScan extends Panel {
args.put("LATENCY", (Double) 0.0);
args.put("RELATIVE", false);
args.put("ZIGZAG", checkZigzag.isSelected());
args.put("ENDSCAN", checkEndScan.isSelected());
runAsync("HoloScan", args);
}
args.put("ENDSCAN", checkEndScan.isSelected());
return args;
}
@SuppressWarnings("unchecked")
@@ -198,6 +205,7 @@ public class HoloScan extends Panel {
dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel();
labelTotalTime = new javax.swing.JLabel();
textTotalTime = new javax.swing.JLabel();
buttonQueue = new javax.swing.JButton();
panelPositioners.setBorder(javax.swing.BorderFactory.createTitledBorder("Positioners"));
panelPositioners.setPreferredSize(new java.awt.Dimension(248, 543));
@@ -273,7 +281,7 @@ public class HoloScan extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(motorPanelPhi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addGap(0, 32, Short.MAX_VALUE)
.addGap(0, 36, Short.MAX_VALUE)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -371,7 +379,7 @@ public class HoloScan extends Panel {
.addComponent(jLabel14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkZigzag)
.addContainerGap(103, Short.MAX_VALUE))
.addContainerGap(99, Short.MAX_VALUE))
);
panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
@@ -440,7 +448,7 @@ public class HoloScan extends Panel {
.addGroup(panelSensorsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelSensorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonScientaSetup, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
.addComponent(buttonScientaSetup, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
.addComponent(checkImage)
.addComponent(checkImageIntegration)
.addComponent(checkSpectrum)
@@ -518,6 +526,13 @@ public class HoloScan extends Panel {
textTotalTime.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
textTotalTime.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
buttonQueue.setText("Queue");
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout panelScanLayout = new javax.swing.GroupLayout(panelScan);
panelScan.setLayout(panelScanLayout);
panelScanLayout.setHorizontalGroup(
@@ -535,10 +550,11 @@ public class HoloScan extends Panel {
.addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textTotalTime, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 1, Short.MAX_VALUE))
.addGap(0, 6, Short.MAX_VALUE))
.addGroup(panelScanLayout.createSequentialGroup()
.addComponent(checkEndScan)
.addGap(53, 53, 53)))
.addGap(53, 53, 53))
.addComponent(buttonQueue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -553,7 +569,9 @@ public class HoloScan extends Panel {
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 170, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(labelAcqTime)
.addComponent(dvpAcqTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -561,7 +579,7 @@ public class HoloScan extends Panel {
.addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(textTotalTime)
.addComponent(labelTotalTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addGap(26, 26, 26))
);
@@ -606,7 +624,7 @@ public class HoloScan extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try{
startScan();
execute();
} catch (Exception ex){
SwingUtils.showException(this, ex);
}
@@ -625,10 +643,19 @@ public class HoloScan extends Panel {
setEnabled(isEnabled());
}//GEN-LAST:event_radioStepSizeActionPerformed
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JButton buttonQueue;
private javax.swing.JButton buttonScientaSetup;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkAngleDistribution;
+14 -3
View File
@@ -178,7 +178,7 @@
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerLatency" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="81" max="32767" attributes="0"/>
<Component id="checkFlyScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
@@ -545,6 +545,7 @@
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="buttonQueue" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -557,7 +558,9 @@
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="buttonQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="labelAcqTime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="dvpAcqTime" linkSize="9" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -567,7 +570,7 @@
<Component id="labelTotalTime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textTotalTime" linkSize="9" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
@@ -620,6 +623,14 @@
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="dvpAcqTime">
</Component>
<Component class="javax.swing.JButton" name="buttonQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
+37 -46
View File
@@ -4,7 +4,7 @@
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.epics.Scienta;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
@@ -12,6 +12,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JSpinner;
@@ -21,7 +22,7 @@ import javax.swing.SpinnerNumberModel;
/**
*
*/
public class ManipulatorScan extends Panel {
public class ManipulatorScan extends ScriptProcessor {
public ManipulatorScan() {
initComponents();
@@ -91,7 +92,13 @@ public class ManipulatorScan extends Panel {
buttonScientaSetup.setEnabled(value);
}
void startScan() throws Exception {
@Override
public String getScript() {
return "ManipulatorScan";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
args.put("MOTOR", comboMotor.getSelectedItem().toString());
ArrayList<String> sensors = new ArrayList();
@@ -117,44 +124,8 @@ public class ManipulatorScan extends Panel {
args.put("RELATIVE", radioRelative.isSelected());
args.put("ENDSCAN", checkEndScan.isSelected());
args.put("FLY_SCAN", checkFlyScan.isSelected());
runAsync("ManipulatorScan", args);
/*
getContext().setExecutionPars("manip_scan");
String scan ="lscan(" + comboMotor.getSelectedItem().toString() + ", ( " ;
for (Component c : panelSensors.getComponents()) {
if ((c instanceof JCheckBox) && ((JCheckBox)c).isSelected())
scan += c.getName() + ", ";
}
scan+="), ";
if (radioRelative.isSelected()){
double halfRange = (Double)spinnerRange.getValue()/2;
scan+= (-halfRange) + ", " + (halfRange)+ ", ";
} else {
Double from = (Double)spinnerFrom.getValue();
Double to = (Double)spinnerTo.getValue();
if (to <= from){
throw new Exception ("Invalid range");
}
scan+= from + ", " + to + ", ";
}
scan+= (radioStepSize.isSelected()) ? "(" +((Double)spinnerStepSize.getValue())+",)" :((Integer)spinnerSteps.getValue());
scan+=", " + (Double)spinnerLatency.getValue() + ", ";
if (radioRelative.isSelected()){
scan+="True, "; //Relative
}
scan+="before_read=trig_scienta)"; //Relative
if (checkImageIntegration.isSelected()){
scan = "set_preference(Preference.PLOT_TYPES,{'integration':1}); " + scan;
}
evalAsync(scan);
*/
}
return args;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -207,6 +178,7 @@ public class ManipulatorScan extends Panel {
labelTotalTime = new javax.swing.JLabel();
labelAcqTime = new javax.swing.JLabel();
dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel();
buttonQueue = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(792, 567));
@@ -381,7 +353,7 @@ public class ManipulatorScan extends Panel {
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerLatency, 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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
.addComponent(checkFlyScan)
.addGap(26, 26, 26))
);
@@ -527,6 +499,13 @@ public class ManipulatorScan extends Panel {
labelAcqTime.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelAcqTime.setText("Acquisition time(s):");
buttonQueue.setText("Queue");
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
@@ -548,7 +527,8 @@ public class ManipulatorScan extends Panel {
.addGap(1, 1, 1))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addComponent(checkEndScan)
.addGap(0, 0, Short.MAX_VALUE)))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -563,7 +543,9 @@ public class ManipulatorScan extends Panel {
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(labelAcqTime)
.addComponent(dvpAcqTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -571,7 +553,7 @@ public class ManipulatorScan extends Panel {
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(labelTotalTime)
.addComponent(textTotalTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addGap(26, 26, 26))
);
@@ -616,7 +598,7 @@ public class ManipulatorScan extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
startScan();
execute();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
@@ -660,10 +642,19 @@ public class ManipulatorScan extends Panel {
setEnabled(isEnabled());
}//GEN-LAST:event_radioAbsoluteActionPerformed
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JButton buttonQueue;
private javax.swing.JButton buttonScientaSetup;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkAngleDistribution;
+12 -1
View File
@@ -230,7 +230,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonStart" alignment="0" max="32767" attributes="0"/>
@@ -239,6 +239,7 @@
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="62" max="32767" attributes="0"/>
</Group>
<Component id="buttonQueue" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -251,6 +252,8 @@
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="buttonQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
@@ -280,6 +283,14 @@
<Property name="text" type="java.lang.String" value="Turn off beam at end"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
+37 -12
View File
@@ -1,15 +1,17 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JSpinner;
/**
*
*/
public class OTF extends Panel {
public class OTF extends ScriptProcessor {
public OTF() {
initComponents();
@@ -48,17 +50,19 @@ public class OTF extends Panel {
}
@Override
protected void onUnloaded() {
}
//Invoked by 'update()' to update components in the event thread
@Override
protected void doUpdate() {
}
}
void startScan() throws Exception {
@Override
public String getScript() {
return "otf";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
/*
ArrayList<String> sensors = new ArrayList();
@@ -74,9 +78,10 @@ public class OTF extends Panel {
args.put("E2", spinnerE2.getValue());
args.put("TIME", spinnerTime.getValue());
args.put("MODULO", spinnerModulo.getValue());
args.put("ENDSCAN", checkEndScan.isSelected());
runAsync("otf", args);
}
args.put("ENDSCAN", checkEndScan.isSelected());
return args;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -98,6 +103,7 @@ public class OTF extends Panel {
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
checkEndScan = new javax.swing.JCheckBox();
buttonQueue = new javax.swing.JButton();
panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
@@ -222,6 +228,13 @@ public class OTF extends Panel {
checkEndScan.setText("Turn off beam at end");
buttonQueue.setText("Queue");
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
@@ -233,7 +246,8 @@ public class OTF extends Panel {
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addComponent(checkEndScan)
.addGap(0, 62, Short.MAX_VALUE)))
.addGap(0, 62, Short.MAX_VALUE))
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
@@ -243,6 +257,8 @@ public class OTF extends Panel {
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addGap(26, 26, 26))
@@ -278,7 +294,7 @@ public class OTF extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
startScan();
execute();
} catch (Exception ex) {
showException(ex);
}
@@ -292,8 +308,17 @@ public class OTF extends Panel {
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonQueue;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkCur1;
private javax.swing.JCheckBox checkCur2;
+15 -4
View File
@@ -97,7 +97,7 @@
<Component id="radioCis" min="-2" max="-2" attributes="0"/>
<Component id="radioSwept" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace min="0" pref="58" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
@@ -530,7 +530,7 @@
<Component id="buttonStart" max="32767" attributes="0"/>
<Component id="buttonAbort" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="10" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelAcqTime" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelTotalTime" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
@@ -541,6 +541,7 @@
<Component id="dvpAcqTime" linkSize="8" alignment="1" min="-2" pref="76" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="buttonQueue" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -553,7 +554,9 @@
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="buttonQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="dvpAcqTime" linkSize="9" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="labelAcqTime" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -563,7 +566,7 @@
<Component id="labelTotalTime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textTotalTime" linkSize="9" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
@@ -616,6 +619,14 @@
<Property name="text" type="java.lang.String" value="Total time:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
+45 -11
View File
@@ -7,6 +7,7 @@ import ch.psi.pshell.scan.Scan;
import ch.psi.pshell.scan.ScanListener;
import ch.psi.pshell.scan.ScanRecord;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
@@ -15,6 +16,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
@@ -22,7 +24,7 @@ import javax.swing.JToggleButton;
/**
*
*/
public class PhotonEnergy extends Panel {
public class PhotonEnergy extends ScriptProcessor {
public PhotonEnergy() {
initComponents();
@@ -177,7 +179,19 @@ public class PhotonEnergy extends Panel {
});
}
void startScan() throws Exception {
@Override
public void execute() throws Exception {
super.execute();
running = true;
}
@Override
public String getScript() {
return "PhotonEnergy";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
ArrayList<String> sensors = new ArrayList();
for (Component c : panelSensors.getComponents()) {
@@ -193,9 +207,9 @@ public class PhotonEnergy extends Panel {
args.put("STEP", (Double) spinnerStep.getValue());
args.put("ENDSCAN", checkEndScan.isSelected());
runAsync("PhotonEnergy", args);
running = true;
}
return args;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -247,6 +261,7 @@ public class PhotonEnergy extends Panel {
dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel();
textTotalTime = new javax.swing.JLabel();
labelTotalTime = new javax.swing.JLabel();
buttonQueue = new javax.swing.JButton();
panelPositioner.setBorder(javax.swing.BorderFactory.createTitledBorder("Acquisition"));
@@ -386,7 +401,7 @@ public class PhotonEnergy extends Panel {
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(radioCis)
.addComponent(radioSwept))
.addGap(0, 0, Short.MAX_VALUE))
.addGap(0, 58, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup()
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
@@ -584,6 +599,13 @@ public class PhotonEnergy extends Panel {
labelTotalTime.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelTotalTime.setText("Total time:");
buttonQueue.setText("Queue");
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
@@ -597,14 +619,15 @@ public class PhotonEnergy extends Panel {
.addComponent(buttonStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 1, Short.MAX_VALUE)
.addGap(0, 10, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelAcqTime)
.addComponent(labelTotalTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textTotalTime, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -619,7 +642,9 @@ public class PhotonEnergy extends Panel {
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(dvpAcqTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelAcqTime))
@@ -627,7 +652,7 @@ public class PhotonEnergy extends Panel {
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(labelTotalTime)
.addComponent(textTotalTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addGap(26, 26, 26))
);
@@ -672,7 +697,7 @@ public class PhotonEnergy extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
startScan();
execute();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
@@ -700,10 +725,19 @@ public class PhotonEnergy extends Panel {
updateTable();
}//GEN-LAST:event_spinnerEnergyChanged
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JButton buttonQueue;
private javax.swing.JButton buttonScientaSetup;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkAngleDistribution;
+1 -1
View File
@@ -13,7 +13,7 @@ ENDSCAN (BOOLEAN)
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
adjust_sensors()
#set_adc_averaging()
set_adc_averaging()
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
set_exec_pars(compression=True)