This commit is contained in:
gac-x11ma
2020-02-04 12:08:13 +01:00
parent a0b61220e9
commit 27152efce8
9 changed files with 243 additions and 233 deletions

View File

@@ -0,0 +1,2 @@
#Tue Feb 04 11:56:24 CET 2020
ID=ID1_ID2

View File

@@ -1,2 +1,2 @@
#Mon Feb 03 16:51:48 CET 2020
FileSequentialNumber=327
#Tue Feb 04 11:59:35 CET 2020
FileSequentialNumber=346

View File

@@ -222,44 +222,40 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="labelSwitching" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="comboID" linkSize="4" pref="121" max="32767" attributes="0"/>
<Component id="comboSwitch" linkSize="4" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" 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>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel9" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jPanel7" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboID" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelSwitching" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboSwitch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboID" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonApply" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -270,11 +266,6 @@
<Property name="text" type="java.lang.String" value="ID:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelSwitching">
<Properties>
<Property name="text" type="java.lang.String" value="Switching:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboID">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
@@ -290,21 +281,6 @@
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JComboBox" name="comboSwitch">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanel7">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
@@ -547,6 +523,14 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonApply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonApplyActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
@@ -565,7 +549,7 @@
<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="439" max="32767" 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"/>
@@ -701,7 +685,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="82" max="32767" attributes="0"/>
<EmptySpace pref="87" 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"/>
@@ -736,17 +720,16 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="labelSwitching" min="-2" max="-2" attributes="0"/>
<Component id="jLabel21" min="-2" max="-2" attributes="0"/>
<Component id="jLabel20" min="-2" max="-2" attributes="0"/>
<Component id="jLabel22" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerImgMeasurements" linkSize="10" min="-2" max="-2" attributes="0"/>
<Component id="comboImgMethod" linkSize="10" min="-2" max="-2" attributes="0"/>
<Component id="checkImgAutosave" linkSize="10" min="-2" max="-2" attributes="0"/>
<Component id="checImgAsSeq" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerImgContrast" linkSize="10" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerImgMeasurements" linkSize="10" max="32767" attributes="0"/>
<Component id="comboImgMethod" linkSize="10" max="32767" attributes="0"/>
<Component id="checkImgAutosave" linkSize="10" max="32767" attributes="0"/>
<Component id="comboSwitch" linkSize="10" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jPanel8" max="32767" attributes="0"/>
@@ -773,15 +756,13 @@
<Component id="jLabel20" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerImgMeasurements" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel22" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerImgContrast" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelSwitching" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboSwitch" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="checkImgAutosave" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
<Component id="checImgAsSeq" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -1069,29 +1050,31 @@
<Property name="text" type="java.lang.String" value="Measurements:"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checImgAsSeq">
<Properties>
<Property name="text" type="java.lang.String" value="As Sequence"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkImgAutosave">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Autosave"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel22">
<Component class="javax.swing.JLabel" name="labelSwitching">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Contrast:"/>
<Property name="text" type="java.lang.String" value="Switching:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerImgContrast">
<Component class="javax.swing.JComboBox" name="comboSwitch">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="1000.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
@@ -1113,11 +1096,11 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="224" max="32767" attributes="0"/>
<EmptySpace min="0" pref="226" max="32767" attributes="0"/>
<Component id="buttonSpecStart" linkSize="12" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="76" max="-2" attributes="0"/>
<Component id="buttonSpecAbort" linkSize="12" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="224" max="32767" attributes="0"/>
<EmptySpace min="0" pref="226" max="32767" attributes="0"/>
</Group>
<Component id="panelSpectrum" alignment="0" max="32767" attributes="0"/>
</Group>

View File

@@ -231,8 +231,7 @@ public class Eiger extends Panel {
}
void setBeamlineArgs(HashMap args) {
args.put("ID", comboID.getSelectedItem());
args.put("SWITCHING", comboSwitch.getSelectedItem());
args.put("ID", comboID.getSelectedItem());
args.put("POL_ID_1", comboPol1.getSelectedItem());
args.put("ALPHA_ID_1", spinnerAlp1.getValue());
args.put("HARMONIC_ID_1", spinnerHar1.getValue());
@@ -240,26 +239,16 @@ public class Eiger extends Panel {
args.put("POL_ID_2", comboPol2.getSelectedItem());
args.put("ALPHA_ID_2", spinnerAlp2.getValue());
args.put("HARMONIC_ID_2", spinnerHar2.getValue());
args.put("OFFSET_ID_2", spinnerOff2.getValue());
Map<String, List<Integer>> roi = new HashMap<>();
for (int i=0; i<rois.size(); i++){
roi.put("Region" + (i+1), Arrays.asList(new Integer[] { rois.get(i).getPosition().x,
rois.get(i).getPosition().y,
rois.get(i).getSize().width,
rois.get(i).getSize().height}));
}
args.put("ROI", roi);
args.put("OFFSET_ID_2", spinnerOff2.getValue());
}
void run2Images() throws Context.ContextStateException {
HashMap args = new HashMap();
args.put("METHOD", comboImgMethod.getSelectedItem());
args.put("SWITCHING", comboSwitch.getSelectedItem());
args.put("MEASUREMENTS", spinnerImgMeasurements.getValue());
args.put("CONTRAST", spinnerImgContrast.getValue());
args.put("AUTO_SAVE", checkImgAutosave.isSelected());
args.put("AS_SEQUENCE", checImgAsSeq.isSelected());
args.put("EXPOSURE_1", spinnerImgExp1.getValue());
args.put("AVERAGE_1", spinnerImgAvg1.getValue());
args.put("ENERGY_1", spinnerImgEng1.getValue());
@@ -267,8 +256,7 @@ public class Eiger extends Panel {
args.put("EXPOSURE_2", spinnerImgExp2.getValue());
args.put("AVERAGE_2", spinnerImgAvg2.getValue());
args.put("ENERGY_2", spinnerImgEng2.getValue());
args.put("POLARIZATION_2", comboImgPol2.getSelectedItem());
setBeamlineArgs(args);
args.put("POLARIZATION_2", comboImgPol2.getSelectedItem());
runAsync("templates/Eiger2Img", args).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
@@ -297,7 +285,15 @@ public class Eiger extends Panel {
args.put("AVERAGE", spinnerSpecAvg.getValue());
args.put("NUMBER_SCANS", spinnerSpecScans.getValue());
args.put("RANGES", ranges);
setBeamlineArgs(args);
Map<String, List<Integer>> roi = new HashMap<>();
for (int i=0; i<rois.size(); i++){
roi.put("Region" + (i+1), Arrays.asList(new Integer[] { rois.get(i).getPosition().x,
rois.get(i).getPosition().y,
rois.get(i).getSize().width,
rois.get(i).getSize().height}));
}
args.put("ROI", roi);
runAsync("templates/EigerAbsSpec", args).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
@@ -306,6 +302,20 @@ public class Eiger extends Panel {
return t;
});
}
void applyBeamline() throws Context.ContextStateException {
HashMap args = new HashMap();
setBeamlineArgs(args);
runAsync("templates/SetupBeamline", args).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
showException((Exception) t);
}
return t;
});
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -325,9 +335,7 @@ public class Eiger extends Panel {
jLabel1 = new javax.swing.JLabel();
panelBeamline = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
labelSwitching = new javax.swing.JLabel();
comboID = new javax.swing.JComboBox<String>();
comboSwitch = new javax.swing.JComboBox<String>();
jPanel7 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
comboPol1 = new javax.swing.JComboBox<String>();
@@ -346,6 +354,7 @@ public class Eiger extends Panel {
spinnerHar2 = new javax.swing.JSpinner();
jLabel16 = new javax.swing.JLabel();
spinnerOff2 = new javax.swing.JSpinner();
buttonApply = new javax.swing.JButton();
panelRoi = new javax.swing.JPanel();
rendererRoi = new ch.psi.pshell.imaging.Renderer();
jLabel26 = new javax.swing.JLabel();
@@ -380,10 +389,9 @@ public class Eiger extends Panel {
spinnerImgMeasurements = new javax.swing.JSpinner();
comboImgMethod = new javax.swing.JComboBox<String>();
jLabel20 = new javax.swing.JLabel();
checImgAsSeq = new javax.swing.JCheckBox();
checkImgAutosave = new javax.swing.JCheckBox();
jLabel22 = new javax.swing.JLabel();
spinnerImgContrast = new javax.swing.JSpinner();
labelSwitching = new javax.swing.JLabel();
comboSwitch = new javax.swing.JComboBox<String>();
jPanel3 = new javax.swing.JPanel();
panelSpectrum = new javax.swing.JPanel();
jLabel23 = new javax.swing.JLabel();
@@ -523,12 +531,8 @@ public class Eiger extends Panel {
jLabel3.setText("ID:");
labelSwitching.setText("Switching:");
comboID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
comboSwitch.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("ID1"));
jLabel5.setText("Polarization:");
@@ -653,45 +657,47 @@ public class Eiger extends Panel {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
buttonApply.setText("Apply");
buttonApply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonApplyActionPerformed(evt);
}
});
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()
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelSwitching)
.addComponent(jLabel3))
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(comboID, 0, 121, Short.MAX_VALUE)
.addComponent(comboSwitch, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, Short.MAX_VALUE)
.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)
.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[] {comboID, comboSwitch});
panelBeamlineLayout.setVerticalGroup(
panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamlineLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap()
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelBeamlineLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelSwitching)
.addComponent(comboSwitch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
.addComponent(comboID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonApply)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
@@ -776,7 +782,7 @@ public class Eiger extends Panel {
panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRoiLayout.createSequentialGroup()
.addGap(17, 17, 17)
.addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
.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)
@@ -966,15 +972,12 @@ public class Eiger extends Panel {
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel20.setText("Measurements:");
checImgAsSeq.setText("As Sequence");
checkImgAutosave.setSelected(true);
checkImgAutosave.setText("Autosave");
jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel22.setText("Contrast:");
labelSwitching.setText("Switching:");
spinnerImgContrast.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 1000.0d, 1.0d));
comboSwitch.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout panelImgControlsLayout = new javax.swing.GroupLayout(panelImgControls);
panelImgControls.setLayout(panelImgControlsLayout);
@@ -983,16 +986,15 @@ public class Eiger extends Panel {
.addGroup(panelImgControlsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelSwitching)
.addComponent(jLabel21)
.addComponent(jLabel20)
.addComponent(jLabel22))
.addComponent(jLabel20))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerImgMeasurements, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboImgMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkImgAutosave)
.addComponent(checImgAsSeq)
.addComponent(spinnerImgContrast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerImgMeasurements)
.addComponent(comboImgMethod, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkImgAutosave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboSwitch, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, Short.MAX_VALUE)
@@ -1000,7 +1002,7 @@ public class Eiger extends Panel {
.addContainerGap())
);
panelImgControlsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {checImgAsSeq, checkImgAutosave, comboImgMethod, spinnerImgContrast, spinnerImgMeasurements});
panelImgControlsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {checkImgAutosave, comboImgMethod, comboSwitch, spinnerImgMeasurements});
panelImgControlsLayout.setVerticalGroup(
panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1017,14 +1019,12 @@ public class Eiger extends Panel {
.addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20)
.addComponent(spinnerImgMeasurements, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(6, 6, 6)
.addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel22)
.addComponent(spinnerImgContrast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(labelSwitching)
.addComponent(comboSwitch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(checkImgAutosave)
.addGap(11, 11, 11)
.addComponent(checImgAsSeq)))
.addComponent(checkImgAutosave)))
.addContainerGap())
);
@@ -1052,7 +1052,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, 82, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonImgStart)
.addComponent(buttonImgAbort))
@@ -1227,11 +1227,11 @@ public class Eiger extends Panel {
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 224, Short.MAX_VALUE)
.addGap(0, 226, Short.MAX_VALUE)
.addComponent(buttonSpecStart)
.addGap(76, 76, 76)
.addComponent(buttonSpecAbort)
.addGap(0, 224, Short.MAX_VALUE))
.addGap(0, 226, Short.MAX_VALUE))
.addComponent(panelSpectrum, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -1256,7 +1256,7 @@ public class Eiger extends Panel {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 691, Short.MAX_VALUE)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1391,8 +1391,17 @@ public class Eiger extends Panel {
}
}//GEN-LAST:event_buttonRemoveActionPerformed
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
try {
applyBeamline();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonApplyActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAdd;
private javax.swing.JButton buttonApply;
private javax.swing.JButton buttonDefaultPath;
private javax.swing.JButton buttonImgAbort;
private javax.swing.JButton buttonImgStart;
@@ -1406,7 +1415,6 @@ public class Eiger extends Panel {
private javax.swing.JButton buttonTriggerDetector;
private javax.swing.JButton buttonUndoPath;
private javax.swing.JButton buttonUndoSeq;
private javax.swing.JCheckBox checImgAsSeq;
private javax.swing.JCheckBox checkImgAutosave;
private javax.swing.JCheckBox checkSpecSaveImages;
private javax.swing.JCheckBox checkSpecSaveSpectrum;
@@ -1433,7 +1441,6 @@ public class Eiger extends Panel {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
@@ -1469,7 +1476,6 @@ public class Eiger extends Panel {
private javax.swing.JSpinner spinnerHar2;
private javax.swing.JSpinner spinnerImgAvg1;
private javax.swing.JSpinner spinnerImgAvg2;
private javax.swing.JSpinner spinnerImgContrast;
private javax.swing.JSpinner spinnerImgEng1;
private javax.swing.JSpinner spinnerImgEng2;
private javax.swing.JSpinner spinnerImgExp1;

View File

@@ -99,7 +99,8 @@ def grab_frame(source, roi=None, wait_next=False, rmv_outliers=True):
data = data.getRoi(Rectangle(roi[0], roi[1], roi[2], roi[3]))
#ret = load_image(img)
if rmv_outliers:
data = remove_outliers(data)
#data = remove_outliers(data)
data.threshold(1e9, False, None)
return data
def grab_frames(source, samples, roi=None, wait_next=False, sleep=0, rmv_outliers=True):
@@ -125,6 +126,7 @@ def average_frames(frames):
ret.div(len(frames))
return ret
"""
def remove_outliers(imgdata, threshold = 1e9, replace_value=None):
if replace_value is None:
if str(imgdata.getType()) in ('float', 'double'):
@@ -136,7 +138,8 @@ def remove_outliers(imgdata, threshold = 1e9, replace_value=None):
for j in range(data.height):
if data.getElementDbl(j,i, False) >=threshold:
data.setElement(j*data.width + i, replace_value)
return data
return data
"""
def save_as_tiff(data, filename, check=False, show = False):
if type(data) == Data:

View File

@@ -1,5 +1,5 @@
POL_IDS={ "Circ_Plus": 1, "Circ_Minus": 2, "Lin_Hor":3, "Lin_Ver": 4}
POL_IDS={ "Circ_Plus": 1, "Circ_Minus": 2, "Lin_Hor":3, "Lin_Ver": 4, "Lin": 5}
@@ -31,13 +31,23 @@ def get_id_pol(id, as_string=False):
# 4: Lin V
# 5: LIn
if id<1 or id>2: raise Exception("Invalid id")
ret = caget ("X11MA-ID1:MODE" if id==1 else "X11MA-ID2:MODE", 's' if as_string else 'i')
if ret!=0: return ret
#linear mode
alpha = get_alpha_id(id)
if alpha==0 : return 3
if alpha==90 : return 4
return 5
#ret = caget ("X11MA-ID1:MODE" if id==1 else "X11MA-ID2:MODE", 's' if as_string else 'i')
ret = caget ("X11MA-ID1:MODE" if id==1 else "X11MA-ID2:MODE", 'i')
if ret==0:
#linear mode
alpha = get_alpha_id(id)
if alpha==0 :
ret = 3
elif alpha==90:
ret = 4
else:
ret = 5
if as_string:
for (k,v) in POL_IDS.items():
if v==ret:
return k
return "Unknown"
return ret
def get_alpha_id(id):
if id<1 or id>2: raise Exception("Invalid id")
@@ -66,7 +76,11 @@ def put_id_pol(id, pol, alpha=None):
pv1="X11MA-ID1:MODE" if (id==1) else "X11MA-ID2:MODE"
pv2="X11MA-ID1:ALPHA" if (id==1) else "X11MA-ID2:ALPHA"
if is_string(pol):
pol=POL_IDS[v]
if pol == 1:
caput(pv1,1)
elif pol == 2:

View File

@@ -1,19 +1,8 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
ID = "ID1_ID2"
SWITCHING = "Tune_Detune"
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
OFFSET_ID_1 = 0.0
POL_ID_2 = "Circ_Minus"
ALPHA_ID_2 = 0.0
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
ROI = {"ROI1": [50,50,200, 100]}
METHOD = "Two_Pol"
SWITCHING = "Tune_Detune"
MEASUREMENTS = 4
CONTRAST = 0
AUTO_SAVE = True
@@ -27,10 +16,12 @@ if get_exec_pars().source == CommandSource.ui:
ENERGY_2= 900.0
POLARIZATION_2 = "Circ_Minus"
DRY_RUN=True
SHOW_IMAGES = True
ID = get_setting("ID")
EXPOSURE = [EXPOSURE_1, EXPOSURE_2]
AVERAGE = [int(AVERAGE_1), int(AVERAGE_2)]
@@ -92,40 +83,26 @@ def assert_status_ok():
#Initialize vartiables
if not DRY_RUN:
open_vg10()
if ID=='ID1':
caput('X11PHS-E:OPT',1)
elif ID=='ID2':
caput('X11PHS-E:OPT',2)
elif ID =='ID1_ID2':
caput('X11PHS-E:OPT',3)
active_id = 1
current_pol=None
polID1=None
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)
#rbkEnergy=energy_rbk.read()
if METHOD == "Two_Pol":
if not DRY_RUN:
if ID == "ID1":
current_pol=POL_IDS[POL_ID_1] #get_id_pol(1)
put_id_pol(1,current_pol)
elif ID == "ID2":
current_pol=POL_IDS[POL_ID_2]#get_id_pol(2)
put_id_pol(2,current_pol)
elif ID == "ID1_ID2":
polID1=POL_IDS[POL_ID_1]
polID2=POL_IDS[POL_ID_2]
put_id_pol(1,polID1)
put_id_pol(2,polID2)
current_pol=polID1
if SWITCHING == "Tune_Detune":
put_id_offset(2, OFFSET_ID_2-40) #detuneID2
put_id_offset(1, OFFSET_ID_1) #tuneID2
elif SWITCHING == "Chopper":
set_chopper(0)
if METHOD == "Two_Pol":
if ID == "ID1":
current_pol = polID1
elif ID == "ID2":
current_pol = polID2
elif ID == "ID1_ID2":
current_pol=polID1
if SWITCHING == "Tune_Detune":
put_id_offset(2, id_off_2-40) #detuneID2
put_id_offset(1, id_off_1) #tuneID2
wait_channel("X11PHS:alldone", 1)
def imageinfo(info):
@@ -161,20 +138,13 @@ def switch_pol():
put_id_pol(1, newpol)
put_id_pol(2, newpol)
elif SWITCHING == "Tune_Detune":
if active_id ==1:
put_id_offset(1, OFFSET_ID_1-40) #detuneID1
if active_id ==1:
put_id_offset(1, id_off_1-40) #detuneID1
put_id_offset(2, id_off_2) #tuneID2
active_id=2
else:
put_id_offset(2, OFFSET_ID_2-40) #detuneID2
else:
put_id_offset(2, id_off_2-40) #detuneID2
put_id_offset(1, id_off_1) #tuneID2
active_id=1
elif SWITCHING == "Chopper":
if active_id == 1:
active_id = 2
set_chopper(1)
else:
active_id = 1
active_id=1
time.sleep(1.0)
wait_channel("X11PHS:alldone", 1)
@@ -187,8 +157,6 @@ def change_energy(v):
put_energy(v)
def save_image_file(frame, cycle=-1, frame_index=0):
if SHOW_IMAGES:

View File

@@ -1,17 +1,6 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
ID = "ID2"
SWITCHING = "Normal"
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
OFFSET_ID_1 = 0.0
POL_ID_2 = "Circ_Minus"
ALPHA_ID_2 = 0.0
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
ROI = {"Region1": [10,5,20, 10], "Region2": [20,15,20, 10]}
SAVE_SPECTRUM = True
SAVE_IMAGES = False
WITH_I0 = True
@@ -83,24 +72,15 @@ set_device_alias(averager, "Image") #Set display name
sensors.append(averager) #sensors.append(eiger.getDataMatrix())
#Initialize vartiables
open_vg10()
if not DRY_RUN:
open_vg10()
if ID=='ID1':
caput('X11PHS-E:OPT',1)
elif ID=='ID2':
caput('X11PHS-E:OPT',2)
elif ID =='ID1_ID2':
caput('X11PHS-E:OPT',3)
put_id_offset(1, OFFSET_ID_1) #offset on ID1
put_id_offset(2, 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
active_id = 1
current_pol=None
polID1=None
polID2=None
"""
if ID == "ID1":
current_pol=POL_IDS[POL_ID_1] #get_id_pol(1)
put_id_pol(1,current_pol)
@@ -116,6 +96,7 @@ elif ID == "ID1_ID2":
put_id_pol(1,polID1)
put_id_pol(2,polID2)
wait_channel("X11PHS:alldone", 1)
"""
try:
#tscan(rois, 10, 0.1, format="csv", before_read=grab_image, passes = NUMBER_SCANS, tag=tag)
@@ -124,6 +105,7 @@ finally:
if AVERAGE>1:
for i in range(len(rois)):
rois[i].parent.monitored = False # Remove listeners on the image
close_vg10()
if not DRY_RUN:
close_vg10()
eiger.grabMode=eiger.GrabMode.Continuous
eiger.start()

View File

@@ -0,0 +1,52 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
ID = "ID2"
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
OFFSET_ID_1 = 0.0
POL_ID_2 = "Circ_Minus"
ALPHA_ID_2 = 0.0
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
set_setting("ID", ID)
if ID=='ID1':
caput('X11PHS-E:OPT',1)
elif ID=='ID2':
caput('X11PHS-E:OPT',2)
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)
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)
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)
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)