From ca00a414ff21de55fab529e381d72d06e0198f06 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Tue, 5 Jul 2022 11:23:28 +0200 Subject: [PATCH] Closedown --- config/variables.properties | 6 +++--- plugins/XPSSpectrum.java | 17 +++++++++++++---- script/XPSSpectrum.py | 20 ++++++++++++-------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/config/variables.properties b/config/variables.properties index a012dea8..baa0d7dc 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Tue Jul 05 10:23:56 CEST 2022 +#Tue Jul 05 11:20:56 CEST 2022 LastRunDate=220705 -FileSequentialNumber=13223 -DaySequentialNumber=3 +FileSequentialNumber=13230 +DaySequentialNumber=10 diff --git a/plugins/XPSSpectrum.java b/plugins/XPSSpectrum.java index a8594374..69239bc4 100644 --- a/plugins/XPSSpectrum.java +++ b/plugins/XPSSpectrum.java @@ -56,7 +56,7 @@ public class XPSSpectrum extends Panel { rangeSelectionPanel.setDuplicateAllowed(true); rangeSelectionPanel.setShowMiddle(showMiddle); buttonSkip.setVisible(false); - rangeSelectionPanel.setAditionalColumns(new String[]{"Time", "Size", "Iter", "Eph"}, new Class[]{Double.class, Double.class, Integer.class, Double.class}); + rangeSelectionPanel.setAditionalColumns(new String[]{"Time", "Size", "Iter", "Eph", "Name"}, new Class[]{Double.class, Double.class, Integer.class, Double.class, String.class}); final DefaultTableModel model = (DefaultTableModel) rangeSelectionPanel.getTable().getModel(); model.addTableModelListener(new TableModelListener() { @Override @@ -748,8 +748,17 @@ public class XPSSpectrum extends Panel { rangeSelectionPanel.setSeries(series); series.setData(x, y); } - int indexUpper = ((table.length>0) && (table[0].length == 6)) ? 1 : 2; - System.out.println(indexUpper); + int indexUpper; + int varCols; + if (table.length>0){ + boolean hasName = (table[0].length > 6) && (table[0][table[0].length-1] instanceof String); + int size_with_center = hasName?8:7; + indexUpper = (table[0].length >=size_with_center) ? 2 : 1; + varCols = table[0].length - indexUpper-1; + } else { + indexUpper=1; + varCols = 0; + } for (Object[] row : table) { rangeSelectionPanel.getPlot().addRange((Double) row[0], (Double) row[indexUpper]); } @@ -758,7 +767,7 @@ public class XPSSpectrum extends Panel { @Override public void run() { for (int row = 0; row < table.length; row++) { - for (int col = 0; col < 4; col++) { + for (int col = 0; col < varCols; col++) { rangeSelectionPanel.getTable().setValueAt(table[row][col + indexUpper + 1], row, col + indexTime); } } diff --git a/script/XPSSpectrum.py b/script/XPSSpectrum.py index db2ef9b0..fcad252b 100644 --- a/script/XPSSpectrum.py +++ b/script/XPSSpectrum.py @@ -4,11 +4,6 @@ # save_scienta_image # # skip_iteration: if set to 1 then skips after end of current iteration -print ranges -print pass_energy -print save_scienta_image -print ENDSCAN -1/0 from ch.psi.pshell.data.LayoutDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION import org.jfree.chart.axis.NumberAxis as NumberAxis @@ -103,14 +98,21 @@ try: cur_iteration = 0 skip_iteration = False vars = ranges[cur_range].vars + region_name = None #Check if photon energy is defined if len(vars) > 2: eph = vars[3] - if eph and (not math.isnan(eph)): - Eph.move(eph) - time.sleep(5.0) + #if eph and (not math.isnan(eph)): + # Eph.move(eph) + # time.sleep(5.0) + if len(vars)>4: + region_name = vars[4] + print region_name + if region_name: + set_attribute(path, "Region Name", region_name) + 1/0 Scienta.lowEnergy.write(adjusted_ranges[cur_range][0]) Scienta.highEnergy.write(adjusted_ranges[cur_range][1]) @@ -188,6 +190,8 @@ try: set_attribute(path, "Pass Energy",pass_energy) set_attribute(path, "Readables", ["ScientaSpectrum","ScientaImage"] if save_scienta_image else ["ScientaSpectrum",]) set_attribute(path, "Writables", ["ScientaChannels",]) + if region_name: + set_attribute(path, "Region Name", region_name) create_diag_datasets(path) append_diag_datasets(path)