From 93cf20f0e364ad42e4edcca7c0a5e000d32c0f49 Mon Sep 17 00:00:00 2001 From: gac-x09la Date: Tue, 28 Sep 2021 17:48:13 +0200 Subject: [PATCH] SIStem plugin --- config/devices.properties | 24 +- config/plugins.properties | 4 + devices/acmi.properties | 6 + devices/exit_slit.properties | 6 + devices/fe_horiz_width.properties | 6 + devices/fe_vert_width.properties | 6 + devices/helium_valve.properties | 6 + devices/scienta center energy.properties | 2 +- devices/scienta high energy.properties | 2 +- devices/scienta low energy.properties | 2 +- devices/tcmp.properties | 6 + devices/temp_boot1.properties | 6 + devices/temp_boot2.properties | 6 + devices/temp_cryopump.properties | 6 + devices/temp_cryostat.properties | 6 + devices/temp_headmech.properties | 6 + devices/temp_sample1.properties | 6 + devices/temp_sample2.properties | 6 + devices/temp_shield.properties | 6 + devices/{tht.properties => theta.properties} | 0 devices/{tlt.properties => tilt.properties} | 0 devices/{trx.properties => x.properties} | 0 devices/{try.properties => y.properties} | 0 devices/{trz.properties => z.properties} | 0 plugins/NewJPanel.form | 28 - plugins/NewJPanel.java | 44 - plugins/SIStem.form | 1170 +++++++++++++ plugins/SIStem.java | 1540 ++++++++++++++++++ plugins/Test.form | 59 - plugins/Test.java | 106 -- script/templates/SIStem.py | 82 + 31 files changed, 2902 insertions(+), 245 deletions(-) create mode 100644 config/plugins.properties create mode 100644 devices/acmi.properties create mode 100644 devices/exit_slit.properties create mode 100644 devices/fe_horiz_width.properties create mode 100644 devices/fe_vert_width.properties create mode 100644 devices/helium_valve.properties create mode 100644 devices/tcmp.properties create mode 100644 devices/temp_boot1.properties create mode 100644 devices/temp_boot2.properties create mode 100644 devices/temp_cryopump.properties create mode 100644 devices/temp_cryostat.properties create mode 100644 devices/temp_headmech.properties create mode 100644 devices/temp_sample1.properties create mode 100644 devices/temp_sample2.properties create mode 100644 devices/temp_shield.properties rename devices/{tht.properties => theta.properties} (100%) rename devices/{tlt.properties => tilt.properties} (100%) rename devices/{trx.properties => x.properties} (100%) rename devices/{try.properties => y.properties} (100%) rename devices/{trz.properties => z.properties} (100%) delete mode 100644 plugins/NewJPanel.form delete mode 100644 plugins/NewJPanel.java create mode 100644 plugins/SIStem.form create mode 100644 plugins/SIStem.java delete mode 100644 plugins/Test.form delete mode 100644 plugins/Test.java create mode 100644 script/templates/SIStem.py diff --git a/config/devices.properties b/config/devices.properties index a39e4cc..c9ab155 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -2,17 +2,31 @@ scienta=Scienta|X09LA-SCIENTA|||true current=ch.psi.pshell.epics.ChannelDouble|ARIDI-PCT:CURRENT 6|Read||true keithley10=ch.psi.pshell.epics.ChannelDouble|X09LA-KEI10:READOUT|Read||true keithley11=ch.psi.pshell.epics.ChannelDouble|X09LA-KEI11:READOUT|Read||true -trx=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRX|||true -try=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRY|||true -trz=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRZ|||true +x=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRX|||true +y=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRY|||true +z=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TRZ|||true phi=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:PHI|||true -tht=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:THT|||true -tlt=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TLT|||true +theta=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:THT|||true +tilt=ch.psi.pshell.epics.Motor|X09LA-ES1-MA:TLT|||true manip=ch.psi.pshell.device.MotorGroupBase|trx try trz phi tht tlt|||true id_mode=ch.psi.pshell.epics.DiscretePositioner|X09LA-ID:MODE|||true id_status=ch.psi.pshell.epics.ChannelString|X09LA-ID:OFFS-MNTR|Read||true shutter=ch.psi.pshell.epics.DiscretePositioner|X09LA-SIS:OPEN|||true energy=ch.psi.pshell.epics.Positioner|X09LA-PHS:E_SP X09LA-PGM:rbkenergy|||true +temp_cryostat=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP_RBV|Read||false +temp_sample1=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-B|Read|| +temp_headmech=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-C|Read|| +temp_sample2=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-D|Read|| +temp_boot1=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-Ch2|Read|| +temp_shield=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-Ch3|Read|| +temp_boot2=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-Ch4|Read|| +temp_cryopump=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:TEMP-Ch5|Read|| +helium_valve=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-PC-LAKESHORE:ANALOG-OUT_RBV.VAL|Read|| +acmi=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-ES1-ACMI:PRESSURE|Read|| +tcmp=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-ES1-TCMP:PRESSURE|Read||false +exit_slit=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-OP2-SL:TRY.VAL|Read|| +fe_vert_width=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-FE-SVsize|Read|| +fe_horiz_width=ch.psi.pshell.epics.ReadonlyProcessVariable|X09LA-FE-SHsize|Read|| image=ch.psi.pshell.imaging.CameraSource|scienta|||true cam1=ch.psi.pshell.imaging.MjpegSource|http://129.129.117.82/axis-cgi/mjpg/video.cgi?camera=1||-200| cam2=ch.psi.pshell.imaging.MjpegSource|http://129.129.117.82/axis-cgi/mjpg/video.cgi?camera=2||-200| diff --git a/config/plugins.properties b/config/plugins.properties new file mode 100644 index 0000000..be9fea4 --- /dev/null +++ b/config/plugins.properties @@ -0,0 +1,4 @@ +NewJPanel.java=disabled +Test.java=disabled +SIStem.java=enabled +EnergyScan.java=disabled diff --git a/devices/acmi.properties b/devices/acmi.properties new file mode 100644 index 0000000..ccabaf2 --- /dev/null +++ b/devices/acmi.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=mbar +offset=0.0 +precision=12 +sign_bit=0 +scale=1.0 diff --git a/devices/exit_slit.properties b/devices/exit_slit.properties new file mode 100644 index 0000000..0904d57 --- /dev/null +++ b/devices/exit_slit.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:45:37 CEST 2021 +unit=800.0000000 +offset=0.0 +precision=800 +sign_bit=0 +scale=1.0 diff --git a/devices/fe_horiz_width.properties b/devices/fe_horiz_width.properties new file mode 100644 index 0000000..0e8fc6e --- /dev/null +++ b/devices/fe_horiz_width.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:45:37 CEST 2021 +unit=mm +offset=0.0 +precision=3 +sign_bit=0 +scale=1.0 diff --git a/devices/fe_vert_width.properties b/devices/fe_vert_width.properties new file mode 100644 index 0000000..0e8fc6e --- /dev/null +++ b/devices/fe_vert_width.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:45:37 CEST 2021 +unit=mm +offset=0.0 +precision=3 +sign_bit=0 +scale=1.0 diff --git a/devices/helium_valve.properties b/devices/helium_valve.properties new file mode 100644 index 0000000..d669c12 --- /dev/null +++ b/devices/helium_valve.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=0 +offset=0.0 +precision=0 +sign_bit=0 +scale=1.0 diff --git a/devices/scienta center energy.properties b/devices/scienta center energy.properties index 1739b63..ffeb199 100644 --- a/devices/scienta center energy.properties +++ b/devices/scienta center energy.properties @@ -1,5 +1,5 @@ #Mon Aug 30 10:57:12 CEST 2021 -minValue=0.0 +minValue=-2000.0 unit= offset=0.0 maxValue=2000.0 diff --git a/devices/scienta high energy.properties b/devices/scienta high energy.properties index 1739b63..ffeb199 100644 --- a/devices/scienta high energy.properties +++ b/devices/scienta high energy.properties @@ -1,5 +1,5 @@ #Mon Aug 30 10:57:12 CEST 2021 -minValue=0.0 +minValue=-2000.0 unit= offset=0.0 maxValue=2000.0 diff --git a/devices/scienta low energy.properties b/devices/scienta low energy.properties index 1739b63..ffeb199 100644 --- a/devices/scienta low energy.properties +++ b/devices/scienta low energy.properties @@ -1,5 +1,5 @@ #Mon Aug 30 10:57:12 CEST 2021 -minValue=0.0 +minValue=-2000.0 unit= offset=0.0 maxValue=2000.0 diff --git a/devices/tcmp.properties b/devices/tcmp.properties new file mode 100644 index 0000000..ccabaf2 --- /dev/null +++ b/devices/tcmp.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=mbar +offset=0.0 +precision=12 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_boot1.properties b/devices/temp_boot1.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_boot1.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_boot2.properties b/devices/temp_boot2.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_boot2.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_cryopump.properties b/devices/temp_cryopump.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_cryopump.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_cryostat.properties b/devices/temp_cryostat.properties new file mode 100644 index 0000000..3444f5b --- /dev/null +++ b/devices/temp_cryostat.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:07:51 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_headmech.properties b/devices/temp_headmech.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_headmech.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_sample1.properties b/devices/temp_sample1.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_sample1.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_sample2.properties b/devices/temp_sample2.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_sample2.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/temp_shield.properties b/devices/temp_shield.properties new file mode 100644 index 0000000..154ff95 --- /dev/null +++ b/devices/temp_shield.properties @@ -0,0 +1,6 @@ +#Mon Sep 27 17:22:53 CEST 2021 +unit=K +offset=0.0 +precision=2 +sign_bit=0 +scale=1.0 diff --git a/devices/tht.properties b/devices/theta.properties similarity index 100% rename from devices/tht.properties rename to devices/theta.properties diff --git a/devices/tlt.properties b/devices/tilt.properties similarity index 100% rename from devices/tlt.properties rename to devices/tilt.properties diff --git a/devices/trx.properties b/devices/x.properties similarity index 100% rename from devices/trx.properties rename to devices/x.properties diff --git a/devices/try.properties b/devices/y.properties similarity index 100% rename from devices/try.properties rename to devices/y.properties diff --git a/devices/trz.properties b/devices/z.properties similarity index 100% rename from devices/trz.properties rename to devices/z.properties diff --git a/plugins/NewJPanel.form b/plugins/NewJPanel.form deleted file mode 100644 index c638b68..0000000 --- a/plugins/NewJPanel.form +++ /dev/null @@ -1,28 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/plugins/NewJPanel.java b/plugins/NewJPanel.java deleted file mode 100644 index d05e096..0000000 --- a/plugins/NewJPanel.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author gac-x09la - */ -public class NewJPanel extends javax.swing.JPanel { - - /** - * Creates new form NewJPanel - */ - public NewJPanel() { - initComponents(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 400, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 300, Short.MAX_VALUE) - ); - }// //GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - // End of variables declaration//GEN-END:variables -} diff --git a/plugins/SIStem.form b/plugins/SIStem.form new file mode 100644 index 0000000..61f4350 --- /dev/null +++ b/plugins/SIStem.form @@ -0,0 +1,1170 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ diff --git a/plugins/SIStem.java b/plugins/SIStem.java new file mode 100644 index 0000000..cb96e0a --- /dev/null +++ b/plugins/SIStem.java @@ -0,0 +1,1540 @@ + +import ch.psi.pshell.core.JsonSerializer; +import ch.psi.pshell.device.Motor; +import ch.psi.pshell.device.Positioner; +import ch.psi.pshell.device.ReadonlyProcessVariable; +import ch.psi.pshell.ui.PanelProcessor; +import ch.psi.pshell.ui.QueueProcessor; +import ch.psi.utils.Arr; +import ch.psi.utils.Convert; +import ch.psi.utils.IO; +import ch.psi.utils.Reflection; +import ch.psi.utils.State; +import ch.psi.utils.swing.SwingUtils; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.DropMode; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.TransferHandler; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.table.DefaultTableModel; + +/** + * + */ +public class SIStem extends PanelProcessor { + + File currentFile; + final DefaultTableModel modelInactive; + final DefaultTableModel modelFixed; + final DefaultTableModel modelScanned; + + public static final String FILE_EXTENSION = "json"; + final JTextField[] scientaFloatFields; + final JTextField[] scientaIntFields; + final JComboBox[] scientaCombos; + final JTextField[] scientaRangeFields; + + public SIStem() { + initComponents(); + modelInactive = (DefaultTableModel) tableInactive.getModel(); + modelFixed = (DefaultTableModel) tableFixed.getModel(); + modelScanned = (DefaultTableModel) tableScanned.getModel(); + + abstract class PositinerTransferHandler extends TransferHandler { + + @Override + public int getSourceActions(JComponent c) { + return DnDConstants.ACTION_COPY_OR_MOVE; + } + + @Override + public Transferable createTransferable(JComponent comp) { + try { + JTable table = (JTable) comp; + return new StringSelection((String) table.getModel().getValueAt(table.getSelectedRow(), 0)); + } catch (Exception ex) { + return null; + } + } + + @Override + public boolean canImport(TransferHandler.TransferSupport support) { + return support.isDataFlavorSupported(DataFlavor.stringFlavor); + } + + @Override + public boolean importData(TransferHandler.TransferSupport support) { + if (support.isDrop() && canImport(support)) { + try { + JTable.DropLocation dl = (JTable.DropLocation) support.getDropLocation(); + String name = (String) support.getTransferable().getTransferData(DataFlavor.stringFlavor); + Positioner pos = getContext().getDevicePool().getByName(name, Positioner.class); + DefaultTableModel model = ((DefaultTableModel) ((JTable) support.getComponent()).getModel()); + addPositioner(pos, model, dl.getRow(), getRowData(pos)); + } catch (Exception ex) { + return false; + } + } + return true; + } + + abstract Object[] getRowData(Positioner pos); + }; + + tableInactive.setDragEnabled(true); + tableInactive.setDropMode(DropMode.INSERT_ROWS); + tableInactive.setFillsViewportHeight(true); + tableInactive.setTransferHandler(new PositinerTransferHandler() { + @Override + Object[] getRowData(Positioner pos) { + return new Object[]{pos.getName()}; + } + }); + + tableFixed.setDragEnabled(true); + tableFixed.setDropMode(DropMode.INSERT_ROWS); + tableFixed.setFillsViewportHeight(true); + tableFixed.setTransferHandler(new PositinerTransferHandler() { + @Override + Object[] getRowData(Positioner pos) { + return new Object[]{pos.getName(), Double.NaN, pos.getUnit()}; + } + }); + + tableScanned.setDragEnabled(true); + tableScanned.setDropMode(DropMode.INSERT_ROWS); + tableScanned.setFillsViewportHeight(true); + tableScanned.setTransferHandler(new PositinerTransferHandler() { + @Override + Object[] getRowData(Positioner pos) { + return new Object[]{pos.getName(), Double.NaN, Double.NaN, 0, Double.NaN, pos.getUnit()}; + } + }); + + scientaFloatFields = new JTextField[]{textLowEnergy, textCenterEnergy, textHighEnergy, textStepEnergy, + textLowThetaY, textCenterThetaY, textHighThetaY, textStepThetaY, textCenterThetaX}; + scientaIntFields= new JTextField[]{textSlices, textChannels}; + scientaRangeFields = new JTextField[]{ textXChannelMax, textXChannelMin, textYChannelMax, textYChannelMin}; + scientaCombos = new JComboBox[]{ comboPass, comboAcquisition, comboEnergy, comboLens, comboDetMode}; + + try { + Class scienta = getContext().getClassByName("Scienta"); + SwingUtils.setEnumCombo(comboLens, Reflection.getDeclaredClass(scienta, "LensMode"), true); + SwingUtils.setEnumCombo(comboEnergy, Reflection.getDeclaredClass(scienta, "EnergyMode"), true); + SwingUtils.setEnumCombo(comboAcquisition, Reflection.getDeclaredClass(scienta, "AcquisitionMode"), true); + SwingUtils.setEnumCombo(comboDetMode, Reflection.getDeclaredClass(scienta, "DetectorMode"), true); + comboPass.setModel(new javax.swing.DefaultComboBoxModel(Convert.toStringArray(scienta.getField("PASS_ENERGY_VALUES").get(null)))); + } catch (Exception ex) { + getLogger().log(Level.SEVERE, null, ex); + } + + for (JComboBox combo : scientaCombos){ + SwingUtils.insertCombo(combo, "", 0); + } + clear(); + } + + void addPositioner(Positioner pos, DefaultTableModel model, int row, Object[] data) { + if (row < 0) { + row = model.getRowCount(); + } + model.insertRow(row, data); + removePositioner(pos, modelInactive, (model == modelInactive) ? row : -1); + removePositioner(pos, modelFixed, (model == modelFixed) ? row : -1); + removePositioner(pos, modelScanned, (model == modelScanned) ? row : -1); + } + + void removePositioner(Positioner pos, DefaultTableModel model, int except) { + for (int i = 0; i < model.getRowCount(); i++) { + if ((except < 0) || (i != except)) { + if (model.getValueAt(i, 0).equals(pos.getName())) { + model.removeRow(i); + break; + } + } + } + } + + //Overridable callbacks + @Override + public void onInitialize(int runCount) { + if ((modelFixed.getRowCount() == 0) && (modelScanned.getRowCount() == 0) && (modelInactive.getRowCount() == 0)) { + initInactive(); + + } + } + + @Override + public void onStateChange(State state, State former) { + updateControls(); + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + //Callback to perform update - in event thread + @Override + protected void doUpdate() { + } + + @Override + public String getFileName() { + return (currentFile == null) ? null : currentFile.toString(); + } + + @Override + public boolean isTabNameUpdated() { + return false; + } + + @Override + public String getType() { + return "SIStem"; + } + + @Override + public boolean createMenuNew() { + return true; + } + + @Override + public boolean createFilePanel() { + return true; + } + + @Override + public String getDescription() { + return "SIStem Scan definition file (*." + FILE_EXTENSION + ")"; + } + + @Override + public String[] getExtensions() { + return new String[]{FILE_EXTENSION}; + } + + @Override + public String getHomePath() { + return "{script}/scans"; + } + + @Override + public void saveAs(String fileName) throws IOException { + currentFile = new File(fileName); + Map preActions = new HashMap(); + + for (JComboBox combo : scientaCombos){ + if (combo.getSelectedIndex()>0){ + preActions.put(combo.getName(), String.valueOf(combo.getSelectedItem())); + } + } + for (JTextField text :scientaFloatFields) { + if (!text.getText().isBlank()){ + preActions.put(text.getName(), Double.valueOf(text.getText().trim())); + } + } + for (JTextField text :scientaIntFields) { + if (!text.getText().isBlank()){ + preActions.put(text.getName(), Integer.valueOf(text.getText().trim())); + } + } + for (int i = 0; i < modelFixed.getRowCount(); i++) { + preActions.put(modelFixed.getValueAt(i, 0), modelFixed.getValueAt(i, 1)); + } + + String[] positioners = new String[modelScanned.getRowCount()]; + Double[] start = new Double[modelScanned.getRowCount()]; + Double[] stop = new Double[modelScanned.getRowCount()]; + Integer[] steps = new Integer[modelScanned.getRowCount()]; + for (int i = 0; i < modelScanned.getRowCount(); i++) { + positioners[i] = (String) modelScanned.getValueAt(i, 0); + start[i] = (Double) modelScanned.getValueAt(i, 1); + stop[i] = (Double) modelScanned.getValueAt(i, 2); + steps[i] = (Integer) modelScanned.getValueAt(i, 3) - 1; + } + + Integer[] range = new Integer[4]; + for (int i=0; i< scientaRangeFields.length; i++){ + range[i] = scientaRangeFields[i].getText().isBlank() ? null : Integer.valueOf(scientaRangeFields[i].getText().trim()); + } + + + Map config = new HashMap(); + config.put("PRE_ACTIONS", preActions); + config.put("RANGE", range.equals(new Integer[]{null,null,null,null}) ? new ArrayList() : Arr.toList(range)); + config.put("POSITIONERS", positioners); + config.put("START", start); + config.put("STOP", stop); + config.put("STEPS", steps); + + config.put("SENSORS", getDevices(textSensors)); + config.put("SNAPS", getDevices(textSnapshots)); + config.put("DIAGS", getDevices(textDiagnostics)); + config.put("MONITORS", getDevices(textMonitors)); + + config.put("SETTLING_TIME", spinnerLatency.getValue()); + config.put("PASSES", spinnerPasses.getValue()); + config.put("ZIGZAG", checkZigzag.isSelected()); + config.put("COMPRESSION", true); + + String json = JsonSerializer.encode(config, true); + Files.write(currentFile.toPath(), json.getBytes()); + updateControls(); + } + + @Override + public void open(String fileName) throws IOException { + clear(); + if (fileName != null) { + Path path = Paths.get(fileName); + String json = new String(Files.readAllBytes(path)); + currentFile = path.toFile(); + Map config = (Map) JsonSerializer.decode(json, Map.class); + + Map preActions = (Map) config.get("PRE_ACTIONS"); + List range = (List) config.getOrDefault("RANGE", new ArrayList()); + + List positioners = (List) config.get("POSITIONERS"); + List start = (List) config.get("START"); + List stop = (List) config.get("STOP"); + List steps = (List) config.get("STEPS"); + + for (String name : preActions.keySet()) { + for (JComboBox combo : scientaCombos){ + if (name.equals(combo.getName())){ + combo.setSelectedItem(String.valueOf(preActions.get(name))); + break; + } + } + for (JTextField text :Arr.append(scientaFloatFields, scientaIntFields)) { + if (name.equals(text.getName())){ + text.setText(String.valueOf(preActions.get(name))); + break; + } + } + for (int i = 0; i) config.get("SENSORS")); + setDevices(textSnapshots, (List) config.get("SNAPS")); + setDevices(textDiagnostics, (List) config.get("DIAGS")); + setDevices(textMonitors, (List) config.get("MONITORS")); + + spinnerLatency.setValue(config.get("SETTLING_TIME")); + spinnerPasses.setValue(config.get("PASSES")); + checkZigzag.setSelected((Boolean) config.get("ZIGZAG")); + } + updateControls(); + } + + void clear() { + currentFile = null; + for (JComboBox combo : scientaCombos){ + combo.setSelectedIndex(0); + } + + for (JTextField text : Arr.append( Arr.append(scientaFloatFields, scientaIntFields), scientaRangeFields)) { + text.setText(""); + } + + modelFixed.setRowCount(0); + modelScanned.setRowCount(0); + + String[] DEFAULT_SENSORS = new String[]{"scienta.dataMatrix"}; + //String[] DEFAULT_SNAPS = new String[]{"temp_cryostat", "temp_sample1", "temp_headmech", "temp_sample2", + // "temp_boot1", "temp_shield", "temp_boot2", "temp_cryopump", + // "acmi", "tcmp", "exit_slit", "fe_vert_width", "fe_horiz_width"}; + //String[] DEFAULT_DIAGS = new String[]{"x", "y", "z", "phi", "theta", "tilt"}; + String[] DEFAULT_DIAGS = getContext().getDevicePool().getAllNamesOrderedByName(Motor.class); + String[] DEFAULT_SNAPS = Arr.remove(getContext().getDevicePool().getAllNamesOrderedByName(ReadonlyProcessVariable.class), DEFAULT_DIAGS); + String[] DEFAULT_MONITORS = new String[]{"current"}; + + setDevices(textSensors, Arr.toList(DEFAULT_SENSORS)); + setDevices(textSnapshots, Arr.toList(DEFAULT_SNAPS)); + setDevices(textDiagnostics, Arr.toList(DEFAULT_DIAGS)); + setDevices(textMonitors, Arr.toList(DEFAULT_MONITORS)); + initInactive(); + updateControls(); + } + + public List getDevices(JTextArea text) { + return Arr.toList(text.getText().split("\n")); + } + + public void setDevices(JTextArea text, List devices) { + text.setText(String.join("\n", devices)); + } + + void initInactive() { + modelInactive.setRowCount(0); + Positioner[] positioners = getContext().getDevicePool().getAllDevicesOrderedByName(Positioner.class); + for (Positioner pos : positioners) { + modelInactive.addRow(new Object[]{pos.getName()}); + } + } + + @Override + public void execute() throws Exception { + checkValues(); + save(); + if (currentFile == null) { + return; + } + + HashMap args = new HashMap(); + args.put("NAME", getScanName()); + + this.runAsync("templates/SIStem", args).handle((ret, ex) -> { + if (ex != null) { + } + try { + } catch (Exception e) { + Logger.getLogger(SIStem.class.getName()).log(Level.SEVERE, null, e); + } + return ret; + }); + + } + + String getScanName() { + if (currentFile != null) { + return IO.getPrefix(currentFile); + } + return null; + } + + void updateControls() { + State state = getState(); + try { + textFileId.setText(String.valueOf(getContext().getFileSequentialNumber())); + } catch (Exception ex) { + textFileId.setText(""); + } + + String fileName = getFileName(); + if (fileName == null) { + textFile.setText(""); + } else { + String home = getContext().getSetup().expandPath(getHomePath()); + if (IO.isSubPath(fileName, home)) { + fileName = IO.getRelativePath(fileName, home); + } + textFile.setText(fileName); + } + + buttonStart.setEnabled((state == State.Ready) && (currentFile != null)); + buttonAddToQueue.setEnabled((state == State.Ready) && (currentFile != null)); + buttonAbort.setEnabled(state.isProcessing()); + buttonScienta.setEnabled(state.isInitialized()); + + } + + void checkValues() { + for (int i = 0; i < modelFixed.getRowCount(); i++) { + if (Double.isNaN((Double) modelFixed.getValueAt(i, 1))) { + throw new IllegalArgumentException("Invalid value for " + modelFixed.getValueAt(i, 0)); + } + } + for (int i = 0; i < modelScanned.getRowCount(); i++) { + if (Double.isNaN((Double) modelScanned.getValueAt(i, 1))) { + throw new IllegalArgumentException("Invalid start for " + modelFixed.getValueAt(i, 0)); + } + if (Double.isNaN((Double) modelScanned.getValueAt(i, 2))) { + throw new IllegalArgumentException("Invalid stop for " + modelFixed.getValueAt(i, 0)); + } + if (((Integer) modelScanned.getValueAt(i, 3)) < 1) { + throw new IllegalArgumentException("Invalid points for " + modelFixed.getValueAt(i, 0)); + } + } + for (JTextArea text : new JTextArea[]{textSensors, textDiagnostics, textSnapshots, textMonitors}) { + for (String name : getDevices(text)) { + try { + eval(name + ".take()", true); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid device " + name + " in " + text.getName() + " table"); + } + } + } + + for (JTextField text :scientaFloatFields) { + if (!text.getText().isBlank()) { + try { + Double.valueOf(text.getText().trim()); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid value in " + text.getName() ); + } + } + } + for (JTextField text :scientaIntFields) { + if (!text.getText().isBlank()) { + try { + Integer.valueOf(text.getText().trim()); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid value in " + text.getName() ); + } + } + } + List defined = new ArrayList(); + for (JTextField text :scientaRangeFields) { + if (!text.getText().isBlank()) { + try { + Integer.valueOf(text.getText().trim()); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid value in " + text.getName() ); + } + } + defined.add(text.getText().isBlank()?false:true); + } + if ((defined.get(0) != defined.get(1)) || (defined.get(2) != defined.get(3))){ + throw new IllegalArgumentException("Invalid detector range"); + } + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonScienta = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + textFileId = new javax.swing.JTextField(); + buttonResetId = new javax.swing.JButton(); + buttonStart = new javax.swing.JButton(); + buttonAbort = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel4 = new javax.swing.JPanel(); + jPanel6 = new javax.swing.JPanel(); + jLabel14 = new javax.swing.JLabel(); + textStepEnergy = new javax.swing.JTextField(); + jLabel13 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + textHighEnergy = new javax.swing.JTextField(); + textCenterEnergy = new javax.swing.JTextField(); + textLowEnergy = new javax.swing.JTextField(); + jPanel7 = new javax.swing.JPanel(); + jLabel17 = new javax.swing.JLabel(); + textStepThetaY = new javax.swing.JTextField(); + jLabel18 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + textHighThetaY = new javax.swing.JTextField(); + textCenterThetaY = new javax.swing.JTextField(); + textLowThetaY = new javax.swing.JTextField(); + jPanel9 = new javax.swing.JPanel(); + jLabel26 = new javax.swing.JLabel(); + textCenterThetaX = new javax.swing.JTextField(); + jPanel10 = new javax.swing.JPanel(); + jLabel11 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + comboPass = new javax.swing.JComboBox(); + comboLens = new javax.swing.JComboBox(); + jLabel7 = new javax.swing.JLabel(); + comboAcquisition = new javax.swing.JComboBox(); + comboEnergy = new javax.swing.JComboBox(); + jPanel5 = new javax.swing.JPanel(); + jLabel16 = new javax.swing.JLabel(); + comboDetMode = new javax.swing.JComboBox(); + jLabel9 = new javax.swing.JLabel(); + jLabel25 = new javax.swing.JLabel(); + textSlices = new javax.swing.JTextField(); + textChannels = new javax.swing.JTextField(); + jLabel27 = new javax.swing.JLabel(); + textXChannelMin = new javax.swing.JTextField(); + textXChannelMax = new javax.swing.JTextField(); + jLabel10 = new javax.swing.JLabel(); + textYChannelMin = new javax.swing.JTextField(); + textYChannelMax = new javax.swing.JTextField(); + jPanel11 = new javax.swing.JPanel(); + checkZigzag = new javax.swing.JCheckBox(); + jLabel4 = new javax.swing.JLabel(); + spinnerLatency = new javax.swing.JSpinner(); + jLabel1 = new javax.swing.JLabel(); + spinnerPasses = new javax.swing.JSpinner(); + jLabel8 = new javax.swing.JLabel(); + jPanel1 = new javax.swing.JPanel(); + jScrollPane1 = new javax.swing.JScrollPane(); + tableInactive = new javax.swing.JTable(); + jScrollPane2 = new javax.swing.JScrollPane(); + tableFixed = new javax.swing.JTable(); + jScrollPane3 = new javax.swing.JScrollPane(); + tableScanned = new javax.swing.JTable(); + jPanel3 = new javax.swing.JPanel(); + jScrollPane4 = new javax.swing.JScrollPane(); + textSensors = new javax.swing.JTextArea(); + jScrollPane5 = new javax.swing.JScrollPane(); + textSnapshots = new javax.swing.JTextArea(); + jScrollPane6 = new javax.swing.JScrollPane(); + textDiagnostics = new javax.swing.JTextArea(); + jScrollPane7 = new javax.swing.JScrollPane(); + textMonitors = new javax.swing.JTextArea(); + buttonAddToQueue = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + textFile = new javax.swing.JTextField(); + buttonOpen = new javax.swing.JButton(); + buttonSave = new javax.swing.JButton(); + buttonClear = new javax.swing.JButton(); + + buttonScienta.setText("Scienta Panel"); + buttonScienta.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonScientaActionPerformed(evt); + } + }); + + jLabel2.setText("File ID:"); + + textFileId.setEditable(false); + textFileId.setHorizontalAlignment(javax.swing.JTextField.CENTER); + + buttonResetId.setText("Reset"); + buttonResetId.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonResetIdActionPerformed(evt); + } + }); + + buttonStart.setText("Start"); + buttonStart.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonStartActionPerformed(evt); + } + }); + + buttonAbort.setText("Abort"); + buttonAbort.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonAbortActionPerformed(evt); + } + }); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters")); + + jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Energy Range (eV)")); + + jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel14.setText("High:"); + + textStepEnergy.setName("scienta.energyStepSize"); // NOI18N + + jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel13.setText("Center:"); + + jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel12.setText("Low:"); + + jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel15.setText("Step:"); + + textHighEnergy.setName("scienta.highEnergy"); // NOI18N + + textCenterEnergy.setName("scienta.centerEnergy"); // NOI18N + + textLowEnergy.setName("scienta.lowEnergy"); // NOI18N + + javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); + jPanel6.setLayout(jPanel6Layout); + jPanel6Layout.setHorizontalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel14) + .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(textLowEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textCenterEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textHighEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() + .addComponent(jLabel15) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textStepEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + + jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCenterEnergy, textHighEnergy, textLowEnergy, textStepEnergy}); + + jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel12, jLabel13, jLabel14, jLabel15}); + + jPanel6Layout.setVerticalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textLowEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textCenterEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel13)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textHighEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel14)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textStepEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("ThetaY ")); + + jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel17.setText("High:"); + + textStepThetaY.setName("scienta.thetaYStepSize"); // NOI18N + + jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel18.setText("Center:"); + + jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel19.setText("Low:"); + + jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel20.setText("Step:"); + + textHighThetaY.setName("scienta.highThetaY"); // NOI18N + + textCenterThetaY.setName("scienta.centerThetaY"); // NOI18N + + textLowThetaY.setName("scienta.lowThetaY"); // NOI18N + + javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); + jPanel7.setLayout(jPanel7Layout); + jPanel7Layout.setHorizontalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel17) + .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(textLowThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textCenterThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textHighThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup() + .addComponent(jLabel20) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textStepThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + + jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel17, jLabel18, jLabel19, jLabel20}); + + jPanel7Layout.setVerticalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textLowThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textCenterThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel18)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textHighThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel17)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textStepThetaY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel20)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("ThetaX")); + + jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel26.setText("Center:"); + + textCenterThetaX.setName("scienta.centerThetaX"); // NOI18N + + javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); + jPanel9.setLayout(jPanel9Layout); + jPanel9Layout.setHorizontalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel26) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textCenterThetaX, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel9Layout.setVerticalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addGap(38, 38, 38) + .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textCenterThetaX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel26)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel11.setText("Pass Energy:"); + + jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel6.setText("Acquisition:"); + + jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel5.setText("Energy Mode:"); + + comboPass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); + comboPass.setToolTipText(""); + comboPass.setName("scienta.passEnergyDev"); // NOI18N + + comboLens.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); + comboLens.setName("scienta.lensModeDev"); // NOI18N + + jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel7.setText("Lens Mode:"); + + comboAcquisition.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); + comboAcquisition.setName("scienta.acquisitionModeDev"); // NOI18N + + comboEnergy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); + comboEnergy.setName("scienta.energyModeDev"); // NOI18N + + javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); + jPanel10.setLayout(jPanel10Layout); + jPanel10Layout.setHorizontalGroup( + jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel10Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel10Layout.createSequentialGroup() + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jLabel6) + .addComponent(jLabel11)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(comboAcquisition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(comboEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel10Layout.createSequentialGroup() + .addComponent(jLabel7) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(comboLens, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + + jPanel10Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboAcquisition, comboEnergy, comboLens, comboPass}); + + jPanel10Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel11, jLabel5, jLabel6, jLabel7}); + + jPanel10Layout.setVerticalGroup( + jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel10Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(comboAcquisition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(comboEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(comboLens, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, Short.MAX_VALUE) + .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(20, 20, 20) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Analyzer", jPanel4); + + jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel16.setText("Mode:"); + + comboDetMode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); + comboDetMode.setToolTipText(""); + comboDetMode.setName("scienta.detectorModeDev"); // NOI18N + + jLabel9.setText("X Channel Range:"); + + jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel25.setText("Slices:"); + + textSlices.setName("scienta.slices"); // NOI18N + + textChannels.setName("scienta.channels"); // NOI18N + + jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel27.setText("Channels:"); + + textXChannelMin.setName("x_channel_min"); // NOI18N + + textXChannelMax.setName("x_channel_max"); // NOI18N + + jLabel10.setText("Y Channel Range:"); + + textYChannelMin.setName("y_channel_min"); // NOI18N + + textYChannelMax.setName("y_channel_max"); // NOI18N + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap(33, Short.MAX_VALUE) + .addComponent(jLabel16) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(comboDetMode, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel25) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textSlices, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel27) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textChannels, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel10) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textYChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textYChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel9) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textXChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textXChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(202, Short.MAX_VALUE)) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel16) + .addComponent(comboDetMode, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel9) + .addComponent(textXChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textXChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(textYChannelMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textYChannelMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textSlices, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel25)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(textChannels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel27)) + .addContainerGap(39, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Detector", jPanel5); + + jLabel4.setText("Settling Time:"); + + spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 1000.0d, 1.0d)); + + jLabel1.setText("Passes:"); + + spinnerPasses.setModel(new javax.swing.SpinnerNumberModel(1, 1, 1000, 1)); + + jLabel8.setText("Zigzag:"); + + javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); + jPanel11.setLayout(jPanel11Layout); + jPanel11Layout.setHorizontalGroup( + jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel11Layout.createSequentialGroup() + .addContainerGap(242, Short.MAX_VALUE) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel8) + .addComponent(jLabel4) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(checkZigzag) + .addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(268, Short.MAX_VALUE)) + ); + + jPanel11Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerLatency, spinnerPasses}); + + jPanel11Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel4, jLabel8}); + + jPanel11Layout.setVerticalGroup( + jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel11Layout.createSequentialGroup() + .addGap(20, 20, 20) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(checkZigzag) + .addComponent(jLabel8)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(77, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Scan", jPanel11); + + jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Inactive")); + + tableInactive.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Name" + } + ) { + Class[] types = new Class [] { + java.lang.String.class + }; + boolean[] canEdit = new boolean [] { + false + }; + + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; + } + }); + tableInactive.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); + jScrollPane1.setViewportView(tableInactive); + + jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("Fixed")); + + tableFixed.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Name", "Value", "Units" + } + ) { + Class[] types = new Class [] { + java.lang.String.class, java.lang.Double.class, java.lang.String.class + }; + boolean[] canEdit = new boolean [] { + false, true, false + }; + + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; + } + }); + tableFixed.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); + jScrollPane2.setViewportView(tableFixed); + + jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scanned")); + + tableScanned.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + + }, + new String [] { + "Name", "Start", "Stop", "Points", "Step", "Units" + } + ) { + Class[] types = new Class [] { + java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.Integer.class, java.lang.Double.class, java.lang.String.class + }; + boolean[] canEdit = new boolean [] { + false, true, true, true, false, false + }; + + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; + } + }); + tableScanned.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); + jScrollPane3.setViewportView(tableScanned); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addContainerGap()) + ); + + jTabbedPane1.addTab("Positioners", jPanel1); + + jScrollPane4.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors")); + + textSensors.setColumns(12); + textSensors.setRows(5); + textSensors.setName("sensors"); // NOI18N + jScrollPane4.setViewportView(textSensors); + + jScrollPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Snapshots")); + + textSnapshots.setColumns(12); + textSnapshots.setRows(5); + textSnapshots.setName("snapshots"); // NOI18N + jScrollPane5.setViewportView(textSnapshots); + + jScrollPane6.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagnostics")); + + textDiagnostics.setColumns(12); + textDiagnostics.setRows(5); + textDiagnostics.setName("diagnostics"); // NOI18N + jScrollPane6.setViewportView(textDiagnostics); + + jScrollPane7.setBorder(javax.swing.BorderFactory.createTitledBorder("Monitors")); + + textMonitors.setColumns(12); + textMonitors.setRows(5); + textMonitors.setName("monitors"); // NOI18N + jScrollPane7.setViewportView(textMonitors); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE) + .addGap(0, 0, 0)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE) + .addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane7)) + .addContainerGap()) + ); + + jTabbedPane1.addTab("Records", jPanel3); + + 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() + .addComponent(jTabbedPane1) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jTabbedPane1) + .addContainerGap()) + ); + + buttonAddToQueue.setText("Queue"); + buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonAddToQueueActionPerformed(evt); + } + }); + + jLabel3.setText("File:"); + + textFile.setDisabledTextColor(javax.swing.UIManager.getDefaults().getColor("TextField.foreground")); + textFile.setEnabled(false); + + buttonOpen.setText("Open"); + buttonOpen.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonOpenActionPerformed(evt); + } + }); + + buttonSave.setText("Save"); + buttonSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonSaveActionPerformed(evt); + } + }); + + buttonClear.setText("Clear"); + buttonClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonClearActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(buttonScienta) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonResetId)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(buttonStart) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonAbort) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textFile) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonOpen) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonSave) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonAddToQueue) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonClear)))) + ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonAddToQueue, buttonResetId, buttonStart}); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClear, buttonOpen, buttonSave}); + + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonOpen) + .addComponent(buttonSave) + .addComponent(jLabel3) + .addComponent(textFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(buttonClear) + .addComponent(buttonAddToQueue)) + .addGap(18, 18, 18) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonScienta) + .addComponent(buttonResetId) + .addComponent(jLabel2) + .addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonStart) + .addComponent(buttonAbort)) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void buttonScientaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScientaActionPerformed + try { + this.showDevicePanel("scienta"); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonScientaActionPerformed + + private void buttonResetIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResetIdActionPerformed + try { + this.getContext().setFileSequentialNumber(0); + updateControls(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonResetIdActionPerformed + + private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed + try { + execute(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonStartActionPerformed + + private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed + try { + abort(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonAbortActionPerformed + + private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed + try { + open(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonOpenActionPerformed + + private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed + try { + checkValues(); + JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getHomePath())); + FileNameExtensionFilter filter = new FileNameExtensionFilter(getDescription(), getExtensions()); + chooser.setFileFilter(filter); + try { + if (currentFile != null) { + chooser.setSelectedFile(currentFile); + } + } catch (Exception ex) { + this.showException(ex); + } + int rVal = chooser.showSaveDialog(this); + if (rVal == JFileChooser.APPROVE_OPTION) { + String fileName = chooser.getSelectedFile().getAbsolutePath(); + if (IO.getExtension(chooser.getSelectedFile().getAbsolutePath()).isEmpty()) { + fileName += "." + FILE_EXTENSION; + } + saveAs(fileName); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonSaveActionPerformed + + private void buttonAddToQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddToQueueActionPerformed + try { + QueueProcessor tq = null; + List queues = getView().getQueues(); + if (queues.size() == 0) { + tq = getView().openProcessor(QueueProcessor.class, null); + } else { + tq = queues.get(0); + } + getView().getDocumentsTab().setSelectedComponent(tq); + tq.addNewFile(currentFile.getPath()); + + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonAddToQueueActionPerformed + + private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed + try { + clear(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonClearActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonAbort; + private javax.swing.JButton buttonAddToQueue; + private javax.swing.JButton buttonClear; + private javax.swing.JButton buttonOpen; + private javax.swing.JButton buttonResetId; + private javax.swing.JButton buttonSave; + private javax.swing.JButton buttonScienta; + private javax.swing.JButton buttonStart; + private javax.swing.JCheckBox checkZigzag; + private javax.swing.JComboBox comboAcquisition; + private javax.swing.JComboBox comboDetMode; + private javax.swing.JComboBox comboEnergy; + private javax.swing.JComboBox comboLens; + private javax.swing.JComboBox comboPass; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel25; + private javax.swing.JLabel jLabel26; + private javax.swing.JLabel jLabel27; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel10; + private javax.swing.JPanel jPanel11; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JPanel jPanel7; + private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel9; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JScrollPane jScrollPane4; + private javax.swing.JScrollPane jScrollPane5; + private javax.swing.JScrollPane jScrollPane6; + private javax.swing.JScrollPane jScrollPane7; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JSpinner spinnerLatency; + private javax.swing.JSpinner spinnerPasses; + private javax.swing.JTable tableFixed; + private javax.swing.JTable tableInactive; + private javax.swing.JTable tableScanned; + private javax.swing.JTextField textCenterEnergy; + private javax.swing.JTextField textCenterThetaX; + private javax.swing.JTextField textCenterThetaY; + private javax.swing.JTextField textCenterThetaY1; + private javax.swing.JTextField textChannels; + private javax.swing.JTextArea textDiagnostics; + private javax.swing.JTextField textFile; + private javax.swing.JTextField textFileId; + private javax.swing.JTextField textHighEnergy; + private javax.swing.JTextField textHighThetaY; + private javax.swing.JTextField textHighThetaY1; + private javax.swing.JTextField textLowEnergy; + private javax.swing.JTextField textLowThetaY; + private javax.swing.JTextField textLowThetaY1; + private javax.swing.JTextArea textMonitors; + private javax.swing.JTextArea textSensors; + private javax.swing.JTextField textSlices; + private javax.swing.JTextArea textSnapshots; + private javax.swing.JTextField textStepEnergy; + private javax.swing.JTextField textStepThetaY; + private javax.swing.JTextField textStepThetaY1; + private javax.swing.JTextField textXChannelMax; + private javax.swing.JTextField textXChannelMin; + private javax.swing.JTextField textYChannelMax; + private javax.swing.JTextField textYChannelMin; + // End of variables declaration//GEN-END:variables +} + diff --git a/plugins/Test.form b/plugins/Test.form deleted file mode 100644 index a40be78..0000000 --- a/plugins/Test.form +++ /dev/null @@ -1,59 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/plugins/Test.java b/plugins/Test.java deleted file mode 100644 index 16a27db..0000000 --- a/plugins/Test.java +++ /dev/null @@ -1,106 +0,0 @@ -import ch.psi.pshell.core.Context; -import ch.psi.pshell.ui.Panel; -import ch.psi.utils.State; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.script.ScriptException; - -/** - * - */ -public class Test extends Panel { - - public Test() { - initComponents(); - } - - //Overridable callbacks - @Override - public void onInitialize(int runCount) { - - } - - @Override - public void onStateChange(State state, State former) { - buttonStart.setEnabled(state==State.Ready); - buttonAbort.setEnabled(state.isRunning()); - } - - @Override - public void onExecutedFile(String fileName, Object result) { - } - - - //Callback to perform update - in event thread - @Override - protected void doUpdate() { - } - - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - buttonStart = new javax.swing.JToggleButton(); - buttonAbort = new javax.swing.JToggleButton(); - - buttonStart.setText("Start"); - buttonStart.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonStartActionPerformed(evt); - } - }); - - buttonAbort.setText("Abort"); - buttonAbort.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonAbortActionPerformed(evt); - } - }); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(66, 66, 66) - .addComponent(buttonStart) - .addGap(39, 39, 39) - .addComponent(buttonAbort) - .addContainerGap(201, Short.MAX_VALUE)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(42, 42, 42) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(buttonStart) - .addComponent(buttonAbort)) - .addContainerGap(70, Short.MAX_VALUE)) - ); - }// //GEN-END:initComponents - - private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed - try { - this.runAsync("test/TestScan").handle((ret, ex)->{ - - return ret; - }); - } catch (Exception ex) { - this.showException(ex); - } - }//GEN-LAST:event_buttonStartActionPerformed - - private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed - try { - this.abort(); - } catch (Exception ex) { - this.showException(ex); - } - }//GEN-LAST:event_buttonAbortActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JToggleButton buttonAbort; - private javax.swing.JToggleButton buttonStart; - // End of variables declaration//GEN-END:variables -} diff --git a/script/templates/SIStem.py b/script/templates/SIStem.py new file mode 100644 index 0000000..92a1c2f --- /dev/null +++ b/script/templates/SIStem.py @@ -0,0 +1,82 @@ +#Debugging +if get_exec_pars().args is None: + print "OK" + PRE_ACTIONS = {z:0.1} + POSITIONERS = ["x", "y"] + START = [0.0,0.0] + STOP = [1.0,1.0] + STEPS = [3, 5] + SENSORS = [scienta.dataMatrix, current] + SETTLING_TIME = 0.1 + PASSES = 1 + ZIGZAG = True + COMPRESSION = True + DIAGS = [] + SNAPS = diag_channels + MONITORS = [] + NAME=None + + +import json +def load_parameters(name): + filename = get_context().setup.expandPath("{script}/scans/" + name + ".json") + with open(filename) as config_file: + config = json.load(config_file) + for key in config.keys(): + globals()[key] = config[key] + print str(key), " = ", config[key] +if NAME: + load_parameters(NAME) + + + +#Enforece parameter types +positioners = string_to_obj(POSITIONERS) +sensors = string_to_obj(SENSORS) +start = list(to_array(START, 'd')) +end = list(to_array(STOP, 'd')) +steps = list(to_array(STEPS, 'i')) +latency = SETTLING_TIME +passes = int(PASSES) +zigzag = bool(ZIGZAG) + + +#Execute pre-actions +for key in PRE_ACTIONS.keys(): + if key=="eval": + log("Eval " + str(PRE_ACTIONS[key])) + eval(str(PRE_ACTIONS[key])) + else: + dev = string_to_obj(key) + if isinstance(dev, Writable): + log("Setting " + dev.name + " to: " + str(PRE_ACTIONS[key])) + dev.write(PRE_ACTIONS[key]) +for key in PRE_ACTIONS.keys(): + dev = string_to_obj(key) + if isinstance(dev, Device): + log("Waiting " + dev.name) + dev.waitReady(-1) + + +#Run scan +if COMPRESSION: + set_exec_pars(compression=[scienta.dataMatrix]) + + +def before_read(pos, scan): + trigger_scienta() + + +def after_read(rec, scan): + #handle_diagnostics(rec) + pass + +try: + ret= ascan (positioners, sensors, start, end, steps, \ + latency= latency, relative=False, passes=passes, zigzag=zigzag, \ + before_read=before_read, after_read=after_read, \ + snaps=SNAPS, diags=DIAGS, monitors=MONITORS) +finally: + scienta.zeroSupplies() + +