From 1d75bc4535e84f308765e30d50ee013da7a2f557 Mon Sep 17 00:00:00 2001 From: gac-x11ma Date: Tue, 18 Jul 2023 11:00:54 +0200 Subject: [PATCH] --- config/AbsortionSpectrum/Cr_L23edge.abs | Bin 0 -> 307 bytes config/AbsortionSpectrum/Fe_L3_L2_sandy.abs | Bin 0 -> 411 bytes config/AbsortionSpectrum/Mn_L3_L2_Sandy.abs | Bin 0 -> 411 bytes config/AbsortionSpectrum/Rh_Sara.abs | Bin 0 -> 203 bytes config/AbsortionSpectrum/Ru_M23-edge.abs | Bin 0 -> 411 bytes .../membrane_ref_TiMnLaBa.abs | Bin 0 -> 307 bytes config/ROIs/AZI30.roi | Bin 0 -> 323 bytes config/ROIs/AZI60.roi | Bin 0 -> 323 bytes config/ROIs/test.roi | Bin 308 -> 313 bytes config/ROIs/test3.roi | Bin 0 -> 209 bytes config/config.properties | 58 +- config/devices.properties | 11 + config/plugins.properties | 2 + config/preferences.json | 5 +- config/scicat.properties | 8 +- config/session_metadata.properties | 6 +- config/sessions.properties | 4 +- config/settings.properties | 17 +- config/variables.properties | 8 +- devices/CameraServer.properties | 25 + devices/ai1.properties | 7 + devices/ai1pv.properties | 7 + devices/ci230606_001#001.tif.properties | 20 + devices/ci230606_001#002.tif.properties | 20 + devices/ci230606_001#003.tif.properties | 20 + devices/ci230606_003#001.tif.properties | 20 + devices/dp1.properties | 17 +- devices/et7026.properties | 8 + devices/et7244.properties | 8 + devices/i230511_098#014.tif.properties | 20 + devices/i230511_098#015.tif.properties | 20 + devices/i230511_098#016.tif.properties | 20 + devices/i230511_098#017.tif.properties | 20 + devices/i230606_001#001.tif.properties | 20 + devices/i230606_001#002.tif.properties | 20 + devices/i230606_001#003.tif.properties | 20 + devices/i230606_002#001.tif.properties | 20 + devices/i230606_002#002.tif.properties | 20 + devices/image.properties | 6 +- devices/m1.properties | 3 +- devices/m2.properties | 3 +- devices/p1.properties | 3 +- devices/rmu_ry.properties | 19 + devices/test.properties | 8 + plugins/Align_ComputeShifts.java | 8 +- plugins/Beamline.java | 66 ++- plugins/BeamlineInit.form | 91 +++ plugins/BeamlineInit.java | 199 +++++++ plugins/Cooling.form | 556 ++++++++++++++++++ plugins/Cooling.java | 555 +++++++++++++++++ plugins/DataAcquisition.form | 6 + plugins/DataAcquisition.java | 26 +- plugins/Eiger.form | 61 +- plugins/Eiger.java | 89 ++- plugins/Initialization.form | 1 - plugins/XPEEM_Settings.form | 43 +- plugins/XPEEM_Settings.java | 61 +- script/Users/PEEM/Armin/02_Eslit_offset_AK.py | 39 ++ .../Users/PEEM/Armin/Functions/SlitCalib.py | 67 +++ script/Users/PEEM/Armin/PEEM_slit.py | 23 + script/Users/PEEM/Armin/RMU_scan.py | 20 + .../Users/PEEM/Armin/TestUserScript_Armin.py | 17 +- script/Users/PEEM/Armin/Threshold_Scan.py | 26 + script/Users/PEEM/Armin/test.py | 2 + script/beamline_init/init/InitAU.py | 102 ++++ script/beamline_init/init/InitCMU.py | 2 +- script/beamline_init/init/InitExitSlit.py | 9 + .../with_x-rays/02_Eslit_offset.py | 11 +- .../with_x-rays/functions/SlitCalib.py | 2 +- script/devices/LEEM2000.py | 2 +- script/devices/diag.py | 1 + script/devices/eiger.py | 5 +- script/imaging/fov_arrows.py | 2 +- script/imaging/shifts.py | 5 +- script/local.py | 40 +- script/templates/Eiger2Img.py | 86 +-- script/test/Diagnostics.py | 1 + 77 files changed, 2464 insertions(+), 253 deletions(-) create mode 100644 config/AbsortionSpectrum/Cr_L23edge.abs create mode 100644 config/AbsortionSpectrum/Fe_L3_L2_sandy.abs create mode 100644 config/AbsortionSpectrum/Mn_L3_L2_Sandy.abs create mode 100644 config/AbsortionSpectrum/Rh_Sara.abs create mode 100644 config/AbsortionSpectrum/Ru_M23-edge.abs create mode 100644 config/AbsortionSpectrum/membrane_ref_TiMnLaBa.abs create mode 100644 config/ROIs/AZI30.roi create mode 100644 config/ROIs/AZI60.roi create mode 100644 config/ROIs/test3.roi create mode 100644 devices/CameraServer.properties create mode 100644 devices/ai1.properties create mode 100644 devices/ai1pv.properties create mode 100644 devices/ci230606_001#001.tif.properties create mode 100644 devices/ci230606_001#002.tif.properties create mode 100644 devices/ci230606_001#003.tif.properties create mode 100644 devices/ci230606_003#001.tif.properties mode change 100755 => 100644 devices/dp1.properties create mode 100644 devices/et7026.properties create mode 100644 devices/et7244.properties create mode 100644 devices/i230511_098#014.tif.properties create mode 100644 devices/i230511_098#015.tif.properties create mode 100644 devices/i230511_098#016.tif.properties create mode 100644 devices/i230511_098#017.tif.properties create mode 100644 devices/i230606_001#001.tif.properties create mode 100644 devices/i230606_001#002.tif.properties create mode 100644 devices/i230606_001#003.tif.properties create mode 100644 devices/i230606_002#001.tif.properties create mode 100644 devices/i230606_002#002.tif.properties mode change 100755 => 100644 devices/m1.properties mode change 100755 => 100644 devices/m2.properties mode change 100755 => 100644 devices/p1.properties create mode 100644 devices/rmu_ry.properties create mode 100644 devices/test.properties create mode 100644 plugins/BeamlineInit.form create mode 100644 plugins/BeamlineInit.java create mode 100644 plugins/Cooling.form create mode 100644 plugins/Cooling.java mode change 100755 => 100644 plugins/DataAcquisition.java create mode 100644 script/Users/PEEM/Armin/02_Eslit_offset_AK.py create mode 100644 script/Users/PEEM/Armin/Functions/SlitCalib.py create mode 100644 script/Users/PEEM/Armin/PEEM_slit.py create mode 100644 script/Users/PEEM/Armin/RMU_scan.py mode change 100755 => 100644 script/Users/PEEM/Armin/TestUserScript_Armin.py create mode 100644 script/Users/PEEM/Armin/Threshold_Scan.py create mode 100644 script/Users/PEEM/Armin/test.py create mode 100644 script/beamline_init/init/InitAU.py create mode 100644 script/beamline_init/init/InitExitSlit.py mode change 100755 => 100644 script/test/Diagnostics.py diff --git a/config/AbsortionSpectrum/Cr_L23edge.abs b/config/AbsortionSpectrum/Cr_L23edge.abs new file mode 100644 index 0000000000000000000000000000000000000000..57b9ccb2cc86db7dc525678b0d77b54c01e955be GIT binary patch literal 307 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9>V`=F&ojI-mvy2Ik@-1_6Y@F8QTNIjIes4|!>3|7KxgV02+%ElbQP zO|3vt=2x1Vlv>obW~warln32lQym&tfDJ4Lnat|Y_~Z-_oQ3f0FB^jalC4lx&ye*r ZEkNSgAI71lX;B&oK<#OIfvg8=4*=n+T224} literal 0 HcmV?d00001 diff --git a/config/AbsortionSpectrum/Fe_L3_L2_sandy.abs b/config/AbsortionSpectrum/Fe_L3_L2_sandy.abs new file mode 100644 index 0000000000000000000000000000000000000000..55b0fd25a75d90608d0ed19204055f86d257c23b GIT binary patch literal 411 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9>V`*3v?TI-mvy2Ik@-1_6Y@F8QTNIjIes4|!>3|7KxgV02+%ElbQP zO|3vt=2x1Vlv>obW~warln32lQyp4AfDJ4Lnat|Y#(~7MzibQ!NVdXModJTgFg*## wdUnnPfmxV(Qjk>q$R448TvQ0%#ZtOut(x6(iW>b7<+Bp%E^0Mf&DqW}N^ literal 0 HcmV?d00001 diff --git a/config/AbsortionSpectrum/Mn_L3_L2_Sandy.abs b/config/AbsortionSpectrum/Mn_L3_L2_Sandy.abs new file mode 100644 index 0000000000000000000000000000000000000000..652ceb541cc1c6b9a1d75950ee6aabce8107586b GIT binary patch literal 411 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9>V`*3v?TI-mvy2Ik@-1_6Y@F8QTNIjIes4|!>3|7KxgV02+%ElbQP zO|3vt=2x1Vlv>obW~warln32lQyrQgfDJ4Lnat|Y`~it)e*w&4K(ZB!Du)&WWIa1) mg1{^cJt(RiS^|*u;Iaorl|xGdvL2lFAggj{S%9nuY7YPv&}jSs literal 0 HcmV?d00001 diff --git a/config/AbsortionSpectrum/Rh_Sara.abs b/config/AbsortionSpectrum/Rh_Sara.abs new file mode 100644 index 0000000000000000000000000000000000000000..bccdd39e78b817d48b7d413985f26d586f9af5ca GIT binary patch literal 203 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9=wILWVk^1_lP^;vxnCguyQPrAaxd4Vw>nX=eXsVPar(VPGvw%qdN+ rKvCvbnwykb)V5}-EccWL-C$E4Am%X?gG^?1Xm9`<58>HgHU5_o3=E7wbt2JN z6iV#>9sDHw_9>V`*3v?TI-mvy2Ik@-1_6Y@F8QTNIjIes4|!>3|7KxgV02+%ElbQP zO|3vt=2x1Vlv>obW~warln32lQypp)zy=nBOlEbcIe^5ozX0YiAlZsVl|yXR%Ap>tg#qGHdtCOQsB)-xz+w*o?a*d^ literal 0 HcmV?d00001 diff --git a/config/AbsortionSpectrum/membrane_ref_TiMnLaBa.abs b/config/AbsortionSpectrum/membrane_ref_TiMnLaBa.abs new file mode 100644 index 0000000000000000000000000000000000000000..a85d233bcfa1ac34c485d00f5c83e36fd06e6524 GIT binary patch literal 307 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9>V`=F&ojI-mvy2Ik@-1_6Y@F8QTNIjIes4|!>3|7KxgV02+%ElbQP zO|3vt=2x1Vlv>obW~warln32lQypp)zy=nBOlEa}n9cy<+3%bQ0<(~8g{W%YfUKwG W0}>CXo_3H=8K5RRbT=UJV0r+3`&nWD literal 0 HcmV?d00001 diff --git a/config/ROIs/AZI30.roi b/config/ROIs/AZI30.roi new file mode 100644 index 0000000000000000000000000000000000000000..0f0c065aaa06fcf6cdff659091b6b47a7c65064a GIT binary patch literal 323 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9>V`=F&ojI-mvy2G$Y=mLPvm!{Q5_o3=E7wbt2JN z6iV#>9sDHw_9>V`=F&ojI-mvy2G$Y=mLPvm!{Q7)Xd~;zdb+Ml-nJMmS3Y&ay8BsRRMm5(bta Te@|nW6eBZ?#jp`<8khh81*sRc diff --git a/config/ROIs/test3.roi b/config/ROIs/test3.roi new file mode 100644 index 0000000000000000000000000000000000000000..01c8136a2b57af0c9c7c4b263396343aaa96932e GIT binary patch literal 209 zcmZ4UmVvdjh(S2oCo8cmQ75_o3=E7wbt2JN z6iV#>9sDHw_9=wILWVk^1_lP!5(btae^0~WA_hT(`JQ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/BeamlineInit.java b/plugins/BeamlineInit.java new file mode 100644 index 0000000..0178116 --- /dev/null +++ b/plugins/BeamlineInit.java @@ -0,0 +1,199 @@ + +import ch.psi.pshell.ui.Panel; +import ch.psi.utils.State; +import javax.swing.JButton; + +/** + * + */ +public class BeamlineInit extends Panel { + + public BeamlineInit() { + initComponents(); + } + + //Overridable callbacks + @Override + public void onInitialize(int runCount) { + + } + + @Override + public void onStateChange(State state, State former) { + + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + @Override + protected void onTimer() { + } + + @Override + protected void onLoaded() { + + } + + @Override + protected void onUnloaded() { + + } + + //Invoked by 'update()' to update components in the event thread + @Override + protected void doUpdate() { + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonAUinit = new javax.swing.JButton(); + buttonFEinit = new javax.swing.JButton(); + buttonExitSlitsInit = new javax.swing.JButton(); + buttonCMUinit = new javax.swing.JButton(); + statusAU = new javax.swing.JLabel(); + + buttonAUinit.setText("Init AU"); + buttonAUinit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonAUinitActionPerformed(evt); + } + }); + + buttonFEinit.setText("init FE"); + buttonFEinit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonFEinitActionPerformed(evt); + } + }); + + buttonExitSlitsInit.setText("init Exit Slits"); + buttonExitSlitsInit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonExitSlitsInitActionPerformed(evt); + } + }); + + buttonCMUinit.setText("init CMU"); + buttonCMUinit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonCMUinitActionPerformed(evt); + } + }); + + statusAU.setText("status AU"); + + 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(83, 83, 83) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonAUinit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonFEinit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonExitSlitsInit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonCMUinit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addComponent(statusAU) + .addContainerGap(184, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(24, 24, 24) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonAUinit) + .addComponent(statusAU)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonFEinit) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonExitSlitsInit) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonCMUinit) + .addContainerGap(271, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void buttonAUinitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAUinitActionPerformed + statusAU.setText("Running"); + try { + runAsync("beamline_init/init/InitAU").handle((ret, ex) -> { + if (ex != null) { + statusAU.setText(ex.getMessage()); + showException((Exception) ex); + } else { + statusAU.setText((ret==null)? "" : ret.toString()); + } + return ret; + }); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonAUinitActionPerformed + + private void buttonFEinitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFEinitActionPerformed + try { + boolean background = false; + + runAsync("beamline_init/init/InitFE", background).handle((ret, ex) -> { + ((JButton) evt.getSource()).setEnabled(true); + if (ex != null) { + showException((Exception) ex); + } + return ret; + }); + + ((JButton) evt.getSource()).setEnabled(false); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonFEinitActionPerformed + + private void buttonExitSlitsInitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExitSlitsInitActionPerformed + try { + boolean background = false; + + runAsync("beamline_init/init/InitExitSlit", background).handle((ret, ex) -> { + ((JButton) evt.getSource()).setEnabled(true); + if (ex != null) { + showException((Exception) ex); + } + return ret; + }); + + ((JButton) evt.getSource()).setEnabled(false); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonExitSlitsInitActionPerformed + + private void buttonCMUinitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCMUinitActionPerformed + try { + boolean background = false; + + runAsync("beamline_init/init/InitCMU", background).handle((ret, ex) -> { + ((JButton) evt.getSource()).setEnabled(true); + if (ex != null) { + showException((Exception) ex); + } + return ret; + }); + + ((JButton) evt.getSource()).setEnabled(false); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonCMUinitActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonAUinit; + private javax.swing.JButton buttonCMUinit; + private javax.swing.JButton buttonExitSlitsInit; + private javax.swing.JButton buttonFEinit; + private javax.swing.JLabel statusAU; + // End of variables declaration//GEN-END:variables +} diff --git a/plugins/Cooling.form b/plugins/Cooling.form new file mode 100644 index 0000000..df4a590 --- /dev/null +++ b/plugins/Cooling.form @@ -0,0 +1,556 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Cooling.java b/plugins/Cooling.java new file mode 100644 index 0000000..01f537a --- /dev/null +++ b/plugins/Cooling.java @@ -0,0 +1,555 @@ + +import ch.psi.pshell.epics.GenericChannel; +import ch.psi.pshell.swing.DevicePanel; +import ch.psi.pshell.swing.RegisterPanel; +import ch.psi.pshell.ui.Panel; +import ch.psi.pshell.ui.StripChart; +import ch.psi.utils.State; +import java.io.File; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + */ +public class Cooling extends Panel { + + public Cooling() { + initComponents(); + } + + //Overridable callbacks + @Override + public void onInitialize(int runCount) { + DevicePanel[] panels = new DevicePanel[]{panelNeedleValveSet,panelNeedleValveGet,panelHeFlowSet,panelHeFlowGet, + panelSBResist,panelSBTemp,panelSBVolt,panelSBCurr,panelSBResistance,panelGude1,panelGude2,panelGude3,panelGude4}; + for (DevicePanel p : panels){ + + GenericChannel channel = new GenericChannel(p.getName(), p.getName()); + if (p instanceof RegisterPanel){ + channel.setPrecision(((RegisterPanel)p).getDecimals()); + } + channel.setMonitored(true); + try { + channel.initialize(); + p.setDevice(channel); + } catch (Exception ex) { + Logger.getLogger(Cooling.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + panelPlot.removeAll(); + panelPlot.add(StripChart.getPlotPanel(new File("/sls/X11MA/data/X11MA/strip/PEEM-Pt100.scd"))); + + } + + @Override + public void onStateChange(State state, State former) { + + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + @Override + protected void onTimer() { + } + + @Override + protected void onLoaded() { + + } + + @Override + protected void onUnloaded() { + + } + + //Invoked by 'update()' to update components in the event thread + @Override + protected void doUpdate() { + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + panelNeedleValveGet = new ch.psi.pshell.swing.DeviceValuePanel(); + panelNeedleValveSet = new ch.psi.pshell.swing.RegisterPanel(); + label1 = new java.awt.Label(); + label2 = new java.awt.Label(); + panelHeFlowSet = new ch.psi.pshell.swing.RegisterPanel(); + panelHeFlowGet = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel1 = new javax.swing.JLabel(); + panelFilamentSet = new ch.psi.pshell.swing.RegisterPanel(); + jPanel1 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + panelSBResist = new ch.psi.pshell.swing.DeviceValuePanel(); + panelSBTemp = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel3 = new javax.swing.JLabel(); + panelSBVolt = new ch.psi.pshell.swing.DeviceValuePanel(); + panelSBCurr = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel4 = new javax.swing.JLabel(); + panelSBResistance = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + panelPlot = new javax.swing.JPanel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jPanel2 = new javax.swing.JPanel(); + panelGude1 = new ch.psi.pshell.swing.DeviceValuePanel(); + panelGude2 = new ch.psi.pshell.swing.DeviceValuePanel(); + panelGude3 = new ch.psi.pshell.swing.DeviceValuePanel(); + panelGude4 = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel17 = new javax.swing.JLabel(); + jLabel18 = new javax.swing.JLabel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + checkGude1 = new javax.swing.JCheckBox(); + checkGude2 = new javax.swing.JCheckBox(); + checkGude3 = new javax.swing.JCheckBox(); + checkGude4 = new javax.swing.JCheckBox(); + + panelNeedleValveGet.setName("X11MA-ES1-AO4:V"); // NOI18N + + panelNeedleValveSet.setDecimals(3); + panelNeedleValveSet.setName("X11MA-ES1-AO4:V"); // NOI18N + + label1.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N + label1.setText("Needle Valve"); + + label2.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N + label2.setText("He Flow Meter"); + + panelHeFlowSet.setDecimals(3); + panelHeFlowSet.setName("X11MA-PC-BRONKHORST:PEEM-SET-SETPOINT"); // NOI18N + + panelHeFlowGet.setName("X11MA-PC-BRONKHORST:PEEM-GET-MEASURE"); // NOI18N + + jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); // NOI18N + jLabel1.setText("LEEM Filament"); + + panelFilamentSet.setDecimals(3); + panelFilamentSet.setDeviceName("fil"); + panelFilamentSet.setName(""); // NOI18N + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Switchbox")); + jPanel1.setName(""); // NOI18N + + jLabel2.setText("Pt100"); + + panelSBResist.setName("X11MA-PC-SW:Pt100-R"); // NOI18N + + panelSBTemp.setName("X11MA-PC-SW:Pt100-K"); // NOI18N + + jLabel3.setText("E-Field"); + + panelSBVolt.setName("X11MA-PC-SW:E-Field-V"); // NOI18N + + panelSBCurr.setName("X11MA-PC-SW:E-Field-I"); // NOI18N + + jLabel4.setText("Resistance"); + jLabel4.setToolTipText("Resistance"); + + panelSBResistance.setName("X11MA-PC-SW:Resistance"); // NOI18N + + jLabel12.setText("Ohm"); + + jLabel13.setText("K"); + + jLabel14.setText("V"); + + jLabel15.setText("K"); + + jLabel16.setText("Ohm"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(panelSBVolt, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE) + .addComponent(panelSBResist, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel12) + .addComponent(jLabel14)) + .addGap(18, 18, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(panelSBTemp, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel13)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(panelSBCurr, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel15))))) + .addContainerGap(15, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(panelSBResistance, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel16) + .addGap(0, 0, Short.MAX_VALUE)))) + ); + + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {panelSBResistance, panelSBVolt}); + + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelSBResist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelSBTemp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(2, 2, 2))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel3) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(panelSBVolt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(16, 16, 16) + .addComponent(jLabel14)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(15, 15, 15) + .addComponent(jLabel15)))) + .addComponent(panelSBCurr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(panelSBResistance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + panelPlot.setBorder(javax.swing.BorderFactory.createTitledBorder("PEEM Pt100")); + panelPlot.setLayout(new java.awt.BorderLayout()); + + jLabel5.setText("V"); + + jLabel6.setText("V"); + + jLabel7.setText("%"); + + jLabel8.setText("%"); + + jLabel11.setText("mA"); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Power Sockets")); + + panelGude1.setName("PEEM-GUDE:CH1READ"); // NOI18N + + panelGude2.setName("PEEM-GUDE:CH2READ"); // NOI18N + + panelGude3.setName("PEEM-GUDE:CH3READ"); // NOI18N + + panelGude4.setName("PEEM-GUDE:CH4READ"); // NOI18N + + jLabel17.setText("Helium Pump"); + + jLabel18.setText("Detector"); + + jLabel19.setText("He level meter"); + + jLabel20.setText("Heater"); + + checkGude1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkGude1ActionPerformed(evt); + } + }); + + checkGude2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkGude2ActionPerformed(evt); + } + }); + + checkGude3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkGude3ActionPerformed(evt); + } + }); + + checkGude4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkGude4ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addGap(11, 11, 11) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel19) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(checkGude3)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel20) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(checkGude4)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel17) + .addComponent(jLabel18)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(checkGude2) + .addComponent(checkGude1)))) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(panelGude3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelGude1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelGude2, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(panelGude4, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(15, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap(12, Short.MAX_VALUE) + .addComponent(panelGude1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(checkGude1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelGude2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(checkGude2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelGude3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(checkGude3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(12, 12, 12) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(panelGude4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(checkGude4, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()))) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(panelNeedleValveSet, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(panelNeedleValveGet, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6)) + .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(panelHeFlowSet, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(panelHeFlowGet, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(panelFilamentSet, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(76, 76, 76))) + .addGap(4, 4, 4) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(33, 33, 33) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(25, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(1, 1, 1) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(panelNeedleValveGet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelNeedleValveSet, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(19, 19, 19)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6) + .addGap(30, 30, 30))) + .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(1, 1, 1) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelHeFlowSet, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelHeFlowGet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelFilamentSet, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(47, 47, 47)) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(32, 32, 32) + .addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE) + .addContainerGap()) + ); + + jPanel1.getAccessibleContext().setAccessibleName(""); + }// //GEN-END:initComponents + + private void checkGude1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkGude1ActionPerformed + try { + if (checkGude1.isSelected()){ + evalAsync("gude1('On')"); + } else { + evalAsync("gude1('Off')"); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_checkGude1ActionPerformed + + private void checkGude2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkGude2ActionPerformed + try { + if (checkGude2.isSelected()){ + evalAsync("gude2('On')"); + } else { + evalAsync("gude2('Off')"); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_checkGude2ActionPerformed + + private void checkGude3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkGude3ActionPerformed + try { + if (checkGude3.isSelected()){ + evalAsync("gude3('On')"); + } else { + evalAsync("gude3('Off')"); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_checkGude3ActionPerformed + + private void checkGude4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkGude4ActionPerformed + try { + if (checkGude4.isSelected()){ + evalAsync("gude4('On')"); + } else { + evalAsync("gude4('Off')"); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_checkGude4ActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox checkGude1; + private javax.swing.JCheckBox checkGude2; + private javax.swing.JCheckBox checkGude3; + private javax.swing.JCheckBox checkGude4; + private javax.swing.JLabel jLabel1; + 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 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.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private java.awt.Label label1; + private java.awt.Label label2; + private ch.psi.pshell.swing.RegisterPanel panelFilamentSet; + private ch.psi.pshell.swing.DeviceValuePanel panelGude1; + private ch.psi.pshell.swing.DeviceValuePanel panelGude2; + private ch.psi.pshell.swing.DeviceValuePanel panelGude3; + private ch.psi.pshell.swing.DeviceValuePanel panelGude4; + private ch.psi.pshell.swing.DeviceValuePanel panelHeFlowGet; + private ch.psi.pshell.swing.RegisterPanel panelHeFlowSet; + private ch.psi.pshell.swing.DeviceValuePanel panelNeedleValveGet; + private ch.psi.pshell.swing.RegisterPanel panelNeedleValveSet; + private javax.swing.JPanel panelPlot; + private ch.psi.pshell.swing.DeviceValuePanel panelSBCurr; + private ch.psi.pshell.swing.DeviceValuePanel panelSBResist; + private ch.psi.pshell.swing.DeviceValuePanel panelSBResistance; + private ch.psi.pshell.swing.DeviceValuePanel panelSBTemp; + private ch.psi.pshell.swing.DeviceValuePanel panelSBVolt; + // End of variables declaration//GEN-END:variables +} diff --git a/plugins/DataAcquisition.form b/plugins/DataAcquisition.form index 8638854..6517f17 100755 --- a/plugins/DataAcquisition.form +++ b/plugins/DataAcquisition.form @@ -712,6 +712,9 @@ + + + @@ -1066,6 +1069,9 @@ + + + diff --git a/plugins/DataAcquisition.java b/plugins/DataAcquisition.java old mode 100755 new mode 100644 index 13eb145..29edbc4 --- a/plugins/DataAcquisition.java +++ b/plugins/DataAcquisition.java @@ -10,7 +10,7 @@ import ch.psi.pshell.ui.Panel; import ch.psi.utils.Arr; import ch.psi.utils.IO; import ch.psi.utils.Serializer; -import ch.psi.utils.State; +import ch.psi.utils.State; import ch.psi.utils.Str; import ch.psi.utils.swing.SwingUtils; import java.awt.Color; @@ -204,7 +204,11 @@ public class DataAcquisition extends Panel { Rect imagingRoiOverlay; Rectangle getImagingRoi(){ - return (Rectangle) getGlobalVar("IMAGING_ROI"); + try{ + return (Rectangle) getGlobalVar("IMAGING_ROI"); + } catch (Exception ex){ + return null; + } } //Callback to perform update - in event thread @@ -959,6 +963,11 @@ public class DataAcquisition extends Panel { checkImgAutosave.setSelected(true); checkImgAutosave.setText("Autosave"); + checkImgAutosave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkImgAutosaveActionPerformed(evt); + } + }); jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel20.setText("Measurements:"); @@ -1177,6 +1186,11 @@ public class DataAcquisition extends Panel { checkSpecWithI0.setSelected(true); checkSpecWithI0.setText("With I0"); + checkSpecWithI0.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkSpecWithI0ActionPerformed(evt); + } + }); checkSpecSaveSpectrum.setSelected(true); checkSpecSaveSpectrum.setText("Save spectrum"); @@ -1815,6 +1829,14 @@ public class DataAcquisition extends Panel { } }//GEN-LAST:event_buttonImgOTFAbortActionPerformed + private void checkImgAutosaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkImgAutosaveActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_checkImgAutosaveActionPerformed + + private void checkSpecWithI0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkSpecWithI0ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_checkSpecWithI0ActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAdd; private javax.swing.JButton buttonClear; diff --git a/plugins/Eiger.form b/plugins/Eiger.form index 59bd2bc..4f6d041 100755 --- a/plugins/Eiger.form +++ b/plugins/Eiger.form @@ -45,18 +45,32 @@ - - - + + - + + + + + + + + + + + + + + + + + + - - @@ -85,7 +99,7 @@ - + @@ -121,9 +135,14 @@ - - - + + + + + + + + @@ -354,5 +373,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Eiger.java b/plugins/Eiger.java index 4fa270c..227c89c 100755 --- a/plugins/Eiger.java +++ b/plugins/Eiger.java @@ -16,6 +16,7 @@ public class Eiger extends Panel { ChannelInteger bitDepth; ChannelInteger mode; ChannelDouble exposure; + ChannelDouble threshold; public Eiger() { initComponents(); @@ -33,6 +34,7 @@ public class Eiger extends Panel { bitDepth = ((ChannelInteger)getDevice("eiger_bit_depth")); mode = ((ChannelInteger) getDevice("eiger_mode")); exposure = ((ChannelDouble) getDevice("eiger_exposure")); + threshold = ((ChannelDouble) getDevice("eiger_threshold")); startTimer(1000,10); } catch (Exception ex) { showException(ex); @@ -70,10 +72,15 @@ public class Eiger extends Panel { try{ spinnerExposure.setValue(exposure.take()); } catch (Exception ex){ - } + } + try{ + spinnerThreshold.setValue(threshold.take()); + } catch (Exception ex){ + } comboDepth.setEnabled(bitDepth.isInitialized()); comboMode.setEnabled(mode.isInitialized()); - spinnerExposure.setEnabled(exposure.isInitialized()); + spinnerExposure.setEnabled(exposure.isInitialized()); + spinnerThreshold.setEnabled(threshold.isInitialized()); } finally{ updatingControls=false; @@ -131,6 +138,9 @@ public class Eiger extends Panel { jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); textFOV = new javax.swing.JTextField(); + jLabel8 = new javax.swing.JLabel(); + spinnerThreshold = new javax.swing.JSpinner(); + deviceValuePanel5 = new ch.psi.pshell.swing.DeviceValuePanel(); renderer.setDeviceName("image"); renderer.setMode(ch.psi.pshell.imaging.RendererMode.Stretch); @@ -249,6 +259,23 @@ public class Eiger extends Panel { textFOV.setDisabledTextColor(new java.awt.Color(0, 0, 0)); textFOV.setEnabled(false); + jLabel8.setText("Threshold [eV]:"); + + spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(0.0d, null, null, 1.0d)); + spinnerThreshold.setEnabled(false); + spinnerThreshold.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spinnerThresholdStateChanged(evt); + } + }); + spinnerThreshold.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + spinnerThresholdPropertyChange(evt); + } + }); + + deviceValuePanel5.setDeviceName("eiger_threshold_rbv"); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -278,16 +305,26 @@ public class Eiger extends Panel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(textFOV, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) + .addGroup(layout.createSequentialGroup() + .addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel8) + .addGap(10, 10, 10))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() @@ -307,7 +344,7 @@ public class Eiger extends Panel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addGap(39, 39, 39)))) + .addGap(166, 166, 166)))) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure, textFOV}); @@ -338,9 +375,13 @@ public class Eiger extends Panel { .addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(deviceValuePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8) + .addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(36, 36, 36) @@ -527,6 +568,27 @@ public class Eiger extends Panel { }//GEN-LAST:event_spinnerMinStateChanged + private void spinnerThresholdStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerThresholdStateChanged + try{ + if (!updatingControls){ + ch.psi.pshell.device.Camera eiger = (ch.psi.pshell.device.Camera) getDevice("eiger"); + if (eiger.isStarted()){ + buttonDoneActionPerformed(null); + eiger.waitState(State.Ready, 10000); //Timeout of 10s + } + //((ch.psi.pshell.device.Camera) getDevice("eiger")).stop(); + //TimeUnit.SECONDS.sleep(1); + threshold.write((Double)spinnerThreshold.getValue()); + } + } catch (Exception ex){ + showException(ex); + } + }//GEN-LAST:event_spinnerThresholdStateChanged + + private void spinnerThresholdPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_spinnerThresholdPropertyChange + // TODO add your handling code here: + }//GEN-LAST:event_spinnerThresholdPropertyChange + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAquire; private javax.swing.JButton buttonCloseVG10; @@ -541,6 +603,7 @@ public class Eiger extends Panel { private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel3; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel4; + private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; @@ -548,10 +611,12 @@ public class Eiger extends Panel { private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; private ch.psi.pshell.imaging.Renderer renderer; private javax.swing.JSpinner spinnerExposure; private javax.swing.JSpinner spinnerMax; private javax.swing.JSpinner spinnerMin; + private javax.swing.JSpinner spinnerThreshold; private javax.swing.JTextField textFOV; // End of variables declaration//GEN-END:variables } diff --git a/plugins/Initialization.form b/plugins/Initialization.form index 3dfafc2..68c98b1 100644 --- a/plugins/Initialization.form +++ b/plugins/Initialization.form @@ -11,7 +11,6 @@ - diff --git a/plugins/XPEEM_Settings.form b/plugins/XPEEM_Settings.form index ae559b5..1987d8d 100644 --- a/plugins/XPEEM_Settings.form +++ b/plugins/XPEEM_Settings.form @@ -17,7 +17,14 @@ - + + + + + + + + @@ -52,7 +59,7 @@ - + @@ -61,7 +68,8 @@ - + + @@ -71,13 +79,22 @@ - + + + + - + + + + - + + + + @@ -160,17 +177,17 @@ - + - + - + @@ -181,5 +198,13 @@ + + + + + + + + diff --git a/plugins/XPEEM_Settings.java b/plugins/XPEEM_Settings.java index 8e9238b..df03110 100644 --- a/plugins/XPEEM_Settings.java +++ b/plugins/XPEEM_Settings.java @@ -70,6 +70,10 @@ public class XPEEM_Settings extends Panel { label6 = new java.awt.Label(); label7 = new java.awt.Label(); buttonRunSelected = new javax.swing.JButton(); + checkSetting1 = new javax.swing.JCheckBox(); + checkSetting2 = new javax.swing.JCheckBox(); + checkSetting3 = new javax.swing.JCheckBox(); + checkSetting4 = new javax.swing.JCheckBox(); ButtonDefaultXrays.setText("X-rays (Standard)"); ButtonDefaultXrays.addActionListener(new java.awt.event.ActionListener() { @@ -108,11 +112,11 @@ public class XPEEM_Settings extends Panel { label4.setText("Obj. = 1475.0 mA, Stig. A,B = 0.0, Obj. Align. x,y = 0.0, Start voltage = 0.0,"); - label5.setText(" FOV = 100 um, CA = open, Slit = open."); + label5.setText(" FOV = 100 um"); - label6.setText(" FOV = 100 um, CA = open, Slit = open."); + label6.setText(" FOV = 100 um"); - label7.setText("x,y = 0.0, tilt = 0.0"); + label7.setText("x,y = 0.0, tilt = 0.0, CA = open, Slit = open, Close VG10."); buttonRunSelected.setText("Run Selected"); buttonRunSelected.addActionListener(new java.awt.event.ActionListener() { @@ -126,7 +130,13 @@ public class XPEEM_Settings extends Panel { layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGap(79, 79, 79) + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(checkSetting2) + .addComponent(checkSetting3) + .addComponent(checkSetting4) + .addComponent(checkSetting1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(ButtonDefaultOptics10kV) @@ -152,7 +162,7 @@ public class XPEEM_Settings extends Panel { .addComponent(ButtonNeutralizePosition, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(68, Short.MAX_VALUE)) + .addContainerGap(117, Short.MAX_VALUE)) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {ButtonDefaultOptics10kV, ButtonDefaultOptics15kV, ButtonDefaultXrays, ButtonNeutralizePosition}); @@ -162,6 +172,7 @@ public class XPEEM_Settings extends Panel { .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(checkSetting1) .addComponent(ButtonDefaultOptics15kV) .addGroup(layout.createSequentialGroup() .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -170,13 +181,19 @@ public class XPEEM_Settings extends Panel { .addGap(39, 39, 39) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(ButtonDefaultOptics10kV) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ButtonDefaultOptics10kV) + .addComponent(checkSetting2)) .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() - .addComponent(ButtonDefaultXrays) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ButtonDefaultXrays) + .addComponent(checkSetting3)) .addGap(42, 42, 42) - .addComponent(ButtonNeutralizePosition)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ButtonNeutralizePosition) + .addComponent(checkSetting4))) .addGroup(layout.createSequentialGroup() .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -252,32 +269,32 @@ public class XPEEM_Settings extends Panel { getContext().startExecution(CommandSource.plugin, null, null,null, false); new Thread(()->{ try{ - if (true){ + if (checkSetting1.isSelected()==true){ this.eval("peem_optics_default_15kV()", true); } - if (true){ + if (checkSetting2.isSelected()==true){ this.eval("peem_optics_default_10kV()", true); - } - if (true){ + } + if (checkSetting3.isSelected()==true){ this.eval("xrays_default()", true); - } - if (true){ + } + if (checkSetting4.isSelected()==true){ this.eval("neutralize_position()", true); - } - + } + } catch (Exception ex){ - getLogger().log(Level.WARNING, null, ex); - } finally{ + getLogger().log(Level.WARNING, null, ex); + } finally{ try { getContext().endExecution(); } catch (Context.ContextStateException ex) { getLogger().log(Level.SEVERE, null, ex); } } - }).start(); + }).start(); } catch (Exception ex) { showException(ex); - } + } }//GEN-LAST:event_buttonRunSelectedActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables @@ -286,6 +303,10 @@ public class XPEEM_Settings extends Panel { private javax.swing.JButton ButtonDefaultXrays; private javax.swing.JButton ButtonNeutralizePosition; private javax.swing.JButton buttonRunSelected; + private javax.swing.JCheckBox checkSetting1; + private javax.swing.JCheckBox checkSetting2; + private javax.swing.JCheckBox checkSetting3; + private javax.swing.JCheckBox checkSetting4; private java.awt.Label label1; private java.awt.Label label2; private java.awt.Label label3; diff --git a/script/Users/PEEM/Armin/02_Eslit_offset_AK.py b/script/Users/PEEM/Armin/02_Eslit_offset_AK.py new file mode 100644 index 0000000..48ff311 --- /dev/null +++ b/script/Users/PEEM/Armin/02_Eslit_offset_AK.py @@ -0,0 +1,39 @@ +import sys + +from mathutils import fit_polynomial +from mathutils import PolynomialFunction + + +#seting parameters +sensor = 'KEI11' +if sensor == 'KEI10': + detector= keithley_1a + detector_range='X11MA-KEI10:RANGE' +elif sensor == 'KEI11': + detector= keithley_2a + detector_range='X11MA-KEI11:RANGE' +else: + print "Select a proper detector: KEI10 or KEI11." + sys.exit() + +caput(detector_range, 4) # 6 --> 200 nA +exit_slit.move(30.0) +speed = exit_slit.getSpeed() +min_speed=exit_slit.getMinSpeed() +exit_slit.setSpeed(min_speed) + +#scan Energy Slit +time.sleep(1) +#run('Users/PEEM/Armin/Functions/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":detector, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0}) +#cscan([girder_x], ['ca://machine_cur'], [0.16], [0.18], [0.01], latency=1.0, time=10.0, relative=False, passes=1, zigzag=False, keep=False, name='Unknown') +result=lscan([exit_slit], [detector], [30.0], [-20.0], [1.0], latency=1.0) + + + + + +time.sleep(1) + +#resetting parameters +caput(detector_range, 0) # 0--> AUTO +exit_slit.setSpeed(speed) diff --git a/script/Users/PEEM/Armin/Functions/SlitCalib.py b/script/Users/PEEM/Armin/Functions/SlitCalib.py new file mode 100644 index 0000000..087bb43 --- /dev/null +++ b/script/Users/PEEM/Armin/Functions/SlitCalib.py @@ -0,0 +1,67 @@ +################################################################################################### +# Function fitting and peak search with mathutils.py +################################################################################################### + +from mathutils import fit_polynomial +from mathutils import PolynomialFunction + +# Input parameters (example) +#Slit = exit_slit +#Slit_offset = exit_slit_offset +#detector = keithley_1a +#start = 30.0 +#end = -20.0 +#step_size = 1.0 +#final_pos = 20.0 +#run('beamline_init/with_x-rays/functions/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":detector, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0}) + +# Execute the scan +result=lscan(Slit, detector, start, end, float(step_size)) + +readable_ = result[detector] +positions_ = result[Slit] +print positions_ +readable=[] +positions=[] + +# execute the fit +fit_threshold=readable_[0]*0.05 + +#filter the positions with analog values above the threshold +for i in range(8,len(positions_),1): + if(readable_[i] +# microscope.send_receive("mmp 7 -9044.7", 60000) +# microscope.send_receive("mmp 2 -5998.6", 60000) +# microscope.send_receive("mmp 1 0.0", 60000) +# slitttt.read() +# slitttt.write(pos[0]) + +# read ROI intensity, see FocusScan.py +# scan_contrast +# if roi is None: +# sensor = image_contrast +# else: +# sensor = roi_contrast +# roi_contrast.set_roi(roi) +# +# see test_autofocus +#r=lscan (objective, image.contrast, RANGE[0], RANGE[1], STEP_SIZE, latency=(SETTLING_TIME + eiger.getExposure())) +#(norm, mn, std )= fit (r["image_contrast"], r["objective"]) +#if (mnRANGE[1]): +# raise Exception("Invalid fit") +#objective.write(mn) + diff --git a/script/Users/PEEM/Armin/RMU_scan.py b/script/Users/PEEM/Armin/RMU_scan.py new file mode 100644 index 0000000..703fbf3 --- /dev/null +++ b/script/Users/PEEM/Armin/RMU_scan.py @@ -0,0 +1,20 @@ +#for i in [-1.9, -2.0, -2.1]: +## girder_x.move(i, -1) +## rmu_ry.move(-4.477, -1) +# print "Do something" +# time.sleep(1.0) +# +#for x in range(0, 15): +# y = -3.5 + float(x)*0.5 +# z = -5.2211 + y*0.4865 +# #print("Girder x %f" % (y)) +# print("RMU Ry %f" % (z)) +# #str(1.23) +for x in range(30, 70): + y = -3.5 + float(x)*0.05 + z = -5.222 + y*0.4638 + print("Girder x %f" % (y)) + #girder_x.move(y, -1) + print("RMU Ry %f" % (z)) + #rmu_ry.move(z, -1) + time.sleep(3.0) \ No newline at end of file diff --git a/script/Users/PEEM/Armin/TestUserScript_Armin.py b/script/Users/PEEM/Armin/TestUserScript_Armin.py old mode 100755 new mode 100644 index 50742dc..5567a45 --- a/script/Users/PEEM/Armin/TestUserScript_Armin.py +++ b/script/Users/PEEM/Armin/TestUserScript_Armin.py @@ -14,17 +14,18 @@ two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposu time.sleep(2.0) #TwoEnergies with lin hor polarization ID2 only (normal) -set_beamline_setup(id ="ID2", en=710, pol2="Lin_Hor") +#set_beamline_setup(id ="ID2", en=710, pol2="Lin_Hor") -> causes problems? two_energies(705, 710, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE) time.sleep(2.0) #abs_spec(ranges=[[500.0, 1000.0, 100.0],], switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE) #Use manulally defined ranges and rois defined in GUI abs_spec(ranges="Fe_L3_fine", roi="test", switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE) +#eiger.stop() +#eiger_threshold.write(7500) +#eiger.start() - - - +#tscan(['ca://X11MA-PC-ET7000:SW-K'], points=10, interval=1.0, title='temperature', keep=False, name='tewsst', layout='table', provider='txt', auto_range=True, domain_axis='Time') #Direct functions to change energy, pol, offset: #change_energy(700) @@ -36,4 +37,10 @@ abs_spec(ranges="Fe_L3_fine", roi="test", switch_pol=False, scans=1, exposure=EX #switch_pol() #Restoring beamline state defined in last set_beamline_setut: -#restore_beamline_setup() \ No newline at end of file +#restore_beamline_setup() +# +#for i in [-1.9, -2.0, -2.1]: +# girder_x.move(i, -1) +# rmu_ry.move(-4.477, -1) +# print "Do something" +# caput("X11MA-HG:X_SET", 1.9) \ No newline at end of file diff --git a/script/Users/PEEM/Armin/Threshold_Scan.py b/script/Users/PEEM/Armin/Threshold_Scan.py new file mode 100644 index 0000000..8788757 --- /dev/null +++ b/script/Users/PEEM/Armin/Threshold_Scan.py @@ -0,0 +1,26 @@ +##Constants +AVERAGE = 1 +EXPOSURE = 1.0 +MEASUREMENTS = 5 +DRIFT_CORRECTION = True + +eiger.stop() +eiger_threshold.write(4000.0) +time.sleep(2.0) +#eiger.start() + +##TakeImage at 710 eV at the given polarization +#change_energy(712) +take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE) +time.sleep(2.0) +# + +eiger.stop() +eiger_threshold.write(4100.0) +time.sleep(2.0) +#eiger.start() + +##TakeImage at 710 eV at the given polarization +#change_energy(712) +take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE) +time.sleep(2.0) \ No newline at end of file diff --git a/script/Users/PEEM/Armin/test.py b/script/Users/PEEM/Armin/test.py new file mode 100644 index 0000000..5d88966 --- /dev/null +++ b/script/Users/PEEM/Armin/test.py @@ -0,0 +1,2 @@ +#cscan([girder_x], ['ca://machine_cur'], [0.16], [0.18], [0.01], latency=1.0, time=10.0, relative=False, passes=1, zigzag=False, keep=False, name='Unknown') +cscan(girder_x, machine_cur, 0.16, 0.18, 0.01) \ No newline at end of file diff --git a/script/beamline_init/init/InitAU.py b/script/beamline_init/init/InitAU.py new file mode 100644 index 0000000..f71f9c3 --- /dev/null +++ b/script/beamline_init/init/InitAU.py @@ -0,0 +1,102 @@ +import subprocess +import time +import traceback + +running = False +counts = {} + +def countHLS(motor): + global counts + try: + time.sleep(1.0) + counts[motor]=0 + def on_change(value): + global counts + print "LimitSW changed on" , motor, "to", value + if int(value) == 1: + counts[motor]=counts[motor]+1 + + with Channel(motor+".HLS", callback=on_change, monitored=True, name="test") as ch: + if int(ch.read()) == 1: + counts[motor]=1 + while(running==True): + time.sleep(0.1) + print "High Limit Switch motor "+motor +" reached "+ str(counts[motor]) + " times\n" + return counts[motor] + except: + print "Exception counting "+str(motor) + traceback.print_exc() + raise + + +def countLLS(motor): + global counts + try: + time.sleep(1.0) + counts[motor]=0 + def on_change(value): + global counts + print "LimitSW changed on" , motor, "to", value + if int(value) == 1: + counts[motor]=counts[motor]+1 + + with Channel(motor+".LLS", callback=on_change, monitored=True, name="test") as ch: + if int(ch.read()) == 1: + counts[motor]=1 + while(running==True): + time.sleep(0.1) + print "Low Limit Switch motor "+motor +" reached "+ str(counts[motor]) + " times\n" + return counts[motor] + except: + print "Exception counting "+str(motor) + traceback.print_exc() + raise + +def init(): + try: + global running + running = True + + subprocess.call("X_X11MA_init-AU.sh", shell=True) + # Positions at limit switches are not checked + time.sleep(1.0) + caput('X11MA-OP2-AVsize',20) + caput('X11MA-OP2-AHsize',20) + + running = False + return 0 + except: + print "Exception in init" + traceback.print_exc() + raise + + +#Fork and join +try: + futures = fork(init,(countHLS,("X11MA-OP2-AU:TRY1",)), \ + (countLLS,("X11MA-OP2-AU:TRY4",)), \ + (countHLS,("X11MA-OP2-AU:TRZ1",)), \ + (countLLS,("X11MA-OP2-AU:TRZ4",)), \ + (countHLS,("X11MA-OP2-BP1:TRY",)), \ + (countHLS,("X11MA-OP2-BP1:TRZ",)) ) + ret = join(futures) + +#check limit switch status after init + limitsw=True + for i in range(1,6): + if(ret[i]!=1): + limitsw=False + print "Limit switch status for all motors: %s" %("OK" if limitsw == True else "Not OK") + +#final status report + if(limitsw==True): + print "init-AU: ==> done. OK!" + set_return("OK") + else: + print "init-AU: ==> not done. NOT OK!" + set_return("Not OK") + +except: + set_return("Error") + + diff --git a/script/beamline_init/init/InitCMU.py b/script/beamline_init/init/InitCMU.py index e51bcd9..9c9ec04 100644 --- a/script/beamline_init/init/InitCMU.py +++ b/script/beamline_init/init/InitCMU.py @@ -21,7 +21,7 @@ def countHS(motor): counts[motor]=1 while(running==True): time.sleep(0.1) - print "Home Switch motor "+motor +" reached "+ str(counts[motor]) + " times" + print "Home Switch motor "+motor +" reached "+ str(counts[motor]) + " times\n" return counts[motor] except: print "Exception counting "+str(motor) diff --git a/script/beamline_init/init/InitExitSlit.py b/script/beamline_init/init/InitExitSlit.py new file mode 100644 index 0000000..1cefcac --- /dev/null +++ b/script/beamline_init/init/InitExitSlit.py @@ -0,0 +1,9 @@ +run("xrays_default") + +time.sleep(3) + +caput("X11MA-OP-SL:GO.PROC",1) +time.sleep(30) +exit_slit.write(20.0) + +print "Init Exit Slit OK." \ No newline at end of file diff --git a/script/beamline_init/with_x-rays/02_Eslit_offset.py b/script/beamline_init/with_x-rays/02_Eslit_offset.py index 7ab92d6..c929569 100644 --- a/script/beamline_init/with_x-rays/02_Eslit_offset.py +++ b/script/beamline_init/with_x-rays/02_Eslit_offset.py @@ -1,27 +1,28 @@ import sys #seting parameters -sensor = KEI11 -if sensor == KEI10: +sensor = 'KEI11' +if sensor == 'KEI10': detector= keithley_1a detector_range='X11MA-KEI10:RANGE' -elif sensor == KEI11: +elif sensor == 'KEI11': detector= keithley_2a detector_range='X11MA-KEI11:RANGE' else: print "Select a proper detector: KEI10 or KEI11." sys.exit() -caput(detector_range, 5) # 6 --> 200 nA +caput(detector_range, 4) # 6 --> 200 nA exit_slit.move(30.0) speed = exit_slit.getSpeed() min_speed=exit_slit.getMinSpeed() exit_slit.setSpeed(min_speed) #scan Energy Slit +time.sleep(1) run('beamline_init/with_x-rays/functions/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":detector, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0}) time.sleep(1) #resetting parameters caput(detector_range, 0) # 0--> AUTO -exit_slit.setSpeed(speed) \ No newline at end of file +exit_slit.setSpeed(speed) diff --git a/script/beamline_init/with_x-rays/functions/SlitCalib.py b/script/beamline_init/with_x-rays/functions/SlitCalib.py index 3d5950f..48f5eb6 100644 --- a/script/beamline_init/with_x-rays/functions/SlitCalib.py +++ b/script/beamline_init/with_x-rays/functions/SlitCalib.py @@ -28,7 +28,7 @@ fit_threshold=readable_[0]*0.05 #filter the positions with analog values above the threshold for i in range(8,len(positions_),1): - if(readable_[i]>fit_threshold): + if(readable_[i] Error shifting image: " + str(sys.exc_info()[1]) return + metadata["roi"] = str(roi) save_as_tiff(shifted_frame, filename, check, show, parallel=False, metadata=metadata) def shift_and_save_as_tiff(data, filename, reference=None, roi=None, shift=None, check=False, show = False, parallel=True, metadata={}): @@ -426,10 +427,12 @@ class ProcImage(Filter): self.outliers_mask =None def processData(self, data): + if data is None: + return None outliers_threshold = get_outliers_threshold() if (self.outliers_threshold is None) else self.outliers_threshold outliers_mask = get_outliers_mask() if (self.outliers_mask is None) else self.outliers_mask roi = self.roi - data=data.copy() + data=data.copy() if roi is not None: data = data.getRoi(Rectangle(roi[0], roi[1], roi[2], roi[3])) #ret = load_image(img) diff --git a/script/imaging/fov_arrows.py b/script/imaging/fov_arrows.py index 075be86..4ba2af7 100644 --- a/script/imaging/fov_arrows.py +++ b/script/imaging/fov_arrows.py @@ -53,7 +53,7 @@ def update_arrows(): arrow_a.update(FOV_ARROWS_ORIGIN, Point(xa,ya)) xa,ya=int(x+FOV_XRAY_LABEL_POS*math.cos(a)), int(y-FOV_XRAY_LABEL_POS*math.sin(a)) label_a.update(Point(xa,ya)) - angle=angle+azimuth + angle=angle-azimuth a=math.radians(angle) xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a)) arrow_x.update(FOV_ARROWS_ORIGIN, Point(xa,ya)) diff --git a/script/imaging/shifts.py b/script/imaging/shifts.py index 492a63e..c854281 100644 --- a/script/imaging/shifts.py +++ b/script/imaging/shifts.py @@ -3,7 +3,9 @@ import java.lang.reflect import flanagan.complex.ComplexMatrix as ComplexMatrix import flanagan.math.Matrix as Matrix import flanagan.complex.Complex as Complex -import org.jtransforms.fft.DoubleFFT_2D as DoubleFFT_2D +#import org.jtransforms.fft.DoubleFFT_2D as DoubleFFT_2D +import edu.emory.mathcs.jtransforms.fft.DoubleFFT_2D + import math from startup import ScriptUtils import ij.plugin.filter.PlugInFilterRunner as PlugInFilterRunner @@ -613,6 +615,7 @@ def calculate_shifts(imp_r, imp_i, roi, upscale_factor=100, reference_slide=1, j IJ.showProgress(i + 1, len(ffts))\ return shifts # [ref, drifted, dr, dc, error, diffphase] +#Transforms an array in memory, a BufferedImage, or a file name into a ImagePlus object. def to_ip(obj): if is_string(obj): try: diff --git a/script/local.py b/script/local.py index 093369e..40ca6c8 100644 --- a/script/local.py +++ b/script/local.py @@ -147,6 +147,15 @@ def is_id_error(): def check_id_error(): if is_id_error(): raise Exception ("ID error: check ID status") + +def gude1(pwr): + caput("PEEM-GUDE:CH1SET",pwr) +def gude2(pwr): + caput("PEEM-GUDE:CH2SET",pwr) +def gude3(pwr): + caput("PEEM-GUDE:CH3SET",pwr) +def gude4(pwr): + caput("PEEM-GUDE:CH4SET",pwr) ################################################################################################### #Default scan callbacks @@ -468,13 +477,13 @@ def assert_beamline_ok(): checkbeamline=0 message=[ "PLC error","Encoder error", "Feedforward error","Operator control", "Moving timeout", "Interlock"] ID = get_setting("ID") - if ID == "PGM_ID1": + if ID in ("PGM_ID1", "ID1"): id1_status=get_id_status(1) id2_status=0 - elif ID == "PGM_ID2": + elif ID in ("PGM_ID2", "ID2"): id1_status=0 id2_status=get_id_status(2) - if ID == "PGM_ID1_ID2": + else: # if ID in ("PGM_ID1_ID2", "ID1_ID2") : id1_status=get_id_status(1) id2_status=get_id_status(2) if id1_status >= 1: @@ -759,12 +768,15 @@ def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2 # Monochromator part if grat is not None: if grat=='G1_300': + print "Grat G1" Grating.write("0") Grating_ch.write("0") elif grat=='G2_1200': + print "Grat G2" Grating.write("1") Grating_ch.write("1") elif grat =='G3_600': + print "Grat G3" Grating.write("2") Grating_ch.write("2") if order is not None: @@ -840,9 +852,6 @@ def peem_optics_default_15kV(): start_voltage.write(0) # fov.write(100) microscope.send_receive("sep 100um") - microscope.send_receive("mmp 7 -9044.7", 60000) - microscope.send_receive("mmp 2 -5998.6", 60000) - microscope.send_receive("mmp 1 0.0", 60000) def peem_optics_default_10kV(): objective.write(1220) @@ -852,9 +861,6 @@ def peem_optics_default_10kV(): obj_align_y.write(0) start_voltage.write(0) microscope.send_receive("sep 100um") - microscope.send_receive("mmp 7 -9044.7", 60000) - microscope.send_receive("mmp 2 -5998.6", 60000) - microscope.send_receive("mmp 1 0.0", 60000) @@ -878,7 +884,11 @@ def neutralize_position(retries = 3): log("neutralize_position error - retrying: " + sys.exc_info()[1]) time.sleep(1) microscope.home_tilt('H') - microscope.home_tilt('V') + microscope.home_tilt('V') + microscope.send_receive("mmp 7 -9044.7", 60000) + microscope.send_receive("mmp 2 -5998.6", 60000) + microscope.send_receive("mmp 1 0.0", 60000) + close_vg10() ################################################################################################### #Maths ################################################################################################### @@ -983,3 +993,13 @@ def auto_intensity(roi=None, exposure=None): return scan_intensity(roi) finally: restore_eiger() + +################################################################################################### +# System utilities +################################################################################################### + +def memory(): + import java.lang.Runtime as Runtime + r=Runtime.getRuntime() + print "Used: ", r.totalMemory() + print "Max : ", r.maxMemory() \ No newline at end of file diff --git a/script/templates/Eiger2Img.py b/script/templates/Eiger2Img.py index 3eff0ab..2c2b33e 100644 --- a/script/templates/Eiger2Img.py +++ b/script/templates/Eiger2Img.py @@ -34,14 +34,8 @@ start = time.time() threads = [] image_drift=None calculated_shifts={} -#path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD -#set_exec_pars(path= path, format="txt", layout="table", open=True) -#data_path = get_context().setup.expandPath(path) data_path = "{data}/{year}_{month}/{date}/{date}_{name}" set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True) -#data_path = get_exec_pars().path - -#get_context().incrementFileSequentialNumber() def get_image_file_name(cycle=-1, frame_index=0, short_name=False, shifted=False): @@ -49,10 +43,8 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False, shifted=False if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped frame_index = 0 if frame_index else 1 root = "" if short_name else (data_path + "/") - #prefix = get_context().setup.expandPath("i{seq}%03d" + "_" + ("%d" % frame_index)) abs_index=run_index + frame_index max_index= max(max_index, frame_index) - #prefix = get_context().setup.expandPath("i{date}%02d_{seq}%03d") prefix = get_context().setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,))) if cycle < 0: @@ -87,8 +79,9 @@ if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")): def imageinfo(info): pass -ref_images = {} +ref_image = None def save_image_file(frame, cycle=-1, frame_index=0, processed_shift=False): + global ref_image if frame is None: raise Exception("Cannot save frame - None: cycle: " + str(cycle) + " index: " + str(frame_index)) if SHOW_IMAGES: @@ -119,27 +112,18 @@ def save_image_file(frame, cycle=-1, frame_index=0, processed_shift=False): filename = get_image_file_name(cycle, frame_index, shifted=True) #print " *** ", cycle, frame_index if cycle>0: - if cycle==1: - ref_images[frame_index] = frame + if ref_image is None: + if (cycle!=1) or (frame_index!=0): + raise Exception ("Invalid reference image: cycle=" + str(cycle) + " index="+ str (frame_index)) + ref_image = frame threads.append(save_as_tiff(frame, filename, metadata=metadata)) else: - """ - if image_drift is not None: - print "-> Shifting ", filename - #shifted_frame = apply_shift(frame, image_drift) - #threads.append(save_as_tiff(shifted_frame, filename, metadata=metadata)) - threads.append(shift_and_save_as_tiff(frame, shift=image_drift, metadata=metadata)) - """ if frame_index==2: - #shift = calculated_shifts[get_image_file_name(cycle, 0, shifted=True)] - #threads.append(shift_and_save_as_tiff(frame, filename, shift=shift, metadata=metadata)) + #Done later pass else: - threads.append(shift_and_save_as_tiff(frame, filename, ref_images[0], calc_roi, metadata=metadata)) - - - # log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0")) - + threads.append(shift_and_save_as_tiff(frame, filename, ref_image, calc_roi, metadata=metadata)) + init_eiger(exposure=EXPOSURE) run_index = get_context().getDaySequentialNumber() @@ -169,29 +153,8 @@ try: if METHOD == "Two_Energies": change_energy(ENERGY[i]) print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i) - #s=time.time() av = average_eiger_frames(AVERAGE, roi=None, wait_next=True) - #print "--- Time: " + str(time.time() - s) - #time.sleep(1) #added by Armin frames.append(av) - """ - if (i==0) and DRIFT_CORRECTION and (calc_roi is not None): - if ref_image is None: - ref_image = frames[0] - print "-> Saved shift ref image" - else: - try: - cur_image = frames[0] - xoff, yoff, error, diffphase, image_drift = calculate_shift(ref_image,cur_image, calc_roi) - if (abs(xoff) <= MAX_SHIFT) and (abs(yoff) <= MAX_SHIFT): - print "-> Calculated shift: ", xoff, yoff, error, diffphase - else: - print "-> Error: shift too big:", xoff, yoff - image_drift = None - except: - print "-> Error calculating shift: " + str(sys.exc_info()[1]) - image_drift = None - """ imageinfo("I") save_image_file(frames[i], cycle, i) if METHOD == "Take_Image": @@ -200,7 +163,6 @@ try: if METHOD == "Two_Pol": if (i==0) or (SEQUENCE == "B"): switch_pol() - #time.sleep(1) if (METHOD == "Two_Pol") or (METHOD == "Two_Energies"): if (METHOD == "Two_Energies") or (SEQUENCE == "B") or ((cycle%2)==1): @@ -241,16 +203,6 @@ try: print "--- Averaging..." for i in range(len(frames)): - """ - measures = [] - for cycle in range(1, MEASUREMENTS + 1): - filename = get_image_file_name(cycle, i) - ip = open_image(filename) - #measures.append(Data(get_ip_array(ip))) - measures.append(ip) - #av = average_frames(measures) #Result is transposed??? - av=average_ips (measures, roi=None, as_float=True) - """ integration = None for cycle in range(1, MEASUREMENTS + 1): filename = get_image_file_name(cycle, i) @@ -284,25 +236,7 @@ try: if SWITCH_POL and (METHOD == "Take_Image"): switch_pol() - - #SWITCH_POL = False - #set_exec_pars(then_success="run('templates/Eiger2Img')") - - """ - get_context().incrementDaySequentialNumber() - set_exec_pars(open=False) - set_exec_pars(open=True) - - for cycle in range(1, MEASUREMENTS + 1): - frames = [] - if MEASUREMENTS > 1: - log("nround = " + str(cycle) + " / " + str(MEASUREMENTS)) - print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i) - av = average_eiger_frames(AVERAGE, roi=None, wait_next=True) - imageinfo("I") - save_image_file(av, cycle, i) - - """ + #TODO: This is a workaround to handle 2-Images, should be removed run_index = run_index + 1 if scan>0: diff --git a/script/test/Diagnostics.py b/script/test/Diagnostics.py old mode 100755 new mode 100644 index 86a3a46..3deea16 --- a/script/test/Diagnostics.py +++ b/script/test/Diagnostics.py @@ -60,6 +60,7 @@ diag_devices = { "id2 alpha": id2_alpha, \ "id2 harmonic": id2_harmonic, \ "ring current": machine_cur, \ + "ai1 current": ai1, \ }