diff --git a/devices/Eph.properties b/devices/Eph.properties index 68a6efba..b4c9ddd1 100644 --- a/devices/Eph.properties +++ b/devices/Eph.properties @@ -1,9 +1,10 @@ -#Fri Jan 27 18:30:57 CET 2017 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite maxValue=2000.0 minValue=50.0 offset=0.0 precision=3 resolution=0.2 +rotation=false scale=1.0 unit=eV diff --git a/devices/ExitSlitY.properties b/devices/ExitSlitY.properties index 6587cd35..f0502d29 100644 --- a/devices/ExitSlitY.properties +++ b/devices/ExitSlitY.properties @@ -1,4 +1,4 @@ -#Fri May 20 15:20:07 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 defaultSpeed=0.4 estbilizationDelay=0 hasEnable=false @@ -10,5 +10,6 @@ minValue=-1.0 offset=0.0 precision=5 resolution=0.002 +rotation=false scale=1.0 unit=mm diff --git a/devices/FocusYRot.properties b/devices/FocusYRot.properties index ed5f51e7..fd351fde 100644 --- a/devices/FocusYRot.properties +++ b/devices/FocusYRot.properties @@ -1,8 +1,9 @@ -#Wed Aug 03 17:56:44 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=0.2 minValue=-0.2 offset=0.0 precision=3 resolution=0.005 +rotation=false scale=1.0 unit=mrad diff --git a/devices/ManipulatorPhi.properties b/devices/ManipulatorPhi.properties index 86704c05..e9455f80 100644 --- a/devices/ManipulatorPhi.properties +++ b/devices/ManipulatorPhi.properties @@ -1,4 +1,4 @@ -#Tue Nov 03 17:23:45 CET 2015 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=6.0 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=-180.0 offset=0.0 precision=4 resolution=0.5 +rotation=false scale=1.0 unit=deg diff --git a/devices/ManipulatorTheta.properties b/devices/ManipulatorTheta.properties index 3305eda6..e4b5fc66 100644 --- a/devices/ManipulatorTheta.properties +++ b/devices/ManipulatorTheta.properties @@ -1,4 +1,4 @@ -#Fri May 27 18:13:32 CEST 2016 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=0.5 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=-12.0 offset=0.0 precision=4 resolution=0.1 +rotation=false scale=1.0 unit=deg diff --git a/devices/ManipulatorTilt.properties b/devices/ManipulatorTilt.properties index d75d6986..3d865594 100644 --- a/devices/ManipulatorTilt.properties +++ b/devices/ManipulatorTilt.properties @@ -1,4 +1,4 @@ -#Fri Jul 17 14:18:48 CEST 2015 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=1.4 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=-28.0 offset=0.0 precision=4 resolution=0.02 +rotation=false scale=1.0 unit=deg diff --git a/devices/ManipulatorX.properties b/devices/ManipulatorX.properties index ece1e1c0..4ddaf81b 100644 --- a/devices/ManipulatorX.properties +++ b/devices/ManipulatorX.properties @@ -1,4 +1,4 @@ -#Tue Jun 14 14:43:15 CEST 2016 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=0.126 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=-5.0 offset=0.0 precision=4 resolution=0.01 +rotation=false scale=1.0 unit=mm diff --git a/devices/ManipulatorY.properties b/devices/ManipulatorY.properties index 3397b18e..ec30cd1e 100644 --- a/devices/ManipulatorY.properties +++ b/devices/ManipulatorY.properties @@ -1,4 +1,4 @@ -#Fri Jul 17 14:09:45 CEST 2015 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=0.126 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=-5.0 offset=0.0 precision=4 resolution=0.01 +rotation=false scale=1.0 unit=mm diff --git a/devices/ManipulatorZ.properties b/devices/ManipulatorZ.properties index 7ca06c12..8abb3c8e 100644 --- a/devices/ManipulatorZ.properties +++ b/devices/ManipulatorZ.properties @@ -1,4 +1,4 @@ -#Sat Sep 24 19:47:04 CEST 2016 +#Mon Aug 21 10:43:19 CEST 2017 accessType=ReadWrite defaultSpeed=1.0 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=100.0 offset=0.0 precision=4 resolution=0.01 +rotation=false scale=1.0 unit=mm diff --git a/devices/RefocusXRot.properties b/devices/RefocusXRot.properties index 0f89a98b..b14ada66 100644 --- a/devices/RefocusXRot.properties +++ b/devices/RefocusXRot.properties @@ -1,8 +1,9 @@ -#Fri Sep 09 17:42:54 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=0.0 minValue=0.0 offset=0.0 precision=0 resolution=NaN +rotation=false scale=1.0 unit=0.000 diff --git a/devices/RefocusYRot.properties b/devices/RefocusYRot.properties index 627b3cf3..35026822 100644 --- a/devices/RefocusYRot.properties +++ b/devices/RefocusYRot.properties @@ -1,8 +1,9 @@ -#Wed Aug 03 17:57:01 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=2.0 minValue=-2.0 offset=0.0 precision=3 resolution=0.005 +rotation=false scale=1.0 unit=mrad diff --git a/devices/RefocusYTrans.properties b/devices/RefocusYTrans.properties index c6cfe667..c744057f 100644 --- a/devices/RefocusYTrans.properties +++ b/devices/RefocusYTrans.properties @@ -1,8 +1,9 @@ -#Fri Sep 09 18:19:15 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=11.0 minValue=-11.0 offset=0.0 precision=3 resolution=0.5 +rotation=false scale=1.0 unit=mm diff --git a/devices/RefocusZRot.properties b/devices/RefocusZRot.properties index d084b3cd..9d245558 100644 --- a/devices/RefocusZRot.properties +++ b/devices/RefocusZRot.properties @@ -1,8 +1,9 @@ -#Fri Sep 09 17:55:39 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=10.0 minValue=-10.0 offset=0.0 precision=3 resolution=NaN +rotation=false scale=1.0 unit=mrad diff --git a/devices/RefocusZTrans.properties b/devices/RefocusZTrans.properties index d90ed2f7..d10dbbe9 100644 --- a/devices/RefocusZTrans.properties +++ b/devices/RefocusZTrans.properties @@ -1,8 +1,9 @@ -#Fri Sep 09 18:10:25 CEST 2016 +#Mon Aug 21 10:43:20 CEST 2017 maxValue=5.0 minValue=-5.0 offset=0.0 precision=3 resolution=NaN +rotation=false scale=1.0 unit=mm diff --git a/devices/dummy.properties b/devices/dummy.properties index ba8825c0..15b86da6 100644 --- a/devices/dummy.properties +++ b/devices/dummy.properties @@ -1,4 +1,4 @@ -#Mon May 01 18:28:27 CEST 2017 +#Mon Aug 21 10:43:20 CEST 2017 accessType=ReadWrite defaultSpeed=1.0 estbilizationDelay=0 @@ -11,5 +11,6 @@ minValue=0.0 offset=0.0 precision=3 resolution=NaN +rotation=false scale=1.0 unit= diff --git a/plugins/XPSSpectrum.java b/plugins/XPSSpectrum.java index 6b192fd0..79f75680 100644 --- a/plugins/XPSSpectrum.java +++ b/plugins/XPSSpectrum.java @@ -36,11 +36,11 @@ import javax.swing.table.DefaultTableModel; * */ public class XPSSpectrum extends Panel { - + boolean detailedScan; boolean running; Scienta scienta; - + public XPSSpectrum() { initComponents(); buttonSkip.setVisible(false); @@ -62,7 +62,7 @@ public class XPSSpectrum extends Panel { } else { model.setValueAt(valueTime.getValue(), row, 3); model.setValueAt(valueSize.getValue(), row, 4); - model.setValueAt((int)valueIterations.getValue(), row, 5); + model.setValueAt((int) valueIterations.getValue(), row, 5); } } }); @@ -73,9 +73,9 @@ public class XPSSpectrum extends Panel { //Component persistence ArrayList persistedComponents = new ArrayList<>(); persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JToggleButton.class))); - persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, ValueSelection.class))); - persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JComboBox.class))); - setPersistedComponents(persistedComponents.toArray(new Component[0])); + persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, ValueSelection.class))); + persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JComboBox.class))); + setPersistedComponents(persistedComponents.toArray(new Component[0])); } @Override @@ -84,18 +84,18 @@ public class XPSSpectrum extends Panel { scienta.getTotalChannels().addListener(progressListener); scienta.getCurrentChannel().addListener(progressListener); dvpAcqTime.setDevice(scienta.getAcquisitionTime()); - startTimer(500,100); + startTimer(500, 100); } - + @Override public void onStateChange(State state, State former) { setEnabled(state == State.Ready); - if (!state.isProcessing()){ + if (!state.isProcessing()) { buttonSkip.setVisible(false); - if (running){ + if (running) { //stopTimer(); running = false; - getView().getStatusBar().setProgress(-1); + getView().getStatusBar().setProgress(-1); } } } @@ -117,7 +117,7 @@ public class XPSSpectrum extends Panel { //double[] data = (double[]) Convert.wrapperArrayToPrimitiveArray(ret[0], Double.class); double[] xdata = (double[]) ret[0]; double[] ydata = (double[]) ret[1]; - + //double[] data = new double[]{1.0,1.0,1.0,1.0,1.0}; LinePlotSeries series = new LinePlotSeries("Data"); rangeSelectionPanel.setSeries(series); @@ -135,13 +135,13 @@ public class XPSSpectrum extends Panel { @Override public void setEnabled(boolean value) { super.setEnabled(value); - rangeSelectionPanel.setEnabled(value); + rangeSelectionPanel.setEnabled(value); valueLow.setEnabled(value); valueHigh.setEnabled(value); valueTime.setEnabled(value); valueSize.setEnabled(value); valueIterations.setEnabled(value); - comboPass.setEnabled(value); + comboPass.setEnabled(value); checkEndScan.setEnabled(value); checkSaveImage.setEnabled(value); updateButtons(); @@ -151,88 +151,91 @@ 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 DeviceAdapter() { @Override public void onValueChanged(Device device, Object o, Object o1) { - if (running){ - getView().getStatusBar().setProgress(scienta.getProgress()); - } + if (running) { + getView().getStatusBar().setProgress(scienta.getProgress()); + } } }; - public final String CURRERNT_RANGE_VAR = "cur_range"; - public final String CURRERNT_ITERATION_VAR = "cur_iteration"; - int currentScanIndex ; + public final String CURRERNT_RANGE_VAR = "cur_range"; + public final String CURRERNT_ITERATION_VAR = "cur_iteration"; + int currentScanIndex; RangeSelection[] scanRanges; @Override protected void onTimer() { - try{ - if (running){ + try { + if (running) { Object index = XPSSpectrum.this.eval(CURRERNT_RANGE_VAR, true); - if ((index!=null) && (index instanceof Integer) && ((Integer)index >= 0)){ - int scanIndex = (Integer)index; - if (scanIndex!=currentScanIndex){ + if ((index != null) && (index instanceof Integer) && ((Integer) index >= 0)) { + int scanIndex = (Integer) index; + if (scanIndex != currentScanIndex) { buttonSkip.setEnabled(true); } currentScanIndex = scanIndex; int current_iteration = (Integer) XPSSpectrum.this.eval(CURRERNT_ITERATION_VAR, true); - int iterations = (Integer)scanRanges[currentScanIndex].getVars()[2]; + int iterations = (Integer) scanRanges[currentScanIndex].getVars()[2]; - buttonSkip.setVisible((iterations>1) && (current_iteration < (iterations-1))); + buttonSkip.setVisible((iterations > 1) && (current_iteration < (iterations - 1))); - if (detailedScan){ - 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))){ + if (detailedScan) { + 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)){ + if (row == (rangeSelectionPanel.getTable().getRowCount() - 1)) { rangeSelectionPanel.getTable().clearSelection(); } - } + } } } else { rangeSelectionPanel.getTable().clearSelection(); } } else { - int steps = 0; - RangeSelection[] r = rangeSelectionPanel.getRanges(); - if ((buttonDetailedScan.isEnabled()) && (r.length>0)){ - for (int i=0;i 0)) { + for (int i = 0; i < r.length; i++) { + int iterations = (Integer) r[i].getVars()[2]; + steps += iterations; + } + } else { + steps = Math.max(1, (int) valueIterations.getValue()); } - } else { - steps = Math.max(1, (int)valueIterations.getValue()); + int seconds = (int) (Double.valueOf(dvpAcqTime.getLabel().getText()) * steps); + int hours = seconds / (60 * 60); + textTotalTime.setText(hours >= 24 ? hours + "h" : LocalTime.ofSecondOfDay(seconds).toString()); + } catch (Exception ex) { + textTotalTime.setText(""); } - int seconds = (int) (Double.valueOf(dvpAcqTime.getLabel().getText()) * steps); - int hours= seconds / (60 * 60); - textTotalTime.setText(hours >= 24 ? hours+"h": LocalTime.ofSecondOfDay(seconds).toString()); } - } catch (Exception ex){ + } catch (Exception ex) { getLogger().log(Level.FINE, null, ex); } } - - void start() throws Context.ContextStateException{ - HashMap args = new HashMap<>(); - args.put("ranges", scanRanges); - args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString())); - args.put("save_scienta_image", checkSaveImage.isSelected()); - args.put("ENDSCAN", checkEndScan.isSelected()); - currentScanIndex = -1; - runAsync("XPSSpectrum", args); - //startTimer(500,10); - running = true; + + void start() throws Context.ContextStateException { + HashMap args = new HashMap<>(); + args.put("ranges", scanRanges); + args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString())); + args.put("save_scienta_image", checkSaveImage.isSelected()); + args.put("ENDSCAN", checkEndScan.isSelected()); + currentScanIndex = -1; + runAsync("XPSSpectrum", args); + //startTimer(500,10); + running = true; } - - + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -567,17 +570,17 @@ public class XPSSpectrum extends Panel { scienta.stop(); } catch (Exception ex) { showException(ex); - } + } }//GEN-LAST:event_buttonAbortActionPerformed private void buttonInitialScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInitialScanActionPerformed try { rangeSelectionPanel.clear(); detailedScan = false; - - RangeSelection initialRange = new RangeSelection(valueLow.getValue(),valueHigh.getValue()); - int iterations = (int)valueIterations.getValue(); - initialRange.setVars(new Object[]{valueTime.getValue(), valueSize.getValue(),iterations}); + + RangeSelection initialRange = new RangeSelection(valueLow.getValue(), valueHigh.getValue()); + int iterations = (int) valueIterations.getValue(); + initialRange.setVars(new Object[]{valueTime.getValue(), valueSize.getValue(), iterations}); scanRanges = new RangeSelection[]{initialRange}; start(); @@ -589,9 +592,9 @@ public class XPSSpectrum extends Panel { private void buttonDetailedScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDetailedScanActionPerformed try { - detailedScan = true; + detailedScan = true; scanRanges = rangeSelectionPanel.getRangesOrdered(); - + start(); } catch (Exception ex) { showException(ex); @@ -606,19 +609,19 @@ public class XPSSpectrum extends Panel { int rVal = chooser.showSaveDialog(this); if (rVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); - if (IO.getExtension(f).isEmpty()){ + if (IO.getExtension(f).isEmpty()) { f = new File(f.getPath() + ".xps"); } Object[] obj = new Object[]{SwingUtils.getTableData(rangeSelectionPanel.getTable()), - rangeSelectionPanel.getPlot().getSeries(0).getX(), - rangeSelectionPanel.getPlot().getSeries(0).getY()}; + rangeSelectionPanel.getPlot().getSeries(0).getX(), + rangeSelectionPanel.getPlot().getSeries(0).getY()}; Files.write(f.toPath(), Serializer.encode(obj, Serializer.EncoderType.bin)); - + } } catch (Exception ex) { showException(ex); } - + }//GEN-LAST:event_btSaveActionPerformed private void btLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLoadActionPerformed @@ -629,24 +632,24 @@ public class XPSSpectrum extends Panel { int rVal = chooser.showOpenDialog(this); if (rVal == JFileChooser.APPROVE_OPTION) { rangeSelectionPanel.removeAllRanges(); - Object[] obj = (Object[])Serializer.decode(Files.readAllBytes(chooser.getSelectedFile().toPath()), Serializer.EncoderType.bin); + Object[] obj = (Object[]) Serializer.decode(Files.readAllBytes(chooser.getSelectedFile().toPath()), Serializer.EncoderType.bin); Object[][] table = (Object[][]) obj[0]; - if (!rangeSelectionPanel.getPlot().hasData()){ + if (!rangeSelectionPanel.getPlot().hasData()) { double[] x = (double[]) obj[1]; double[] y = (double[]) obj[2]; - LinePlotSeries series = new LinePlotSeries("Data"); + LinePlotSeries series = new LinePlotSeries("Data"); rangeSelectionPanel.setSeries(series); series.setData(x, y); } - for (Object[] row:table){ - rangeSelectionPanel.getPlot().addRange((Double)row[0], (Double)row[2]); + for (Object[] row : table) { + rangeSelectionPanel.getPlot().addRange((Double) row[0], (Double) row[2]); } SwingUtilities.invokeLater(new Runnable() { @Override - public void run() { + public void run() { for (int row = 0; row < table.length; row++) { for (int col = 3; col < 6; col++) { - rangeSelectionPanel.getTable().setValueAt(table[row][col], row , col); + rangeSelectionPanel.getTable().setValueAt(table[row][col], row, col); } } } @@ -667,9 +670,9 @@ public class XPSSpectrum extends Panel { }//GEN-LAST:event_buttonSkipActionPerformed private void buttonScientaSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScientaSetupActionPerformed - try{ + try { showDevicePanel("Scienta"); - } catch (Exception ex){ + } catch (Exception ex) { SwingUtils.showException(this, ex); } }//GEN-LAST:event_buttonScientaSetupActionPerformed