This commit is contained in:
gac-x11ma
2020-02-05 14:21:56 +01:00
parent 27152efce8
commit 15313b378b
15 changed files with 671 additions and 154 deletions
+2 -2
View File
@@ -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
+12 -2
View File
@@ -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
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Feb 04 11:59:35 CET 2020
FileSequentialNumber=346
#Wed Feb 05 14:20:03 CET 2020
FileSequentialNumber=381
+20
View File
@@ -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
+20
View File
@@ -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
+3 -3
View File
@@ -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
+25
View File
@@ -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
+159 -34
View File
@@ -50,6 +50,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelDataFile" max="32767" attributes="0"/>
<Component id="panelBeamline" max="32767" attributes="0"/>
<Component id="panelNorm" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -60,6 +61,8 @@
<Group type="102" alignment="0" attributes="0">
<Component id="panelDataFile" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelNorm" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelBeamline" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -220,21 +223,34 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel3" linkSize="15" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboID" linkSize="16" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel27" linkSize="15" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerImgEng" linkSize="16" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Component id="jPanel7" max="32767" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="jPanel9" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonApply" min="-2" pref="166" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboID" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="jPanel7" max="32767" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="jPanel9" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonApply" min="-2" pref="166" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -251,6 +267,11 @@
<Component id="comboID" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel27" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerImgEng" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
@@ -263,6 +284,7 @@
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="ID:"/>
</Properties>
</Component>
@@ -531,6 +553,93 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonApplyActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel27">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Energy"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerImgEng">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1000.0" maximum="2520.0" minimum="90.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelNorm">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Normalization"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonShowNorm" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel29" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="textNorm" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonSetNorm" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel29" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textNorm" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonSetNorm" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonShowNorm" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonSetNorm">
<Properties>
<Property name="text" type="java.lang.String" value="Select"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSetNormActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textNorm">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textNormKeyTyped"/>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="textNormKeyReleased"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel29">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="File: "/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonShowNorm">
<Properties>
<Property name="text" type="java.lang.String" value="Show"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonShowNormActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
@@ -549,38 +658,46 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
<Component id="rendererRoi" pref="443" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiAdd" alignment="0" max="32767" attributes="0"/>
<Component id="buttonRoiRemove" pref="200" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
<Component id="buttonTriggerDetector" max="32767" attributes="0"/>
<Component id="rendererRoi" pref="0" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiAdd" linkSize="14" alignment="0" min="-2" pref="200" max="-2" attributes="0"/>
<Component id="buttonRoiRemove" linkSize="14" min="-2" pref="200" max="-2" attributes="0"/>
<Component id="jScrollPane1" linkSize="14" min="-2" pref="200" max="-2" attributes="0"/>
<Component id="buttonTriggerDetector" linkSize="14" min="-2" pref="200" max="-2" attributes="0"/>
</Group>
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
</Group>
<Component id="buttonShowDetectorPanel" linkSize="14" alignment="1" min="-2" pref="201" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="rendererRoi" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="buttonRoiAdd" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonRoiRemove" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonRoiAdd" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiRemove" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="152" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="270" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="buttonShowDetectorPanel" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="buttonTriggerDetector" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -650,6 +767,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonTriggerDetectorActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonShowDetectorPanel">
<Properties>
<Property name="text" type="java.lang.String" value="Show Detector Panel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonShowDetectorPanelActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
@@ -685,7 +810,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="panelImgControls" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="87" max="32767" attributes="0"/>
<EmptySpace pref="236" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonImgStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonImgAbort" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -1178,9 +1303,9 @@
<Component id="jLabel25" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSpecScans" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" pref="19" max="32767" attributes="0"/>
<EmptySpace type="unrelated" pref="93" max="32767" attributes="0"/>
<Component id="checkSpecSwitchPol" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="11" max="32767" attributes="0"/>
<EmptySpace min="0" pref="86" max="32767" attributes="0"/>
</Group>
<Component id="jPanel4" max="32767" attributes="0"/>
</Group>
+305 -67
View File
@@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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
}
+12 -2
View File
@@ -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
+38
View File
@@ -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)
+24 -32
View File
@@ -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=False
SHOW_IMAGES = True
@@ -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)
current_pol=None
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":
if ID == "ID1":
current_pol = pol_id1
elif ID == "ID2":
elif ID == "ID2":
current_pol = pol_id2
elif ID == "ID1_ID2":
elif ID == "ID1_ID2":
current_pol=pol_id1
if SWITCHING == "Tune_Detune":
put_id_offset(2, id_off_2-40) #detuneID2
if SWITCHING == "Tune_Detune":
tune_detune(1) #Tune ID1, Detune ID2
wait_channel("X11PHS:alldone", 1)
@@ -111,7 +107,7 @@ def imageinfo(info):
#Beamline setting
def nextpol():
def nextpol():
global current_pol, pol_id1, pol_id2, active_id
if SWITCHING == "Normal":
if current_pol==1: return 2 #circ+ -> circ-
@@ -119,8 +115,8 @@ def nextpol():
if current_pol==3: return 4 #lin hor -> lin vert
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
elif SWITCHING == "Tune_Detune":
if active_id==1: return pol_id2
if active_id==2: return pol_id1
@@ -136,15 +132,12 @@ def switch_pol():
elif ID == "ID1_ID2":
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_pol(2, newpol)
elif SWITCHING == "Tune_Detune":
if active_id==1:
active_id=2
else:
put_id_offset(2, id_off_2-40) #detuneID2
else:
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)
eiger.setExposure(EXPOSURE[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()
switch_pol()
if METHOD == "Two_Energies":
print "--- Switching energy..."
change_energy(ENERGY_2)
time.sleep(1)
@@ -223,6 +214,7 @@ try:
# log(0 , "Temp : " + Format(temp,"0.00") + " OB : " + Format(objective,"0.00") + " StigmaA : " + " StigmaB : " )
# Auto average and save
if MEASUREMENTS > 1 and AUTO_SAVE == 1:
print "--- Averaging..."
for i in range(len(frames)):
measures = []
+4 -2
View File
@@ -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)
+29 -8
View File
@@ -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)
+16
View File
@@ -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)