This commit is contained in:
x03daop
2015-07-16 14:15:45 +02:00
parent 7878186e4b
commit e4a0a8a6ab
3 changed files with 650 additions and 216 deletions

View File

@@ -16,64 +16,22 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="rangeSelectionPanel" alignment="0" pref="900" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonInitialScan" linkSize="1" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueLow" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueHigh" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
<Component id="buttonDetailedScan" linkSize="1" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="btLoad" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="btSave" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jPanel2" max="32767" 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" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonInitialScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDetailedScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" max="-2" attributes="0"/>
<Group type="103" alignment="1" groupAlignment="2" attributes="0">
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="valueHigh" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="valueLow" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="rangeSelectionPanel" pref="240" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="43" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btLoad" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="btSave" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -81,78 +39,308 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonAbort">
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
<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="Arguments"/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonInitialScan">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueLow" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueHigh" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel11" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboPass" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueTime" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel9" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueSize" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel17" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="valueIterations" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="valueLow" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="valueHigh" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="valueTime" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel9" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="valueSize" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel17" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="valueIterations" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="comboPass" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Low:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueIterations">
<Properties>
<Property name="decimals" type="int" value="0"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="1.0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Size:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueTime">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="1.0"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboPass">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="7">
<StringItem index="0" value="2"/>
<StringItem index="1" value="5"/>
<StringItem index="2" value="10"/>
<StringItem index="3" value="20"/>
<StringItem index="4" value="50"/>
<StringItem index="5" value="100"/>
<StringItem index="6" value="200"/>
</StringArray>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueSize">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="1.0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Pass:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueLow">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="0.0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="High:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueHigh">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="100.0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Time:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel17">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Iter:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="text" type="java.lang.String" value="Initial Scan"/>
<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="Scan Control"/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonInitialScanActionPerformed"/>
</Events>
</Component>
<Component class="ch.psi.pshell.swing.RangeSelectionPanel" name="rangeSelectionPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.pshell.swing.RangeSelectionPanel() {&#xa; protected void onSeriesChanged() {&#xa; updateButtons();&#xa; }&#xa; protected void onSelectionChanged() {&#xa; updateButtons();&#xa; }&#xa;}&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="buttonDetailedScan">
<Properties>
<Property name="text" type="java.lang.String" value="Detailed Scan"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDetailedScanActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btSave">
<Properties>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btSaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btLoad">
<Properties>
<Property name="text" type="java.lang.String" value="Load"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btLoadActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Low:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueLow">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="0.0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="High:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueHigh">
<Properties>
<Property name="decimals" type="int" value="2"/>
<Property name="maxValue" type="double" value="1000.0"/>
<Property name="minValue" type="double" value="0.0"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="value" type="double" value="100.0"/>
</Properties>
</Component>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="342" pref="351" max="32767" attributes="0"/>
<Component id="btLoad" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="btSave" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Component id="buttonInitialScan" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonDetailedScan" linkSize="1" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonSkip" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonAbort" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="rangeSelectionPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonInitialScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDetailedScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" max="-2" attributes="0"/>
<Component id="buttonSkip" alignment="3" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="rangeSelectionPanel" pref="165" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btLoad" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="btSave" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btLoad">
<Properties>
<Property name="text" type="java.lang.String" value="Load"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btLoadActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btSave">
<Properties>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btSaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonInitialScan">
<Properties>
<Property name="text" type="java.lang.String" value="Initial Scan"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonInitialScanActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDetailedScan">
<Properties>
<Property name="text" type="java.lang.String" value="Detailed Scan"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDetailedScanActionPerformed"/>
</Events>
</Component>
<Component class="ch.psi.pshell.swing.RangeSelectionPanel" name="rangeSelectionPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.pshell.swing.RangeSelectionPanel() {&#xa; protected void onSeriesChanged() {&#xa; updateButtons();&#xa; }&#xa; protected void onSelectionChanged() {&#xa; updateButtons();&#xa; }&#xa;}&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonSkip">
<Properties>
<Property name="text" type="java.lang.String" value="Skip"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSkipActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -8,11 +8,11 @@ import ch.psi.pshell.epics.Scienta;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.RangeSelectionPlot.RangeSelection;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.Convert;
import ch.psi.utils.IO;
import ch.psi.utils.Serializer;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.Task;
import java.io.File;
import java.nio.file.Files;
import java.util.HashMap;
@@ -34,6 +34,7 @@ public class XPSSpectrum extends Panel {
public XPSSpectrum() {
initComponents();
buttonSkip.setVisible(false);
rangeSelectionPanel.setAditionalColumns(new String[]{"Time", "Size", "Iter"}, new Class[]{Double.class, Double.class, Integer.class});
final DefaultTableModel model = (DefaultTableModel) rangeSelectionPanel.getTable().getModel();
model.addTableModelListener(new TableModelListener() {
@@ -50,9 +51,9 @@ public class XPSSpectrum extends Panel {
model.setValueAt(model.getValueAt(row - 1, col), row, col);
}
} else {
model.setValueAt(scienta.getStepTime().take(), row, 3);
model.setValueAt(scienta.getStepSize().take(), row, 4);
model.setValueAt(Integer.valueOf(1), row, 5);
model.setValueAt(valueTime.getValue(), row, 3);
model.setValueAt(valueSize.getValue(), row, 4);
model.setValueAt((int)valueIterations.getValue(), row, 5);
}
}
});
@@ -66,13 +67,24 @@ public class XPSSpectrum extends Panel {
scienta = (Scienta) getDevice("scienta");
scienta.getTotalChannels().addListener(progressListener);
scienta.getCurrentChannel().addListener(progressListener);
/*
valueLow.setValue(scienta.getLowEnergy().take());
valueHigh.setValue(scienta.getHighEnergy().take());
valueTime.setValue(scienta.getStepTime().take());
valueSize.setValue(scienta.getStepSize().take());
comboPass.setSelectedItem(0);
valueIterations.setValue(1);
*/
}
@Override
public void onStateChange(State state, State former) {
setEnabled(state == State.Ready);
if (!state.isProcessing()){
buttonSkip.setVisible(false);
if (running){
monitoringTask.stop();
monitoringTask.stopScheduler();
running = false;
getView().getStatusBar().setProgress(-1);
}
@@ -117,6 +129,10 @@ public class XPSSpectrum extends Panel {
rangeSelectionPanel.setEnabled(value);
valueLow.setEnabled(value);
valueHigh.setEnabled(value);
valueTime.setEnabled(value);
valueSize.setEnabled(value);
valueIterations.setEnabled(value);
comboPass.setEnabled(value);
updateButtons();
}
@@ -124,7 +140,7 @@ public class XPSSpectrum extends Panel {
buttonInitialScan.setEnabled(isEnabled());
buttonDetailedScan.setEnabled(isEnabled() && rangeSelectionPanel.getPlot().getSelectedRanges().length > 0);
btLoad.setEnabled(isEnabled());
btSave.setEnabled(buttonDetailedScan.isEnabled());
btSave.setEnabled(buttonDetailedScan.isEnabled());
}
DeviceListener progressListener = new DeviceListener() {
@@ -141,16 +157,62 @@ public class XPSSpectrum extends Panel {
if ((total!=null) && (current!=null)){
getView().getStatusBar().setProgress(scienta.getProgress());
}
}
}
}
};
public final String STEP_VAR = "xps_spectrum_step";
int currentScanIndex ;
Task monitoringTask = new Task() {
@Override
protected Object execute() throws Exception {
Object index = XPSSpectrum.this.eval(STEP_VAR, true);
if ((index!=null) && (index instanceof Integer) && ((Integer)index > 0)){
int scanIndex = ((Integer)index)-1;
if (scanIndex!=currentScanIndex){
buttonSkip.setEnabled(true);
}
currentScanIndex = scanIndex;
RangeSelection range = rangeSelectionPanel.getRangesOrdered()[scanIndex];
for (int row = 0; row< rangeSelectionPanel.getTable().getRowCount(); row++){
if (range.equals((Double)rangeSelectionPanel.getTable().getValueAt(row, 0), (Double)rangeSelectionPanel.getTable().getValueAt(row, 2))){
rangeSelectionPanel.getTable().setRowSelectionInterval(row, row);
break;
}
if (row == (rangeSelectionPanel.getTable().getRowCount()-1)){
rangeSelectionPanel.getTable().clearSelection();
}
}
} else {
rangeSelectionPanel.getTable().clearSelection();
}
return true;
}
};
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonAbort = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
valueIterations = new ch.psi.pshell.swing.ValueSelection();
jLabel9 = new javax.swing.JLabel();
valueTime = new ch.psi.pshell.swing.ValueSelection();
comboPass = new javax.swing.JComboBox();
valueSize = new ch.psi.pshell.swing.ValueSelection();
jLabel11 = new javax.swing.JLabel();
valueLow = new ch.psi.pshell.swing.ValueSelection();
jLabel2 = new javax.swing.JLabel();
valueHigh = new ch.psi.pshell.swing.ValueSelection();
jLabel8 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
btLoad = new javax.swing.JButton();
btSave = new javax.swing.JButton();
buttonInitialScan = new javax.swing.JButton();
buttonDetailedScan = new javax.swing.JButton();
rangeSelectionPanel = new ch.psi.pshell.swing.RangeSelectionPanel() {
protected void onSeriesChanged() {
updateButtons();
@@ -160,18 +222,143 @@ public class XPSSpectrum extends Panel {
}
}
;
buttonDetailedScan = new javax.swing.JButton();
btSave = new javax.swing.JButton();
btLoad = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
valueLow = new ch.psi.pshell.swing.ValueSelection();
jLabel2 = new javax.swing.JLabel();
valueHigh = new ch.psi.pshell.swing.ValueSelection();
buttonAbort = new javax.swing.JButton();
buttonSkip = new javax.swing.JButton();
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Arguments"));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Low:");
valueIterations.setDecimals(0);
valueIterations.setMaxValue(1000.0);
valueIterations.setMinValue(0.0);
valueIterations.setShowButtons(false);
valueIterations.setValue(1.0);
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel9.setText("Size:");
valueTime.setDecimals(2);
valueTime.setMaxValue(1000.0);
valueTime.setMinValue(0.0);
valueTime.setShowButtons(false);
valueTime.setValue(1.0);
comboPass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "5", "10", "20", "50", "100", "200" }));
comboPass.setToolTipText("");
valueSize.setDecimals(2);
valueSize.setMaxValue(1000.0);
valueSize.setMinValue(0.0);
valueSize.setShowButtons(false);
valueSize.setValue(1.0);
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel11.setText("Pass:");
valueLow.setDecimals(2);
valueLow.setMaxValue(1000.0);
valueLow.setMinValue(0.0);
valueLow.setShowButtons(false);
valueLow.setValue(0.0);
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("High:");
valueHigh.setDecimals(2);
valueHigh.setMaxValue(1000.0);
valueHigh.setMinValue(0.0);
valueHigh.setShowButtons(false);
valueHigh.setValue(100.0);
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Time:");
jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel17.setText("Iter:");
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()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueIterations, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboPass, valueHigh, valueIterations, valueLow, valueSize, valueTime});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel11, jLabel17, jLabel2, jLabel8, jLabel9});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(valueLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel2)
.addComponent(valueHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(valueTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(valueSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel17)
.addComponent(valueIterations, 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(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel11)
.addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
btLoad.setText("Load");
btLoad.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
btLoadActionPerformed(evt);
}
});
btSave.setText("Save");
btSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btSaveActionPerformed(evt);
}
});
@@ -189,93 +376,83 @@ public class XPSSpectrum extends Panel {
}
});
btSave.setText("Save");
btSave.addActionListener(new java.awt.event.ActionListener() {
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btSaveActionPerformed(evt);
buttonAbortActionPerformed(evt);
}
});
btLoad.setText("Load");
btLoad.addActionListener(new java.awt.event.ActionListener() {
buttonSkip.setText("Skip");
buttonSkip.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btLoadActionPerformed(evt);
buttonSkipActionPerformed(evt);
}
});
jLabel1.setText("Low:");
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.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(342, 351, Short.MAX_VALUE)
.addComponent(btLoad)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btSave))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(buttonInitialScan)
.addGap(18, 18, 18)
.addComponent(buttonDetailedScan, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonSkip)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort))
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
valueLow.setDecimals(2);
valueLow.setMaxValue(1000.0);
valueLow.setMinValue(0.0);
valueLow.setShowButtons(false);
valueLow.setValue(0.0);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btLoad, btSave, buttonAbort, buttonDetailedScan, buttonInitialScan, buttonSkip});
jLabel2.setText("High:");
valueHigh.setDecimals(2);
valueHigh.setMaxValue(1000.0);
valueHigh.setMinValue(0.0);
valueHigh.setShowButtons(false);
valueHigh.setValue(100.0);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonInitialScan)
.addComponent(buttonDetailedScan)
.addComponent(buttonAbort)
.addComponent(buttonSkip))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btLoad, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btSave, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 900, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonInitialScan, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(60, 60, 60)
.addComponent(buttonDetailedScan, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btLoad)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btSave)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btLoad, btSave, buttonAbort, buttonDetailedScan, buttonInitialScan});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {valueHigh, valueLow});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonInitialScan)
.addComponent(buttonDetailedScan)
.addComponent(buttonAbort)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel2)
.addComponent(valueHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(valueLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)))
.addGap(18, 18, 18)
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
.addGap(43, 43, 43))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btLoad, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btSave, javax.swing.GroupLayout.Alignment.TRAILING))))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -287,11 +464,17 @@ public class XPSSpectrum extends Panel {
private void buttonInitialScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInitialScanActionPerformed
try {
//getApp().startTask(task);
HashMap<String, RangeSelection[]> args = new HashMap<>();
args.put("ranges", new RangeSelection[]{new RangeSelection(valueLow.getValue(),valueHigh.getValue())});
HashMap<String, Object> args = new HashMap<>();
RangeSelection initialRange = new RangeSelection(valueLow.getValue(),valueHigh.getValue());
initialRange.setVars(new Object[]{valueSize.getValue(),valueTime.getValue(),(int)valueIterations.getValue()});
args.put("ranges", new RangeSelection[]{initialRange});
args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString()));
rangeSelectionPanel.clear();
detailedScan = false;
runAsync("XPSSpectrum", args);
buttonSkip.setVisible(true);
buttonSkip.setEnabled(true);
running = true;
} catch (Exception ex) {
showException(ex);
@@ -302,10 +485,14 @@ public class XPSSpectrum extends Panel {
private void buttonDetailedScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDetailedScanActionPerformed
try {
RangeSelection[] ranges = rangeSelectionPanel.getRangesOrdered();
HashMap<String, RangeSelection[]> args = new HashMap<>();
HashMap<String, Object> args = new HashMap<>();
args.put("ranges", ranges);
detailedScan = true;
args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString()));
detailedScan = true;
runAsync("XPSSpectrum", args);
monitoringTask.schedule(100, 500);
buttonSkip.setVisible(true);
buttonSkip.setEnabled(true);
running = true;
} catch (Exception ex) {
showException(ex);
@@ -371,16 +558,36 @@ public class XPSSpectrum extends Panel {
}
}//GEN-LAST:event_btLoadActionPerformed
private void buttonSkipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSkipActionPerformed
try {
this.eval("skip_iteration = True", true);
buttonSkip.setEnabled(false);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonSkipActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btLoad;
private javax.swing.JButton btSave;
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonDetailedScan;
private javax.swing.JButton buttonInitialScan;
private javax.swing.JButton buttonSkip;
private javax.swing.JComboBox comboPass;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private ch.psi.pshell.swing.RangeSelectionPanel rangeSelectionPanel;
private ch.psi.pshell.swing.ValueSelection valueHigh;
private ch.psi.pshell.swing.ValueSelection valueIterations;
private ch.psi.pshell.swing.ValueSelection valueLow;
private ch.psi.pshell.swing.ValueSelection valueSize;
private ch.psi.pshell.swing.ValueSelection valueTime;
// End of variables declaration//GEN-END:variables
}

View File

@@ -1,32 +1,71 @@
#Parameters (global variables):
# ranges: list of RangeSelection
# ranges: list of RangeSelection havinf args = (step_size, step_time, iterations)
# pass_energy
#
# skip_iteration: if set to 1 then skips after end of current iteration
from ch.psi.pshell.data.ScanPersistenceStrategyDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION
if scienta.acquisitionMode == scienta.AcquisitionMode.Fixed:
scienta.acquisitionMode = scienta.AcquisitionMode.Swept
ret=[]
#Global arguments
scienta.passEnergy = pass_energy
xps_spectrum_step = 0
names=[]
for i in range(len(ranges)):
names.append(str(ranges[i]))
plots = plot(None, names)
try:
for i in range(len(ranges)):
for i in range(len(ranges)):
skip_iteration = False
xps_spectrum_step = xps_spectrum_step+1
scienta.lowEnergy.put(ranges[i].min)
scienta.highEnergy.put(ranges[i].max)
scienta.update()
vars = ranges[i].vars
if vars is not None and len(vars)==3:
scienta.stepTime.write(vars[0])
scienta.stepSize.write(vars[1])
scienta.setIterations(vars[2])
trig_scienta()
ydata = scienta.spectrum.read()
scienta.stepTime.write(vars[0])
scienta.stepSize.write(vars[1])
scienta.setIterations(1)
#iterations done in script
xdata = scienta.spectrumX
plots[i].getSeries(0).setData(xdata, ydata)
ydata = None
for j in range(vars[2]):
trig_scienta()
spectrum_array = scienta.spectrum.read()
if ydata is None:
ydata = spectrum_array
else:
for k in range (len(spectrum_array)):
ydata[k] = ydata[k] + spectrum_array[k]
plots[i].getSeries(0).setData(xdata, ydata)
if skip_iteration:
break
plots[i].setTitle(str(ranges[i]) + " - iteration " + str(j+1))
plots[i].setTitle(str(ranges[i]))
ret.append((xdata, ydata))
#time.sleep(3.0)
data1d = [1,2,3,4,5]
path="scan" + str(i+1) + "/"
save_dataset(path + "spectrum", ydata)
save_dataset(path + "channels", xdata)
set_attribute(path + "channels", ATTR_WRITABLE_DIMENSION, 1)
set_attribute(path, "Range Low", ranges[i].min)
set_attribute(path, "Range High", ranges[i].max)
set_attribute(path, "Step Time",vars[0])
set_attribute(path, "Step Size",vars[1])
set_attribute(path, "Pass Energy",pass_energy)
set_attribute(path, "Iterations",j+1)
finally:
xps_spectrum_step = 0
if not scienta.isReady():
scienta.stop()
set_return(to_array(ret,'o'))