diff --git a/plugins/XPSSpectrum.java b/plugins/XPSSpectrum.java index fa45d319..07572bc7 100644 --- a/plugins/XPSSpectrum.java +++ b/plugins/XPSSpectrum.java @@ -45,7 +45,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}); + rangeSelectionPanel.setAditionalColumns(new String[]{"Time", "Size", "Iter", "Eph"}, new Class[]{Double.class, Double.class, Integer.class, Double.class}); final DefaultTableModel model = (DefaultTableModel) rangeSelectionPanel.getTable().getModel(); model.addTableModelListener(new TableModelListener() { @Override @@ -57,13 +57,14 @@ public class XPSSpectrum extends Panel { @Override public void run() { if (row > 0) { - for (int col = 3; col < 6; col++) { + for (int col = 3; col < 7; col++) { model.setValueAt(model.getValueAt(row - 1, col), row, col); } } else { model.setValueAt(valueTime.getValue(), row, 3); model.setValueAt(valueSize.getValue(), row, 4); model.setValueAt((int) valueIterations.getValue(), row, 5); + model.setValueAt(Double.NaN, row, 6); } } }); @@ -628,7 +629,7 @@ public class XPSSpectrum extends Panel { RangeSelection initialRange = new RangeSelection(valueLow.getValue(), valueHigh.getValue()); int iterations = (int) valueIterations.getValue(); - initialRange.setVars(new Object[]{valueTime.getValue(), valueSize.getValue(), iterations}); + initialRange.setVars(new Object[]{valueTime.getValue(), valueSize.getValue(), iterations, Double.NaN}); scanRanges = new RangeSelection[]{initialRange}; start(); @@ -696,7 +697,7 @@ public class XPSSpectrum extends Panel { @Override public void run() { for (int row = 0; row < table.length; row++) { - for (int col = 3; col < 6; col++) { + for (int col = 3; col < 7; col++) { rangeSelectionPanel.getTable().setValueAt(table[row][col], row, col); } } diff --git a/script/XPSSpectrum.py b/script/XPSSpectrum.py index 241a0e89..9b0b6ec7 100644 --- a/script/XPSSpectrum.py +++ b/script/XPSSpectrum.py @@ -6,6 +6,7 @@ # skip_iteration: if set to 1 then skips after end of current iteration from ch.psi.pshell.data.LayoutDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION import org.jfree.chart.axis.NumberAxis as NumberAxis +import math cur_range = 0 cur_iteration = 0 @@ -86,7 +87,15 @@ task = None try: for cur_range in range(len(ranges)): cur_iteration = 0 - skip_iteration = False + skip_iteration = False + + #Check if photon energy is defined + if len(vars) > 2: + eph = vars[3] + if not math.isnan(eph): + pass + #Eph.write(eph) + Scienta.lowEnergy.write(adjusted_ranges[cur_range][0]) Scienta.highEnergy.write(adjusted_ranges[cur_range][1]) Scienta.update() @@ -94,7 +103,7 @@ try: vars = ranges[cur_range].vars Scienta.stepTime.write(vars[0]) Scienta.stepSize.write(vars[1]) - Scienta.setIterations(1) + Scienta.setIterations(1) set_adc_averaging()