diff --git a/config/config.properties b/config/config.properties
index afc1a4e..2a65167 100644
--- a/config/config.properties
+++ b/config/config.properties
@@ -1,4 +1,4 @@
-#Fri Jan 24 14:13:08 CET 2020
+#Tue Feb 04 16:59:16 CET 2020
imageSourcesFile={config}/imaging.properties
autoSaveScanData=true
simulation=false
@@ -32,7 +32,7 @@ terminalEnabled=false
notificationLevel=null
terminalPort=3579
tasksFile={config}/tasks.properties
-createSessionFiles=true
+createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
versionTrackingRemote=git@git.psi.ch\:pshell_config/x11ma.git
dataProvider=txt
diff --git a/config/settings.properties b/config/settings.properties
index 3536904..31e3038 100644
--- a/config/settings.properties
+++ b/config/settings.properties
@@ -1,2 +1,12 @@
-#Tue Feb 04 11:56:24 CET 2020
-ID=ID1_ID2
+#Wed Feb 05 13:59:28 CET 2020
+HARMONIC_ID_1=1
+ALPHA_ID_2=0.0
+ENERGY=800.0
+ALPHA_ID_1=0.0
+POL_ID_2=Lin_Hor
+POL_ID_1=Lin_Hor
+OFFSET_ID_1=0.0
+NORM_FILE=/sls/X11MA/data/X11MA/Data1/public/PEEM/2020_02/20200205/Take_Image_350/0/i350_1_0.tif
+ID=ID2
+OFFSET_ID_2=0.0
+HARMONIC_ID_2=1
diff --git a/config/variables.properties b/config/variables.properties
index 11427d9..2856071 100644
--- a/config/variables.properties
+++ b/config/variables.properties
@@ -1,2 +1,2 @@
-#Tue Feb 04 11:59:35 CET 2020
-FileSequentialNumber=346
+#Wed Feb 05 14:20:03 CET 2020
+FileSequentialNumber=381
diff --git a/devices/i344_1_0.tif.properties b/devices/i344_1_0.tif.properties
new file mode 100644
index 0000000..acedee8
--- /dev/null
+++ b/devices/i344_1_0.tif.properties
@@ -0,0 +1,20 @@
+#Wed Feb 05 08:20:09 CET 2020
+spatialCalOffsetY=NaN
+invert=false
+spatialCalOffsetX=NaN
+rotation=0.0
+rotationCrop=false
+scale=1.0
+rescaleFactor=1.0
+grayscale=false
+spatialCalUnits=mm
+flipVertically=false
+roiHeight=-1
+spatialCalScaleX=NaN
+spatialCalScaleY=NaN
+flipHorizontally=false
+roiY=0
+roiX=0
+rescaleOffset=0.0
+transpose=false
+roiWidth=-1
diff --git a/devices/i364_0.tif.properties b/devices/i364_0.tif.properties
new file mode 100644
index 0000000..8088dae
--- /dev/null
+++ b/devices/i364_0.tif.properties
@@ -0,0 +1,20 @@
+#Wed Feb 05 13:16:33 CET 2020
+spatialCalOffsetY=NaN
+invert=false
+spatialCalOffsetX=NaN
+rotation=0.0
+rotationCrop=false
+scale=1.0
+rescaleFactor=1.0
+grayscale=false
+spatialCalUnits=mm
+flipVertically=false
+roiHeight=-1
+spatialCalScaleX=NaN
+spatialCalScaleY=NaN
+flipHorizontally=false
+roiY=0
+roiX=0
+rescaleOffset=0.0
+transpose=false
+roiWidth=-1
diff --git a/devices/image.properties b/devices/image.properties
index a7789b0..c28fa78 100644
--- a/devices/image.properties
+++ b/devices/image.properties
@@ -1,4 +1,4 @@
-#Mon Feb 03 16:50:13 CET 2020
+#Wed Feb 05 10:26:08 CET 2020
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
@@ -6,10 +6,10 @@ scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
-colormapMax=100.0
+colormapMax=1000.0
rescaleOffset=0.0
roiWidth=-1
-colormap=Grayscale
+colormap=Flame
invert=false
colormapMin=0.0
rotationCrop=false
diff --git a/devices/norm.properties b/devices/norm.properties
new file mode 100644
index 0000000..4b6cf5f
--- /dev/null
+++ b/devices/norm.properties
@@ -0,0 +1,25 @@
+#Wed Feb 05 13:41:09 CET 2020
+spatialCalOffsetY=NaN
+spatialCalOffsetX=NaN
+colormapLogarithmic=false
+scale=1.0
+grayscale=false
+spatialCalScaleX=NaN
+spatialCalScaleY=NaN
+colormapMax=2.0
+rescaleOffset=0.0
+roiWidth=-1
+colormap=Grayscale
+invert=false
+colormapMin=0.0
+rotationCrop=false
+rotation=0.0
+rescaleFactor=1.0
+spatialCalUnits=null
+flipVertically=false
+roiHeight=-1
+flipHorizontally=false
+colormapAutomatic=true
+roiY=0
+roiX=0
+transpose=false
diff --git a/plugins/Eiger.form b/plugins/Eiger.form
index b1b31c1..c467da8 100644
--- a/plugins/Eiger.form
+++ b/plugins/Eiger.form
@@ -50,6 +50,7 @@
+
@@ -60,6 +61,8 @@
+
+
@@ -220,21 +223,34 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
@@ -251,6 +267,11 @@
+
+
+
+
+
@@ -263,6 +284,7 @@
+
@@ -531,6 +553,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -549,38 +658,46 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
-
+
@@ -650,6 +767,14 @@
+
+
+
+
+
+
+
+
@@ -685,7 +810,7 @@
-
+
@@ -1178,9 +1303,9 @@
-
+
-
+
diff --git a/plugins/Eiger.java b/plugins/Eiger.java
index 2edd9d2..ea8b948 100644
--- a/plugins/Eiger.java
+++ b/plugins/Eiger.java
@@ -5,25 +5,36 @@ import ch.psi.pshell.imaging.Overlays.Rect;
import ch.psi.pshell.imaging.Pen;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.RendererListener;
+import ch.psi.pshell.swing.DevicePanel;
+import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
+import static ch.psi.pshell.ui.StripChart.FILE_EXTENSION;
import ch.psi.utils.Arr;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
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.JButton;
import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
+import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel ;
/**
@@ -39,8 +50,7 @@ public class Eiger extends Panel {
public enum Switching {
Normal,
- Tune_Detune,
- Chopper
+ Tune_Detune
}
public enum Polarization {
@@ -128,6 +138,36 @@ public class Eiger extends Panel {
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
+
+ try {
+ textNorm.setText(String.valueOf(getSetting("NORM_FILE")));
+ removeNorm();
+
+ String id = getSetting("ID");
+ Double en = Double.valueOf(getSetting("ENERGY"));
+ String pol1 = getSetting("POL_ID_1");
+ Double alp1 = Double.valueOf(getSetting("ALPHA_ID_1"));
+ String har1 = getSetting("HARMONIC_ID_1");
+ Double off1 = Double.valueOf(getSetting("OFFSET_ID_1"));
+ String pol2 = getSetting("POL_ID_2");
+ Double alp2 = Double.valueOf(getSetting("ALPHA_ID_2"));
+ String har2 = getSetting("HARMONIC_ID_2");
+ Double off2 = Double.valueOf(getSetting("OFFSET_ID_2"));
+ comboID.setSelectedItem(id);
+ spinnerImgEng.setValue(en);
+ comboPol1.setSelectedItem(pol1);
+ spinnerAlp1.setValue(alp1);
+ spinnerHar1.setValue(har1);
+ spinnerOff1.setValue(off1);
+ comboPol2.setSelectedItem(pol2);
+ spinnerAlp2.setValue(alp2);
+ spinnerHar2.setValue(har2);
+ spinnerOff2.setValue(off2);
+
+
+ } catch (IOException ex) {
+ showException(ex);
+ }
}
@Override
@@ -232,6 +272,7 @@ public class Eiger extends Panel {
void setBeamlineArgs(HashMap args) {
args.put("ID", comboID.getSelectedItem());
+ args.put("ENERGY", spinnerImgEng.getValue());
args.put("POL_ID_1", comboPol1.getSelectedItem());
args.put("ALPHA_ID_1", spinnerAlp1.getValue());
args.put("HARMONIC_ID_1", spinnerHar1.getValue());
@@ -316,6 +357,47 @@ public class Eiger extends Panel {
});
}
+ void removeNorm(){
+ try{
+ JDialog dlg = App.getInstance().getDevicePanelManager().getPanelDialog("norm");
+ if (dlg!=null){
+ dlg.dispose();
+ }
+ removeDevice(this.getDevice("norm"), true);
+ if (buttonShowNorm.isSelected()){
+ buttonShowNorm.setSelected(false);
+ buttonShowNorm.setText("Show");
+ }
+ } catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
+
+ void enableNorm(boolean enabled) throws Context.ContextStateException {
+ if (!enabled){
+ removeNorm();
+ } else {
+ runAsync("devices/norm", null).handle((ret, t) -> {
+ if ((t != null) && (!getContext().isAborted())) {
+ showException((Exception) t);
+ }
+ JDialog dlg = App.getInstance().getDevicePanelManager().getPanelDialog("norm");
+ if (dlg!=null){
+ dlg.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ dlg.removeWindowListener(this);
+ removeNorm();
+ }
+ });
+ }
+
+ return t;
+ });
+ }
+ }
+
+
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
@@ -355,6 +437,13 @@ public class Eiger extends Panel {
jLabel16 = new javax.swing.JLabel();
spinnerOff2 = new javax.swing.JSpinner();
buttonApply = new javax.swing.JButton();
+ jLabel27 = new javax.swing.JLabel();
+ spinnerImgEng = new javax.swing.JSpinner();
+ panelNorm = new javax.swing.JPanel();
+ buttonSetNorm = new javax.swing.JButton();
+ textNorm = new javax.swing.JTextField();
+ jLabel29 = new javax.swing.JLabel();
+ buttonShowNorm = new javax.swing.JToggleButton();
panelRoi = new javax.swing.JPanel();
rendererRoi = new ch.psi.pshell.imaging.Renderer();
jLabel26 = new javax.swing.JLabel();
@@ -363,6 +452,7 @@ public class Eiger extends Panel {
jScrollPane1 = new javax.swing.JScrollPane();
tableRoi = new javax.swing.JTable();
buttonTriggerDetector = new javax.swing.JButton();
+ buttonShowDetectorPanel = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
buttonImgStart = new javax.swing.JButton();
buttonImgAbort = new javax.swing.JButton();
@@ -529,6 +619,7 @@ public class Eiger extends Panel {
panelBeamline.setBorder(javax.swing.BorderFactory.createTitledBorder("Beamline"));
+ jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("ID:");
comboID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
@@ -664,25 +755,43 @@ public class Eiger extends Panel {
}
});
+ jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel27.setText("Energy");
+
+ spinnerImgEng.setModel(new javax.swing.SpinnerNumberModel(1000.0d, 90.0d, 2520.0d, 1.0d));
+
javax.swing.GroupLayout panelBeamlineLayout = new javax.swing.GroupLayout(panelBeamline);
panelBeamline.setLayout(panelBeamlineLayout);
panelBeamlineLayout.setHorizontalGroup(
panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelBeamlineLayout.createSequentialGroup()
.addContainerGap()
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelBeamlineLayout.createSequentialGroup()
+ .addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelBeamlineLayout.createSequentialGroup()
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(panelBeamlineLayout.createSequentialGroup()
+ .addComponent(jLabel27)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerImgEng, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(panelBeamlineLayout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
- .addGroup(panelBeamlineLayout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
+
+ panelBeamlineLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel27, jLabel3});
+
+ panelBeamlineLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboID, spinnerImgEng});
+
panelBeamlineLayout.setVerticalGroup(
panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamlineLayout.createSequentialGroup()
@@ -694,12 +803,72 @@ public class Eiger extends Panel {
.addGap(30, 30, 30)
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel3))))
+ .addComponent(jLabel3))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel27)
+ .addComponent(spinnerImgEng, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonApply)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
+ panelNorm.setBorder(javax.swing.BorderFactory.createTitledBorder("Normalization"));
+
+ buttonSetNorm.setText("Select");
+ buttonSetNorm.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonSetNormActionPerformed(evt);
+ }
+ });
+
+ textNorm.setEditable(false);
+ textNorm.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyTyped(java.awt.event.KeyEvent evt) {
+ textNormKeyTyped(evt);
+ }
+ public void keyReleased(java.awt.event.KeyEvent evt) {
+ textNormKeyReleased(evt);
+ }
+ });
+
+ jLabel29.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel29.setText("File: ");
+
+ buttonShowNorm.setText("Show");
+ buttonShowNorm.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonShowNormActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout panelNormLayout = new javax.swing.GroupLayout(panelNorm);
+ panelNorm.setLayout(panelNormLayout);
+ panelNormLayout.setHorizontalGroup(
+ panelNormLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelNormLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(buttonShowNorm)
+ .addGap(18, 18, 18)
+ .addComponent(jLabel29)
+ .addGap(0, 0, 0)
+ .addComponent(textNorm)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonSetNorm)
+ .addContainerGap())
+ );
+ panelNormLayout.setVerticalGroup(
+ panelNormLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelNormLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(panelNormLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel29)
+ .addComponent(textNorm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonSetNorm)
+ .addComponent(buttonShowNorm))
+ .addContainerGap())
+ );
+
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -708,7 +877,8 @@ public class Eiger extends Panel {
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelDataFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(panelBeamline, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(panelBeamline, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(panelNorm, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
@@ -716,6 +886,8 @@ public class Eiger extends Panel {
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(panelDataFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(panelNorm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelBeamline, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -776,22 +948,36 @@ public class Eiger extends Panel {
}
});
+ buttonShowDetectorPanel.setText("Show Detector Panel");
+ buttonShowDetectorPanel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonShowDetectorPanelActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout panelRoiLayout = new javax.swing.GroupLayout(panelRoi);
panelRoi.setLayout(panelRoiLayout);
panelRoiLayout.setHorizontalGroup(
panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRoiLayout.createSequentialGroup()
.addGap(17, 17, 17)
- .addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jLabel26)
- .addComponent(buttonRoiAdd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonRoiRemove, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
- .addComponent(buttonTriggerDetector, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(rendererRoi, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(panelRoiLayout.createSequentialGroup()
+ .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel26)
+ .addComponent(buttonRoiAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonRoiRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonTriggerDetector, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(1, 1, 1))
+ .addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
+
+ panelRoiLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonRoiAdd, buttonRoiRemove, buttonShowDetectorPanel, buttonTriggerDetector, jScrollPane1});
+
panelRoiLayout.setVerticalGroup(
panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRoiLayout.createSequentialGroup()
@@ -799,14 +985,16 @@ public class Eiger extends Panel {
.addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelRoiLayout.createSequentialGroup()
- .addComponent(buttonRoiAdd)
+ .addComponent(buttonRoiAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonRoiRemove)
+ .addComponent(buttonRoiRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel26)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
- .addGap(18, 18, 18)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonTriggerDetector)))
.addContainerGap())
);
@@ -1052,7 +1240,7 @@ public class Eiger extends Panel {
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(panelImgControls, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 236, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonImgStart)
.addComponent(buttonImgAbort))
@@ -1198,9 +1386,9 @@ public class Eiger extends Panel {
.addGroup(panelSpectrumLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel25)
.addComponent(spinnerSpecScans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 19, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 93, Short.MAX_VALUE)
.addComponent(checkSpecSwitchPol)
- .addGap(0, 11, Short.MAX_VALUE))
+ .addGap(0, 86, Short.MAX_VALUE))
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -1256,7 +1444,7 @@ public class Eiger extends Panel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE)
+ .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 691, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1276,46 +1464,10 @@ public class Eiger extends Panel {
}
}//GEN-LAST:event_buttonSetPathActionPerformed
- private void buttonUndoPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoPathActionPerformed
- try {
- textDataPath.setText(getContext().getConfig().dataPath);
- updateControls();
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonUndoPathActionPerformed
-
- private void buttonSetSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetSeqActionPerformed
- try {
- getContext().setFileSequentialNumber(((Number) spinnerSeq.getValue()).intValue());
- updateControls();
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonSetSeqActionPerformed
-
- private void buttonUndoSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoSeqActionPerformed
- try {
- spinnerSeq.setValue(getContext().getFileSequentialNumber());
- updateControls();
- } catch (Exception ex) {
- showException(ex);
- }
- }//GEN-LAST:event_buttonUndoSeqActionPerformed
-
private void textDataPathKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textDataPathKeyTyped
}//GEN-LAST:event_textDataPathKeyTyped
- private void spinnerSeqStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerSeqStateChanged
- updateControls();
- }//GEN-LAST:event_spinnerSeqStateChanged
-
- private void buttonDefaultPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultPathActionPerformed
- textDataPath.setText(DEFAULT_PATH);
- updateControls();
- }//GEN-LAST:event_buttonDefaultPathActionPerformed
-
private void textDataPathKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textDataPathKeyReleased
updateControls();
}//GEN-LAST:event_textDataPathKeyReleased
@@ -1399,6 +1551,84 @@ public class Eiger extends Panel {
}
}//GEN-LAST:event_buttonApplyActionPerformed
+ private void spinnerSeqStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerSeqStateChanged
+ updateControls();
+ }//GEN-LAST:event_spinnerSeqStateChanged
+
+ private void buttonUndoSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoSeqActionPerformed
+ try {
+ spinnerSeq.setValue(getContext().getFileSequentialNumber());
+ updateControls();
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_buttonUndoSeqActionPerformed
+
+ private void buttonSetSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetSeqActionPerformed
+ try {
+ getContext().setFileSequentialNumber(((Number) spinnerSeq.getValue()).intValue());
+ updateControls();
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_buttonSetSeqActionPerformed
+
+ private void buttonUndoPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoPathActionPerformed
+ try {
+ textDataPath.setText(getContext().getConfig().dataPath);
+ updateControls();
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_buttonUndoPathActionPerformed
+
+ private void buttonDefaultPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultPathActionPerformed
+ textDataPath.setText(DEFAULT_PATH);
+ updateControls();
+ }//GEN-LAST:event_buttonDefaultPathActionPerformed
+
+ private void buttonSetNormActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetNormActionPerformed
+ try{
+ JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getContext().getConfig().dataPath));
+ FileNameExtensionFilter filter = new FileNameExtensionFilter("Image File", "tif", "tiff");
+ chooser.setFileFilter(filter);
+ chooser.setFileHidingEnabled(true);
+
+ int rVal = chooser.showOpenDialog(this);
+ if (rVal == JFileChooser.APPROVE_OPTION) {
+ textNorm.setText(chooser.getSelectedFile().getAbsoluteFile().toString());
+ this.setSetting("NORM_FILE", textNorm.getText());
+ }
+ } catch (Exception ex){
+ showException (ex);
+ }
+ }//GEN-LAST:event_buttonSetNormActionPerformed
+
+ private void textNormKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNormKeyReleased
+ // TODO add your handling code here:
+ }//GEN-LAST:event_textNormKeyReleased
+
+ private void textNormKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNormKeyTyped
+ // TODO add your handling code here:
+ }//GEN-LAST:event_textNormKeyTyped
+
+ private void buttonShowDetectorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowDetectorPanelActionPerformed
+ try{
+ this.showDevicePanel("eiger");
+ } catch (Exception ex){
+ showException (ex);
+ }
+ }//GEN-LAST:event_buttonShowDetectorPanelActionPerformed
+
+ private void buttonShowNormActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowNormActionPerformed
+ try{
+ this.enableNorm( buttonShowNorm.isSelected());
+ buttonShowNorm.setText(buttonShowNorm.isSelected() ? "Hide" : "Show");
+ } catch (Exception ex){
+ showException (ex);
+ }
+ }//GEN-LAST:event_buttonShowNormActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAdd;
private javax.swing.JButton buttonApply;
@@ -1408,8 +1638,11 @@ public class Eiger extends Panel {
private javax.swing.JButton buttonRemove;
private javax.swing.JButton buttonRoiAdd;
private javax.swing.JButton buttonRoiRemove;
+ private javax.swing.JButton buttonSetNorm;
private javax.swing.JButton buttonSetPath;
private javax.swing.JButton buttonSetSeq;
+ private javax.swing.JButton buttonShowDetectorPanel;
+ private javax.swing.JToggleButton buttonShowNorm;
private javax.swing.JButton buttonSpecAbort;
private javax.swing.JButton buttonSpecStart;
private javax.swing.JButton buttonTriggerDetector;
@@ -1445,6 +1678,8 @@ public class Eiger extends Panel {
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
+ private javax.swing.JLabel jLabel27;
+ private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
@@ -1467,6 +1702,7 @@ public class Eiger extends Panel {
private javax.swing.JPanel panelBeamline;
private javax.swing.JPanel panelDataFile;
private javax.swing.JPanel panelImgControls;
+ private javax.swing.JPanel panelNorm;
private javax.swing.JPanel panelRoi;
private javax.swing.JPanel panelSpectrum;
private ch.psi.pshell.imaging.Renderer rendererRoi;
@@ -1476,6 +1712,7 @@ public class Eiger extends Panel {
private javax.swing.JSpinner spinnerHar2;
private javax.swing.JSpinner spinnerImgAvg1;
private javax.swing.JSpinner spinnerImgAvg2;
+ private javax.swing.JSpinner spinnerImgEng;
private javax.swing.JSpinner spinnerImgEng1;
private javax.swing.JSpinner spinnerImgEng2;
private javax.swing.JSpinner spinnerImgExp1;
@@ -1490,5 +1727,6 @@ public class Eiger extends Panel {
private javax.swing.JTable tableRegions;
private javax.swing.JTable tableRoi;
private javax.swing.JTextField textDataPath;
+ private javax.swing.JTextField textNorm;
// End of variables declaration//GEN-END:variables
}
diff --git a/script/devices/id.py b/script/devices/id.py
index 5c6c09e..66901e0 100644
--- a/script/devices/id.py
+++ b/script/devices/id.py
@@ -79,7 +79,7 @@ def put_id_pol(id, pol, alpha=None):
if is_string(pol):
- pol=POL_IDS[v]
+ pol=POL_IDS[pol]
if pol == 1:
caput(pv1,1)
@@ -94,4 +94,14 @@ def put_id_pol(id, pol, alpha=None):
elif pol == 5:
caput(pv1,0)
time.sleep(1.0)
- caput(pv2,alpha)
+ caput(pv2,alpha)
+
+def tune_detune(active_id):
+ if active_id ==1:
+ print "Tune ID1"
+ put_id_offset(2, float(get_setting("OFFSET_ID_2"))-40) #detuneID2
+ put_id_offset(1, float(get_setting("OFFSET_ID_1"))) #tuneID1
+ else:
+ print "Tune ID2"
+ put_id_offset(1, float(get_setting("OFFSET_ID_1"))-40) #detuneID1
+ put_id_offset(2, float(get_setting("OFFSET_ID_2"))) #tuneID2
diff --git a/script/devices/norm.py b/script/devices/norm.py
new file mode 100644
index 0000000..79abc07
--- /dev/null
+++ b/script/devices/norm.py
@@ -0,0 +1,38 @@
+import ch.psi.pshell.ui.App as App
+import ch.psi.pshell.imaging.DeviceSource as DeviceSource
+
+class ImgageNorm (DeviceSource):
+ def __init__(self, name, dev):
+ DeviceSource.__init__(self, name, dev)
+ self.filenane = get_setting("NORM_FILE")
+ try:
+ ip=open_image(self.filenane)
+
+ #TRANSPOSE - ImageJ stores the data transposed
+ ip.getProcessor().rotate(-90)
+ ip.getProcessor().flipVertical()
+
+
+ array = get_ip_array(ip)
+ self.ref = Data(array)
+ except:
+ self.ref = None
+ self.pushData(None)
+ print sys.exc_info()[1]
+
+ def onDataReceived(self,val):
+ if self.ref:
+ n = Data(eiger.getDataMatrix().take())
+ n.threshold(1e9, False, None)
+ n.div(self.ref)
+ self.pushData(n)
+
+
+norm = ImgageNorm("norm", eiger.dataArray)
+norm.monitored=True
+add_device(norm, True)
+show_panel(norm)
+
+dlg = App.getInstance().getDevicePanelManager().getPanelDialog("norm");
+dlg.setSize(800,800)
+
diff --git a/script/templates/Eiger2Img.py b/script/templates/Eiger2Img.py
index 374c818..4cbe67a 100644
--- a/script/templates/Eiger2Img.py
+++ b/script/templates/Eiger2Img.py
@@ -4,9 +4,7 @@ if get_exec_pars().source == CommandSource.ui:
METHOD = "Two_Pol"
SWITCHING = "Tune_Detune"
MEASUREMENTS = 4
- CONTRAST = 0
AUTO_SAVE = True
- AS_SEQUENCE = False
EXPOSURE_1 = 1.0
AVERAGE_1 = 2.0
ENERGY_1 = 850.0
@@ -17,7 +15,7 @@ if get_exec_pars().source == CommandSource.ui:
POLARIZATION_2 = "Circ_Minus"
-DRY_RUN=True
+DRY_RUN=False
SHOW_IMAGES = True
ID = get_setting("ID")
@@ -86,22 +84,20 @@ if not DRY_RUN:
active_id = 1
current_pol=None
-polID1=get_id_pol(1)
-polID2=get_id_pol(2)
-id_off_1 = get_id_offset(1)
-id_off_2 = get_id_offset(2)
+pol_id1=POL_IDS[get_setting("POL_ID_1")]
+pol_id2=POL_IDS[get_setting("POL_ID_2")]
+
#rbkEnergy=energy_rbk.read()
if METHOD == "Two_Pol":
if ID == "ID1":
- current_pol = polID1
+ current_pol = pol_id1
elif ID == "ID2":
- current_pol = polID2
+ current_pol = pol_id2
elif ID == "ID1_ID2":
- current_pol=polID1
+ current_pol=pol_id1
if SWITCHING == "Tune_Detune":
- put_id_offset(2, id_off_2-40) #detuneID2
- put_id_offset(1, id_off_1) #tuneID2
+ tune_detune(1) #Tune ID1, Detune ID2
wait_channel("X11PHS:alldone", 1)
def imageinfo(info):
@@ -111,7 +107,7 @@ def imageinfo(info):
#Beamline setting
def nextpol():
- global current_pol, polID1, polID2, active_id
+ global current_pol, pol_id1, pol_id2, active_id
if SWITCHING == "Normal":
if current_pol==1: return 2 #circ+ -> circ-
if current_pol==2: return 1 #circ+ -> circ-
@@ -119,8 +115,8 @@ def nextpol():
if current_pol==4: return 3 #lin vert -> lin hor
if current_pol==5: return 5 #lin rot -> lin rot
elif SWITCHING == "Tune_Detune":
- if active_id==1: return polID2
- if active_id==2: return polID1
+ if active_id==1: return pol_id2
+ if active_id==2: return pol_id1
def switch_pol():
@@ -136,15 +132,12 @@ def switch_pol():
if SWITCHING == "Normal":
put_id_pol(1, newpol)
put_id_pol(2, newpol)
- elif SWITCHING == "Tune_Detune":
- if active_id ==1:
- put_id_offset(1, id_off_1-40) #detuneID1
- put_id_offset(2, id_off_2) #tuneID2
+ elif SWITCHING == "Tune_Detune":
+ if active_id==1:
active_id=2
else:
- put_id_offset(2, id_off_2-40) #detuneID2
- put_id_offset(1, id_off_1) #tuneID2
active_id=1
+ tune_detune(active_id)
time.sleep(1.0)
wait_channel("X11PHS:alldone", 1)
@@ -187,23 +180,21 @@ try:
for i in range(2):
assert_status_ok()
eiger.setExposure(EXPOSURE[i])
-
- if AS_SEQUENCE:
- raise Exception("As sequence not implemented")
- # TODO
- else:
- ret = grab_frames(image, AVERAGE[i], roi=None, wait_next=True)
- frames.append(average_frames(ret) if AVERAGE[i] > 1 else ret[0])
- imageinfo("I")
- save_image_file(frames[i], cycle, i)
-
+ print "--- Grabing frames step=", i
+ ret = grab_frames(image, AVERAGE[i], roi=None, wait_next=True)
+ frames.append(average_frames(ret) if AVERAGE[i] > 1 else ret[0])
+ imageinfo("I")
+ save_image_file(frames[i], cycle, i)
+
if METHOD == "Take_Image":
break
if METHOD == "Two_Pol":
+ print "--- Switching polatization..."
switch_pol()
- if METHOD == "Two_Energies":
+ if METHOD == "Two_Energies":
+ print "--- Switching energy..."
change_energy(ENERGY_2)
time.sleep(1)
@@ -223,6 +214,7 @@ try:
# Auto average and save
if MEASUREMENTS > 1 and AUTO_SAVE == 1:
+ print "--- Averaging..."
for i in range(len(frames)):
measures = []
for cycle in range(1, MEASUREMENTS + 1):
diff --git a/script/templates/EigerAbsSpec.py b/script/templates/EigerAbsSpec.py
index 70003fe..86b1aa1 100644
--- a/script/templates/EigerAbsSpec.py
+++ b/script/templates/EigerAbsSpec.py
@@ -55,8 +55,10 @@ def grab_image(position, scan):
frames = grab_frames(image, AVERAGE, roi=None, wait_next=True)
av = average_frames(frames)
if SAVE_IMAGES:
- Scan_Nr = (scan.recordIndex-1)/NUMBER_SCANS
- filename = get_exec_pars().path + "/" + ("%02d" % Scan_Nr) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
+ #Scan_Nr = (scan.recordIndex-1)/NUMBER_SCANS
+ #filename = get_exec_pars().path + "/" + ("%02d" % Scan_Nr) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
+ filename = get_exec_pars().path + "/" + str(scan.currentPass) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
+ filename = get_context().setup.expandPath(filename)
print filename
save_as_tiff(av, filename)
diff --git a/script/templates/SetupBeamline.py b/script/templates/SetupBeamline.py
index 49e631f..148d08c 100644
--- a/script/templates/SetupBeamline.py
+++ b/script/templates/SetupBeamline.py
@@ -1,6 +1,7 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
- ID = "ID2"
+ ID = "ID2" #"ID1_ID2"
+ ENERGY = 805
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
@@ -10,8 +11,23 @@ if get_exec_pars().source == CommandSource.ui:
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
+DRY_RUN=False
+
set_setting("ID", ID)
+set_setting("ENERGY", ENERGY)
+set_setting("POL_ID_1", POL_ID_1)
+set_setting("ALPHA_ID_1", ALPHA_ID_1)
+set_setting("HARMONIC_ID_1", HARMONIC_ID_1)
+set_setting("OFFSET_ID_1", OFFSET_ID_1)
+set_setting("POL_ID_2", POL_ID_2)
+set_setting("ALPHA_ID_2", ALPHA_ID_2)
+set_setting("HARMONIC_ID_2", HARMONIC_ID_2)
+set_setting("OFFSET_ID_2", OFFSET_ID_2)
+
+if DRY_RUN:
+ abort()
+
if ID=='ID1':
caput('X11PHS-E:OPT',1)
@@ -20,31 +36,36 @@ elif ID=='ID2':
elif ID =='ID1_ID2':
caput('X11PHS-E:OPT',3)
-
if ID == "ID1":
#current_pol=POL_IDS[POL_ID_1] #get_id_pol(1)
put_id_pol(1,POL_ID_1)
caput('X11MA-ID2-GAP:SET',100) #open Gap ID2
- caput('X11MA-ID1:HARMONIC', HARMONIC_ID_1)
+ caput('X11MA-ID1:HARMONIC', int(HARMONIC_ID_1))
+ put_id_offset(1, float(OFFSET_ID_1)) #offset on ID1
+
elif ID == "ID2":
#current_pol=POL_IDS[POL_ID_2]#get_id_pol(2)
put_id_pol(2,POL_ID_2)
caput('X11MA-ID1-GAP:SET',100) #open Gap ID1
- caput('X11MA-ID2:HARMONIC', HARMONIC_ID_2)
+ caput('X11MA-ID2:HARMONIC', int(HARMONIC_ID_2))
+ put_id_offset(2, float(OFFSET_ID_2)) #offset on ID2
+
elif ID == "ID1_ID2":
#polID1=POL_IDS[POL_ID_1]
#polID2=POL_IDS[POL_ID_2]
put_id_pol(1,POL_ID_1)
put_id_pol(2,POL_ID_2)
#current_pol=polID1
- caput('X11MA-ID1:HARMONIC', HARMONIC_ID_1)
- caput('X11MA-ID2:HARMONIC', HARMONIC_ID_2)
+ caput('X11MA-ID1:HARMONIC', int(HARMONIC_ID_1))
+ caput('X11MA-ID2:HARMONIC', int(HARMONIC_ID_2))
+ put_id_offset(1, float(OFFSET_ID_1)) #offset on ID1
+ put_id_offset(2, float(OFFSET_ID_2)) #offset on ID2
-put_id_offset(1, OFFSET_ID_1) #offset on ID1
-put_id_offset(2, OFFSET_ID_2) #offset on ID2
+#wait_channel("X11PHS:alldone", 1)
+energy.write(ENERGY)
wait_channel("X11PHS:alldone", 1)
diff --git a/script/test/TestListener.py b/script/test/TestListener.py
new file mode 100644
index 0000000..a20d49c
--- /dev/null
+++ b/script/test/TestListener.py
@@ -0,0 +1,16 @@
+#Create a listener to the positioner checking the setpoint before each command is sent.
+class ListenerAO (DeviceListener):
+ def onStateChanged(self, device, state, former):
+ pass
+ def onValueChanged(self, device, value, former):
+ print "Value to: " + str(value)
+ def onCacheChanged(self, device, value, former, timestamp,value_changed):
+ print "Cache to: " + str(value),
+
+listenerAO = ListenerAO()
+
+eiger.dataArray.addListener(listenerAO)
+
+
+eiger.dataArray.removeListener(listenerAO)
+