diff --git a/config/AbsortionSpectrum/gold.abs b/config/AbsortionSpectrum/gold.abs new file mode 100644 index 0000000..f1dd929 Binary files /dev/null and b/config/AbsortionSpectrum/gold.abs differ diff --git a/config/AbsortionSpectrum/test.abs b/config/AbsortionSpectrum/test.abs new file mode 100644 index 0000000..dd76572 Binary files /dev/null and b/config/AbsortionSpectrum/test.abs differ diff --git a/config/ROIs/test.roi b/config/ROIs/test.roi new file mode 100644 index 0000000..019265d Binary files /dev/null and b/config/ROIs/test.roi differ diff --git a/config/ROIs/test2.roi b/config/ROIs/test2.roi new file mode 100644 index 0000000..e199ebb Binary files /dev/null and b/config/ROIs/test2.roi differ diff --git a/config/mail.properties b/config/mail.properties index de2ac9e..ae109e2 100644 --- a/config/mail.properties +++ b/config/mail.properties @@ -1,10 +1,9 @@ -#Thu Nov 09 14:56:48 CET 2017 +#Wed Dec 02 17:22:08 CET 2020 auth=None -from=pshell.sim@psi.ch -host=smtpint.psi.ch port=0 -pwd= -smsSuffix=@sms.switch.ch -#to=armin.kleibert@psi.ch;alexandre.gobbo@psi.ch -to=alexandre.gobbo@psi.ch usr= +smsSuffix=@sms.switch.ch +host=smtpint.psi.ch +from=pshell.sim@psi.ch +to= +pwd= diff --git a/config/settings.properties b/config/settings.properties index 46cc429..d45af79 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,21 +1,21 @@ -#Tue Dec 01 10:09:37 CET 2020 +#Wed Dec 09 13:19:23 CET 2020 HARMONIC_ID_1=1 -RSYNC_USER=e18413 +RSYNC_USER= OUTLIERS_THRESHOLD=1000000000 NORM_FILE=/sls/X11MA/data/X11MA/Data1/public/PEEM/2020_09/i1904_1_0.tif AUTO_SWITCH_VALVE=true DRY_RUN=true -POL_ID_2=Lin_Hor +POL_ID_2=Lin_Ver OFFSET_ID_1=-1.5 ID=ID2 OFFSET_ID_2=-1.3 proposal=proposal ENERGY=709.1 proposer=proposer -POL_ID_1=Lin_Ver +POL_ID_1=Lin_Hor RSYNC_HOST= sample=sample -RSYNC_PATH=BFO_16nm +RSYNC_PATH= pgroup=pgroup ALPHA_ID_2=45.0 ALPHA_ID_1=15.0 diff --git a/config/variables.properties b/config/variables.properties index 36bae42..0a849ca 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Sat Nov 28 14:51:50 CET 2020 -LastRunDate=201128 -FileSequentialNumber=4741 -DaySequentialNumber=24 +#Wed Dec 09 15:05:53 CET 2020 +LastRunDate=201209 +FileSequentialNumber=4799 +DaySequentialNumber=25 diff --git a/plugins/Beamline.form b/plugins/Beamline.form index 80cf0f0..fd4566c 100644 --- a/plugins/Beamline.form +++ b/plugins/Beamline.form @@ -17,20 +17,39 @@ + + + + + + + - + - + + + + + + + + + + + + + @@ -63,6 +82,8 @@ + + @@ -98,8 +119,11 @@ - - + + + + + @@ -488,7 +512,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Beamline.java b/plugins/Beamline.java index 6cd1423..bf00233 100644 --- a/plugins/Beamline.java +++ b/plugins/Beamline.java @@ -19,6 +19,8 @@ import javax.swing.SwingConstants; */ public class Beamline extends Panel { + boolean updatingControls; + public enum ID { ID1, ID2, @@ -44,7 +46,7 @@ public class Beamline extends Panel { SwingUtils.setEnumCombo(comboPol1, Beamline.Polarization.class, true); SwingUtils.setEnumCombo(comboPol2, Beamline.Polarization.class, true); - Component[] parameterControls = new Component[0]; + Component[] parameterControls = new Component[]{}; for (JPanel panel : new JPanel[]{panelBeamline}) { for (Class cls : new Class[]{JComboBox.class, JSpinner.class, JToggleButton.class}) { parameterControls = Arr.append(parameterControls, SwingUtils.getComponentsByType(panel, cls)); @@ -71,6 +73,38 @@ public class Beamline extends Panel { @Override public void onInitialize(int runCount) { try { + updateBeamlineSetup(); + } catch (IOException ex) { + showException(ex); + } + } + + @Override + public void onStateChange(State state, State former) { + try{ + updatingControls = true; + checkDryMode.setSelected((boolean) this.eval("get_dry_run()", true)); + //updateBeamlineSetup(); + } catch (Exception ex){ + checkDryMode.setSelected(false); + } finally{ + updatingControls = false; + } + updateControls(); + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + + //Callback to perform update - in event thread + @Override + protected void doUpdate() { + } + + + void updateBeamlineSetup() throws IOException{ String id = getSetting("ID"); Double en = Double.valueOf(getSetting("ENERGY")); String pol1 = getSetting("POL_ID_1"); @@ -90,48 +124,34 @@ public class Beamline extends Panel { comboPol2.setSelectedItem(pol2); spinnerAlp2.setValue(alp2); spinnerHar2.setValue(har2); - spinnerOff2.setValue(off2); - - checkAutoValve.setSelected(String.valueOf(getSetting("AUTO_SWITCH_VALVE")).equalsIgnoreCase("true")); - } catch (IOException ex) { - showException(ex); - } - } - - @Override - public void onStateChange(State state, State former) { - updateControls(); - } - - @Override - public void onExecutedFile(String fileName, Object result) { - } - - - //Callback to perform update - in event thread - @Override - protected void doUpdate() { + spinnerOff2.setValue(off2); + checkAutoValve.setSelected(String.valueOf(getSetting("AUTO_SWITCH_VALVE")).equalsIgnoreCase("true")); } void updateControls() { - boolean editable = getState().isInitialized() && !getState().isProcessing(); - boolean is_id1 = comboID.getSelectedIndex() != 1; - boolean is_id2 = comboID.getSelectedIndex() != 0; - buttonApply.setEnabled(editable); - - for (Component c : parameterControls) { - c.setEnabled(editable); - } + updatingControls = true; + try{ + boolean editable = getState().isInitialized() && !getState().isProcessing(); + boolean is_id1 = comboID.getSelectedIndex() != 1; + boolean is_id2 = comboID.getSelectedIndex() != 0; + buttonApply.setEnabled(editable); - if (editable) { - spinnerAlp1.setEnabled(is_id1 && (comboPol1.getSelectedItem() == Beamline.Polarization.Lin.toString())); - spinnerAlp2.setEnabled(is_id2 & (comboPol2.getSelectedItem() == Beamline.Polarization.Lin.toString())); - spinnerHar1.setEnabled(is_id1 ); - spinnerHar2.setEnabled(is_id2 ); - spinnerOff1.setEnabled(is_id1 ); - spinnerOff2.setEnabled(is_id2 ); - comboPol1.setEnabled(is_id1 ); - comboPol2.setEnabled(is_id2 ); + for (Component c : parameterControls) { + c.setEnabled(editable); + } + + if (editable) { + spinnerAlp1.setEnabled(is_id1 && (comboPol1.getSelectedItem() == Beamline.Polarization.Lin.toString())); + spinnerAlp2.setEnabled(is_id2 & (comboPol2.getSelectedItem() == Beamline.Polarization.Lin.toString())); + spinnerHar1.setEnabled(is_id1 ); + spinnerHar2.setEnabled(is_id2 ); + spinnerOff1.setEnabled(is_id1 ); + spinnerOff2.setEnabled(is_id2 ); + comboPol1.setEnabled(is_id1 ); + comboPol2.setEnabled(is_id2 ); + } + } finally { + updatingControls = false; } } @@ -201,6 +221,11 @@ public class Beamline extends Panel { checkAutoValve = new javax.swing.JCheckBox(); deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel(); deviceValuePanel10 = new ch.psi.pshell.swing.DeviceValuePanel(); + buttonUndo = new javax.swing.JButton(); + checkDryMode = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + + panelBeamline.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup")); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("ID:"); @@ -419,6 +444,13 @@ public class Beamline extends Panel { deviceValuePanel10.setDeviceName("energy_opt_desc"); + buttonUndo.setText("Undo"); + buttonUndo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonUndoActionPerformed(evt); + } + }); + javax.swing.GroupLayout panelBeamlineLayout = new javax.swing.GroupLayout(panelBeamline); panelBeamline.setLayout(panelBeamlineLayout); panelBeamlineLayout.setHorizontalGroup( @@ -445,6 +477,8 @@ public class Beamline extends Panel { .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(panelBeamlineLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonUndo, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(buttonApply, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); @@ -477,25 +511,46 @@ public class Beamline extends Panel { .addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(checkAutoValve))) - .addGap(18, 18, Short.MAX_VALUE) - .addComponent(buttonApply) + .addGap(18, 18, 18) + .addGroup(panelBeamlineLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonApply) + .addComponent(buttonUndo)) .addContainerGap()) ); panelBeamlineLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboID, deviceValuePanel1, deviceValuePanel10, spinnerImgEng}); + checkDryMode.setEnabled(false); + checkDryMode.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkDryModeActionPerformed(evt); + } + }); + + jLabel1.setText("Dry Mode"); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelBeamline, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(checkDryMode) + .addGap(2, 2, 2) + .addComponent(jLabel1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() + .addGap(0, 0, 0) .addComponent(panelBeamline, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap(24, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(checkDryMode) + .addComponent(jLabel1)) + .addContainerGap()) ); }// //GEN-END:initComponents @@ -520,16 +575,38 @@ public class Beamline extends Panel { }//GEN-LAST:event_buttonApplyActionPerformed private void checkAutoValveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAutoValveActionPerformed - try{ - setSetting("AUTO_SWITCH_VALVE", checkAutoValve.isSelected()); - } catch (Exception ex){ - showException (ex); + if (!updatingControls){ + try{ + setSetting("AUTO_SWITCH_VALVE", checkAutoValve.isSelected()); + } catch (Exception ex){ + showException (ex); + } } }//GEN-LAST:event_checkAutoValveActionPerformed + private void checkDryModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkDryModeActionPerformed + if (!updatingControls){ + try{ + this.eval("set_dry_run("+ (checkDryMode.isSelected() ? "True" : "False") + ")", true); + } catch (Exception ex){ + showException (ex); + } + } + }//GEN-LAST:event_checkDryModeActionPerformed + + private void buttonUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoActionPerformed + try{ + updateBeamlineSetup(); + } catch (Exception ex){ + showException (ex); + } + }//GEN-LAST:event_buttonUndoActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonApply; + private javax.swing.JButton buttonUndo; private javax.swing.JCheckBox checkAutoValve; + private javax.swing.JCheckBox checkDryMode; private javax.swing.JComboBox comboID; private javax.swing.JComboBox comboPol1; private javax.swing.JComboBox comboPol2; @@ -543,6 +620,7 @@ public class Beamline extends Panel { private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel7; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel8; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel9; + private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; diff --git a/plugins/Eiger.form b/plugins/Eiger.form index 0703402..5f105ed 100644 --- a/plugins/Eiger.form +++ b/plugins/Eiger.form @@ -16,7 +16,7 @@ - + @@ -185,7 +185,7 @@ - + @@ -302,15 +302,16 @@ - - - - - - - - + + + + + + + + + @@ -328,8 +329,14 @@ - - + + + + + + + + @@ -387,13 +394,69 @@ + + + + + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + </TableColumnModel> + </Property> <Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor"> <JTableSelectionModel selectionMode="0"/> </Property> + <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> + <TableHeader reorderingAllowed="true" resizingAllowed="true"/> + </Property> </Properties> </Component> </SubComponents> </Container> + <Component class="javax.swing.JButton" name="buttonRoiClear"> + <Properties> + <Property name="text" type="java.lang.String" value="Clear"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiClearActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="buttonRoiSave"> + <Properties> + <Property name="text" type="java.lang.String" value="Save"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiSaveActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="buttonRoiOpen"> + <Properties> + <Property name="text" type="java.lang.String" value="Open"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiOpenActionPerformed"/> + </Events> + </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanel2"> @@ -409,15 +472,35 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="panelImgControls" max="32767" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - <Component id="buttonImgStart" linkSize="9" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="76" max="-2" attributes="0"/> - <Component id="buttonImgAbort" linkSize="9" min="-2" max="-2" attributes="0"/> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + <Component id="panelImgControls" alignment="0" max="32767" attributes="0"/> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + <Component id="buttonImgStart" linkSize="9" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="76" max="-2" attributes="0"/> + <Component id="buttonImgAbort" linkSize="9" min="-2" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel32" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jLabel28" alignment="0" max="32767" attributes="0"/> + <Component id="jLabel22" alignment="0" max="32767" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="deviceValuePanel11" linkSize="18" alignment="0" pref="0" max="32767" attributes="0"/> + <Component id="deviceValuePanel12" linkSize="18" pref="0" max="32767" attributes="0"/> + <Component id="deviceValuePanel2" linkSize="18" alignment="0" min="-2" pref="92" max="-2" attributes="0"/> + </Group> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> + </Group> + </Group> </Group> </Group> <EmptySpace max="-2" attributes="0"/> @@ -429,7 +512,22 @@ <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 type="unrelated" max="32767" attributes="0"/> + <EmptySpace type="separate" max="32767" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel22" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel11" linkSize="19" alignment="2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel28" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel12" linkSize="19" alignment="2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel32" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel2" linkSize="19" alignment="2" min="-2" pref="17" max="-2" attributes="0"/> + </Group> + <EmptySpace type="separate" max="-2" 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"/> @@ -461,84 +559,33 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="1" attributes="0"> - <Component id="jLabel28" pref="99" max="32767" attributes="0"/> - <Group type="103" groupAlignment="1" max="-2" attributes="0"> - <Group type="102" alignment="1" 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"/> - </Group> - </Group> - <Group type="102" alignment="1" attributes="0"> - <EmptySpace min="-2" pref="22" max="-2" attributes="0"/> - <Component id="jLabel22" pref="95" max="32767" attributes="0"/> - </Group> - </Group> - </Group> + <Group type="102" 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"/> - <Component id="deviceValuePanel11" alignment="0" pref="0" max="32767" attributes="0"/> - <Component id="deviceValuePanel12" pref="0" max="32767" attributes="0"/> - </Group> + <Component id="jPanel5" max="32767" attributes="0"/> + <EmptySpace pref="18" max="32767" attributes="0"/> + <Component id="panelFirstImage" linkSize="23" min="-2" max="-2" attributes="0"/> <EmptySpace type="separate" max="32767" attributes="0"/> - <Component id="jPanel8" max="32767" attributes="0"/> - <EmptySpace type="separate" max="32767" attributes="0"/> - <Component id="jPanel10" max="32767" attributes="0"/> + <Component id="panelSecondImage" linkSize="23" 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" attributes="0"> + <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="comboImgMethod" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel21" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel20" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="spinnerImgMeasurements" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="6" 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"/> - </Group> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="checkImgAutosave" min="-2" max="-2" attributes="0"/> - </Group> - <Component id="jPanel8" alignment="0" max="32767" attributes="0"/> - <Component id="jPanel10" alignment="0" max="32767" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> - <Group type="103" groupAlignment="2" attributes="0"> - <Component id="jLabel22" alignment="2" min="-2" max="-2" attributes="0"/> - <Component id="deviceValuePanel11" alignment="2" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel5" linkSize="22" min="-2" max="-2" attributes="0"/> + <Component id="panelFirstImage" linkSize="22" alignment="0" max="32767" attributes="0"/> + <Component id="panelSecondImage" linkSize="22" alignment="0" max="32767" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="2" attributes="0"> - <Component id="jLabel28" alignment="2" min="-2" max="-2" attributes="0"/> - <Component id="deviceValuePanel12" alignment="2" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace pref="34" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> </Layout> <SubComponents> - <Container class="javax.swing.JPanel" name="jPanel8"> + <Container class="javax.swing.JPanel" name="panelFirstImage"> <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"> @@ -551,11 +598,20 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabel11" alignment="1" min="-2" max="-2" attributes="0"/> - <Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/> - <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="filler1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="labelImgEng1" min="-2" max="-2" attributes="0"/> + </Group> </Group> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> @@ -581,11 +637,12 @@ <Component id="spinnerImgAvg1" alignment="3" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="spinnerImgEng1" alignment="3" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="filler1" linkSize="24" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="labelImgEng1" linkSize="24" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="spinnerImgEng1" alignment="2" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace max="32767" attributes="0"/> + <EmptySpace pref="25" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -617,7 +674,7 @@ </Property> </Properties> </Component> - <Component class="javax.swing.JLabel" name="jLabel11"> + <Component class="javax.swing.JLabel" name="labelImgEng1"> <Properties> <Property name="horizontalAlignment" type="int" value="11"/> <Property name="text" type="java.lang.String" value="Energy:"/> @@ -630,9 +687,25 @@ </Property> </Properties> </Component> + <Component class="javax.swing.Box$Filler" name="filler1"> + <Properties> + <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[32767, 12]"/> + </Property> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[0, 14]"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[0, 14]"/> + </Property> + </Properties> + <AuxValues> + <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalStrut"/> + </AuxValues> + </Component> </SubComponents> </Container> - <Container class="javax.swing.JPanel" name="jPanel10"> + <Container class="javax.swing.JPanel" name="panelSecondImage"> <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"> @@ -647,7 +720,7 @@ <Group type="102" attributes="0"> <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabel19" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="labelImgEng2" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="jLabel17" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="jLabel12" alignment="1" min="-2" max="-2" attributes="0"/> </Group> @@ -676,10 +749,10 @@ </Group> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel19" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="labelImgEng2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="spinnerImgEng2" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace max="32767" attributes="0"/> + <EmptySpace pref="25" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -711,7 +784,7 @@ </Property> </Properties> </Component> - <Component class="javax.swing.JLabel" name="jLabel19"> + <Component class="javax.swing.JLabel" name="labelImgEng2"> <Properties> <Property name="horizontalAlignment" type="int" value="11"/> <Property name="text" type="java.lang.String" value="Energy:"/> @@ -726,93 +799,155 @@ </Component> </SubComponents> </Container> - <Component class="javax.swing.JLabel" name="jLabel21"> - <Properties> - <Property name="horizontalAlignment" type="int" value="11"/> - <Property name="text" type="java.lang.String" value="Method:"/> - </Properties> - </Component> - <Component class="javax.swing.JSpinner" name="spinnerImgMeasurements"> - <Properties> - <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> - <SpinnerModel initial="1" maximum="10000" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JComboBox" name="comboImgMethod"> - <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> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboImgMethodActionPerformed"/> - </Events> - <AuxValues> - <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> - </AuxValues> - </Component> - <Component class="javax.swing.JLabel" name="jLabel20"> - <Properties> - <Property name="horizontalAlignment" type="int" value="11"/> - <Property name="text" type="java.lang.String" value="Measurements:"/> - </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="labelSwitching"> - <Properties> - <Property name="text" type="java.lang.String" value="Switching:"/> - </Properties> - </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="<String>"/> - </AuxValues> - </Component> - <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel11"> - <Properties> - <Property name="deviceName" type="java.lang.String" value="id1_pol"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel22"> - <Properties> - <Property name="horizontalAlignment" type="int" value="11"/> - <Property name="text" type="java.lang.String" value="Mode ID1:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel28"> - <Properties> - <Property name="horizontalAlignment" type="int" value="11"/> - <Property name="text" type="java.lang.String" value="Mode ID2:"/> - </Properties> - </Component> - <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel12"> - <Properties> - <Property name="deviceName" type="java.lang.String" value="id2_pol"/> - </Properties> - </Component> + <Container class="javax.swing.JPanel" name="jPanel5"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <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"/> + </Group> + <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 max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="comboImgMethod" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel21" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel20" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="spinnerImgMeasurements" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="6" 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"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="checkImgAutosave" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <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="jLabel20"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Measurements:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel21"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Method:"/> + </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="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="<String>"/> + </AuxValues> + </Component> + <Component class="javax.swing.JSpinner" name="spinnerImgMeasurements"> + <Properties> + <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> + <SpinnerModel initial="1" maximum="10000" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="comboImgMethod"> + <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> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboImgMethodActionPerformed"/> + </Events> + <AuxValues> + <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> + </AuxValues> + </Component> + </SubComponents> + </Container> </SubComponents> </Container> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel12"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="id2_pol"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel32"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Energy:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel28"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Mode ID2:"/> + </Properties> + </Component> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel2"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="energy"/> + </Properties> + </Component> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel11"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="id1_pol"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel22"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Mode ID1:"/> + </Properties> + </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanel3"> @@ -830,7 +965,6 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="panelSpectrum" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> <EmptySpace min="0" pref="0" max="32767" attributes="0"/> <Component id="buttonSpecStart" linkSize="12" min="-2" max="-2" attributes="0"/> @@ -838,9 +972,27 @@ <Component id="buttonSpecAbort" linkSize="12" min="-2" max="-2" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/> </Group> + <Component id="panelSpectrum" max="32767" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jLabel35" alignment="1" min="-2" max="-2" attributes="0"/> + <Group type="103" alignment="1" groupAlignment="1" max="-2" attributes="0"> + <Component id="jLabel34" alignment="0" max="32767" attributes="0"/> + <Component id="jLabel33" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="deviceValuePanel14" linkSize="20" alignment="0" pref="0" max="32767" attributes="0"/> + <Component id="deviceValuePanel3" linkSize="20" alignment="0" pref="92" max="32767" attributes="0"/> + <Component id="deviceValuePanel13" linkSize="20" pref="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> @@ -848,12 +1000,27 @@ <Group type="102" alignment="0" attributes="0"> <EmptySpace min="-2" max="-2" attributes="0"/> <Component id="panelSpectrum" max="32767" attributes="0"/> - <EmptySpace min="-2" pref="76" max="-2" attributes="0"/> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel33" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel13" linkSize="21" alignment="2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel34" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel14" linkSize="21" alignment="2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="jLabel35" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="deviceValuePanel3" linkSize="21" alignment="2" min="-2" pref="17" max="-2" attributes="0"/> + </Group> + <EmptySpace pref="18" max="32767" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="buttonSpecStart" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="buttonSpecAbort" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace min="-2" pref="73" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -881,7 +1048,7 @@ <Component id="spinnerSpecExp" linkSize="11" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="spinnerSpecAvg" linkSize="11" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="108" max="32767" attributes="0"/> + <EmptySpace pref="6" max="32767" attributes="0"/> <Component id="jPanel4" min="-2" max="-2" attributes="0"/> <EmptySpace max="32767" attributes="0"/> </Group> @@ -1001,13 +1168,14 @@ <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jScrollPane2" pref="0" max="32767" attributes="0"/> - <Group type="102" attributes="0"> - <Component id="buttonAdd" linkSize="13" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="88" max="32767" attributes="0"/> - <Component id="buttonRemove" linkSize="13" min="-2" max="-2" attributes="0"/> - </Group> + <Component id="jScrollPane2" min="-2" pref="255" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="buttonAdd" linkSize="13" max="32767" attributes="0"/> + <Component id="buttonRemove" linkSize="13" max="32767" attributes="0"/> + <Component id="buttonOpen" linkSize="13" alignment="0" max="32767" attributes="0"/> + <Component id="buttonSave" linkSize="13" alignment="0" max="32767" attributes="0"/> + <Component id="buttonClear" alignment="0" max="32767" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> </Group> @@ -1016,14 +1184,25 @@ <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jScrollPane2" pref="0" max="32767" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="buttonAdd" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="buttonRemove" alignment="3" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jScrollPane2" pref="0" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="buttonAdd" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="buttonRemove" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="buttonClear" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="buttonOpen" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="buttonSave" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="21" max="-2" attributes="0"/> + </Group> </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -1065,6 +1244,30 @@ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRemoveActionPerformed"/> </Events> </Component> + <Component class="javax.swing.JButton" name="buttonOpen"> + <Properties> + <Property name="text" type="java.lang.String" value="Open"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="buttonSave"> + <Properties> + <Property name="text" type="java.lang.String" value="Save"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="buttonClear"> + <Properties> + <Property name="text" type="java.lang.String" value="Clear"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearActionPerformed"/> + </Events> + </Component> </SubComponents> </Container> </SubComponents> @@ -1085,6 +1288,39 @@ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSpecAbortActionPerformed"/> </Events> </Component> + <Component class="javax.swing.JLabel" name="jLabel33"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Mode ID1:"/> + </Properties> + </Component> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel13"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="id1_pol"/> + </Properties> + </Component> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel14"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="id2_pol"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel34"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Mode ID2:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel35"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Energy:"/> + </Properties> + </Component> + <Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel3"> + <Properties> + <Property name="deviceName" type="java.lang.String" value="energy"/> + </Properties> + </Component> </SubComponents> </Container> </SubComponents> diff --git a/plugins/Eiger.java b/plugins/Eiger.java index 4bc55bc..ead22d7 100644 --- a/plugins/Eiger.java +++ b/plugins/Eiger.java @@ -5,28 +5,28 @@ 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.DeviceValuePanel; import ch.psi.pshell.ui.App; import ch.psi.pshell.ui.Panel; import ch.psi.utils.Arr; +import ch.psi.utils.IO; +import ch.psi.utils.Serializer; import ch.psi.utils.State; +import ch.psi.utils.Str; import ch.psi.utils.swing.SwingUtils; import java.awt.Component; import java.awt.Dimension; -import java.awt.Font; import java.awt.Point; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.File; import java.io.IOException; -import java.math.BigDecimal; +import java.nio.file.Files; 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.script.ScriptException; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; @@ -34,21 +34,25 @@ import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JToggleButton; -import javax.swing.SwingConstants; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.DefaultTableModel ; +import javax.swing.table.DefaultTableModel; /** * */ public class Eiger extends Panel { + public enum Switching { Normal, Tune_Detune } + public enum SingleSwitching { + Normal + } + public enum ImgMethod { Two_Pol, Two_Energies, @@ -57,9 +61,16 @@ public class Eiger extends Panel { static String DEFAULT_PATH = "{data}/{year}_{month}/{date}_{seq}%03d"; + final String ABSORTION_SPECTRUM_PATH = getContext().getSetup().getConfigPath() + "/AbsortionSpectrum"; + final String ABSORTION_SPECTRUM_EXT = "abs"; + + final String ROIS_PATH = getContext().getSetup().getConfigPath() + "/ROIs"; + final String ROIS_EXT = "roi"; + final Component[] parameterControls; final ArrayList<Rect> rois = new ArrayList<>(); final DefaultTableModel modelRegions; + final DefaultTableModel modelRois; public Eiger() { initComponents(); @@ -72,7 +83,7 @@ public class Eiger extends Panel { for (Class cls : new Class[]{JComboBox.class, JSpinner.class, JToggleButton.class}) { parameterControls = Arr.append(parameterControls, SwingUtils.getComponentsByType(panel, cls)); } - } + } parameterControls = Arr.append(parameterControls, SwingUtils.getComponentsByType(panelRoi, JButton.class)); this.parameterControls = parameterControls; setPersistedComponents(parameterControls); @@ -98,12 +109,12 @@ public class Eiger extends Panel { boolean processingUpdate; @Override - public void tableChanged(TableModelEvent e) { + public void tableChanged(TableModelEvent e) { int row = e.getFirstRow(); if ((tableRoi.isEditing()) && (e.getType() == TableModelEvent.UPDATE) && !processingUpdate) { processingUpdate = true; try { - rois.get(row).update(new Point((Integer) model.getValueAt(row, 1), (Integer) model.getValueAt(row, 2)), + rois.get(row).update(new Point((Integer) model.getValueAt(row, 1), (Integer) model.getValueAt(row, 2)), new Dimension((Integer) model.getValueAt(row, 3), (Integer) model.getValueAt(row, 4))); rendererRoi.refresh(); } catch (Exception ex) { @@ -116,21 +127,24 @@ public class Eiger extends Panel { } }); modelRegions = (DefaultTableModel) tableRegions.getModel(); + modelRois = (DefaultTableModel) tableRoi.getModel(); + new File(ABSORTION_SPECTRUM_PATH).mkdirs(); + new File(ROIS_PATH).mkdirs(); } //Overridable callbacks @Override public void onInitialize(int runCount) { - + try { textNorm.setText(String.valueOf(getSetting("NORM_FILE"))); - removeNorm(); - try{ + removeNorm(); + try { spinnerOutliersThreshold.setValue(Integer.valueOf(getSetting("OUTLIERS_THRESHOLD"))); } catch (IOException ex) { spinnerOutliersThreshold.setValue(0); } - textOutliersMask.setText(String.valueOf(getSetting("OUTLIERS_MASK_FILE"))); + textOutliersMask.setText(String.valueOf(getSetting("OUTLIERS_MASK_FILE"))); } catch (IOException ex) { showException(ex); } @@ -152,22 +166,42 @@ public class Eiger extends Panel { void updateControls() { boolean editable = getState().isInitialized() && !getState().isProcessing(); - + for (Component c : parameterControls) { c.setEnabled(editable); } if (editable) { comboSwitch.setEnabled(comboImgMethod.getSelectedItem() == ImgMethod.Two_Pol.toString()); - spinnerImgEng1.setEnabled(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); - spinnerImgEng2.setEnabled(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); + labelImgEng1.setVisible(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); + labelImgEng2.setVisible(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); + spinnerImgEng1.setVisible(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); + spinnerImgEng2.setVisible(comboImgMethod.getSelectedItem() == ImgMethod.Two_Energies.toString()); } + + panelSecondImage.setVisible(comboImgMethod.getSelectedItem() != ImgMethod.Take_Image.toString()); buttonImgStart.setEnabled(getState() == State.Ready); buttonImgAbort.setEnabled(getState().isProcessing()); buttonSpecStart.setEnabled(getState() == State.Ready); - buttonSpecAbort.setEnabled(getState().isProcessing()); + buttonSpecAbort.setEnabled(getState().isProcessing()); + + try { + String id = getSetting("ID"); + boolean single = !id.equals("ID1_ID2"); + + if (single != (comboSwitch.getModel().getSize() == 1)) { + if (single) { + SwingUtils.setEnumCombo(comboSwitch, SingleSwitching.class, true); + } else { + SwingUtils.setEnumCombo(comboSwitch, Switching.class, true); + comboSwitch.setSelectedIndex(1); + } + } + } catch (Exception ex) { + getLogger().log(Level.WARNING, null, ex); + } } void updateRoiList() { @@ -182,6 +216,17 @@ public class Eiger extends Panel { } } + void addRoi(Rect roi) { + roi.setPen(new Pen(rendererRoi.getPenSelectedOverlay().getColor())); + roi.setSelectable(true); + roi.setMovable(true); + roi.setSolid(true); + rendererRoi.addOverlay(roi); + rois.add(roi); + updateRoiList(); + + } + void addRoi() { final Rect selection = new Rect(rendererRoi.getPenMovingOverlay()); rendererRoi.addListener(new RendererListener() { @@ -190,13 +235,7 @@ public class Eiger extends Panel { try { if (overlay.getLength() > 0) { Rect roi = (Rect) overlay.copy(); - roi.setPen(new Pen(rendererRoi.getPenSelectedOverlay().getColor())); - roi.setSelectable(true); - roi.setMovable(true); - roi.setSolid(true); - renderer.addOverlay(roi); - rois.add(roi); - updateRoiList(); + addRoi(roi); } } catch (Exception ex) { } finally { @@ -226,6 +265,12 @@ public class Eiger extends Panel { rendererRoi.abortSelection(); } + void clearRois() { + rendererRoi.removeOverlays(rois.toArray(new Overlay[0])); + rois.clear(); + updateRoiList(); + rendererRoi.abortSelection(); + } void run2Images() throws Context.ContextStateException { @@ -251,14 +296,14 @@ public class Eiger extends Panel { void runAbsSpectrum() throws Context.ContextStateException { List ranges = new ArrayList(); - for (int i=0; i<modelRegions.getRowCount();i++ ){ + for (int i = 0; i < modelRegions.getRowCount(); i++) { List row = new ArrayList(); row.add(modelRegions.getValueAt(i, 0)); row.add(modelRegions.getValueAt(i, 1)); row.add(modelRegions.getValueAt(i, 2)); ranges.add(row); } - + HashMap args = new HashMap(); args.put("SAVE_SPECTRUM", checkSpecSaveSpectrum.isSelected()); args.put("SAVE_IMAGES", checkSpecSaveImages.isSelected()); @@ -267,16 +312,15 @@ public class Eiger extends Panel { args.put("EXPOSURE", spinnerSpecExp.getValue()); args.put("AVERAGE", spinnerSpecAvg.getValue()); args.put("NUMBER_SCANS", spinnerSpecScans.getValue()); - args.put("RANGES", ranges); + args.put("RANGES", ranges); 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})); - } + 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())) { @@ -286,25 +330,24 @@ 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 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){ + if (!enabled) { removeNorm(); } else { runAsync("devices/norm", null).handle((ret, t) -> { @@ -312,7 +355,7 @@ public class Eiger extends Panel { showException((Exception) t); } JDialog dlg = App.getInstance().getDevicePanelManager().getPanelDialog("norm"); - if (dlg!=null){ + if (dlg != null) { dlg.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { @@ -321,9 +364,9 @@ public class Eiger extends Panel { } }); } - + return t; - }); + }); } } @@ -355,35 +398,42 @@ public class Eiger extends Panel { buttonRoiRemove = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tableRoi = new javax.swing.JTable(); + buttonRoiClear = new javax.swing.JButton(); + buttonRoiSave = new javax.swing.JButton(); + buttonRoiOpen = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); buttonImgStart = new javax.swing.JButton(); buttonImgAbort = new javax.swing.JButton(); panelImgControls = new javax.swing.JPanel(); - jPanel8 = new javax.swing.JPanel(); + panelFirstImage = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); spinnerImgExp1 = new javax.swing.JSpinner(); jLabel9 = new javax.swing.JLabel(); spinnerImgAvg1 = new javax.swing.JSpinner(); - jLabel11 = new javax.swing.JLabel(); + labelImgEng1 = new javax.swing.JLabel(); spinnerImgEng1 = new javax.swing.JSpinner(); - jPanel10 = new javax.swing.JPanel(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 14), new java.awt.Dimension(0, 14), new java.awt.Dimension(32767, 12)); + panelSecondImage = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); spinnerImgExp2 = new javax.swing.JSpinner(); jLabel17 = new javax.swing.JLabel(); spinnerImgAvg2 = new javax.swing.JSpinner(); - jLabel19 = new javax.swing.JLabel(); + labelImgEng2 = new javax.swing.JLabel(); spinnerImgEng2 = new javax.swing.JSpinner(); - jLabel21 = new javax.swing.JLabel(); - spinnerImgMeasurements = new javax.swing.JSpinner(); - comboImgMethod = new javax.swing.JComboBox<>(); - jLabel20 = new javax.swing.JLabel(); + jPanel5 = new javax.swing.JPanel(); checkImgAutosave = new javax.swing.JCheckBox(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); labelSwitching = new javax.swing.JLabel(); comboSwitch = new javax.swing.JComboBox<>(); + spinnerImgMeasurements = new javax.swing.JSpinner(); + comboImgMethod = new javax.swing.JComboBox<>(); + deviceValuePanel12 = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel32 = new javax.swing.JLabel(); + jLabel28 = new javax.swing.JLabel(); + deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel(); deviceValuePanel11 = new ch.psi.pshell.swing.DeviceValuePanel(); jLabel22 = new javax.swing.JLabel(); - jLabel28 = new javax.swing.JLabel(); - deviceValuePanel12 = new ch.psi.pshell.swing.DeviceValuePanel(); jPanel3 = new javax.swing.JPanel(); panelSpectrum = new javax.swing.JPanel(); jLabel23 = new javax.swing.JLabel(); @@ -401,8 +451,17 @@ public class Eiger extends Panel { tableRegions = new javax.swing.JTable(); buttonAdd = new javax.swing.JButton(); buttonRemove = new javax.swing.JButton(); + buttonOpen = new javax.swing.JButton(); + buttonSave = new javax.swing.JButton(); + buttonClear = new javax.swing.JButton(); buttonSpecStart = new javax.swing.JButton(); buttonSpecAbort = new javax.swing.JButton(); + jLabel33 = new javax.swing.JLabel(); + deviceValuePanel13 = new ch.psi.pshell.swing.DeviceValuePanel(); + deviceValuePanel14 = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel34 = new javax.swing.JLabel(); + jLabel35 = new javax.swing.JLabel(); + deviceValuePanel3 = new ch.psi.pshell.swing.DeviceValuePanel(); panelNorm.setBorder(javax.swing.BorderFactory.createTitledBorder("Normalization")); @@ -518,7 +577,7 @@ public class Eiger extends Panel { .addComponent(jLabel31) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spinnerOutliersThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 326, Short.MAX_VALUE))) + .addGap(0, 315, Short.MAX_VALUE))) .addContainerGap()) ); @@ -647,20 +706,43 @@ public class Eiger extends Panel { tableRoi.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane1.setViewportView(tableRoi); + buttonRoiClear.setText("Clear"); + buttonRoiClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRoiClearActionPerformed(evt); + } + }); + + buttonRoiSave.setText("Save"); + buttonRoiSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRoiSaveActionPerformed(evt); + } + }); + + buttonRoiOpen.setText("Open"); + buttonRoiOpen.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRoiOpenActionPerformed(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, 444, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(buttonRoiRemove, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(buttonRoiAdd, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabel26)) + .addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) + .addComponent(buttonRoiRemove, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) + .addComponent(buttonRoiAdd, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE) + .addComponent(jLabel26) + .addComponent(buttonRoiClear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonRoiOpen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonRoiSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(13, 13, 13)) ); panelRoiLayout.setVerticalGroup( @@ -676,7 +758,13 @@ public class Eiger extends Panel { .addGap(18, 18, 18) .addComponent(jLabel26) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE))) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(buttonRoiClear, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonRoiOpen, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonRoiSave, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); @@ -696,7 +784,7 @@ public class Eiger extends Panel { } }); - jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("First Image")); + panelFirstImage.setBorder(javax.swing.BorderFactory.createTitledBorder("First Image")); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel4.setText("Exposure(s):"); @@ -708,50 +796,59 @@ public class Eiger extends Panel { spinnerImgAvg1.setModel(new javax.swing.SpinnerNumberModel(1, 1, 1000, 1)); - jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel11.setText("Energy:"); + labelImgEng1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + labelImgEng1.setText("Energy:"); spinnerImgEng1.setModel(new javax.swing.SpinnerNumberModel(1000.0d, 90.0d, 2000.0d, 1.0d)); - javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); - jPanel8.setLayout(jPanel8Layout); - jPanel8Layout.setHorizontalGroup( - jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel8Layout.createSequentialGroup() - .addGap(14, 14, 14) - .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)) + javax.swing.GroupLayout panelFirstImageLayout = new javax.swing.GroupLayout(panelFirstImage); + panelFirstImage.setLayout(panelFirstImageLayout); + panelFirstImageLayout.setHorizontalGroup( + panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelFirstImageLayout.createSequentialGroup() + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(panelFirstImageLayout.createSequentialGroup() + .addGap(14, 14, 14) + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))) + .addGroup(panelFirstImageLayout.createSequentialGroup() + .addContainerGap() + .addComponent(filler1, 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(labelImgEng1))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spinnerImgExp1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerImgAvg1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerImgEng1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - jPanel8Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerImgAvg1, spinnerImgEng1, spinnerImgExp1}); + panelFirstImageLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerImgAvg1, spinnerImgEng1, spinnerImgExp1}); - jPanel8Layout.setVerticalGroup( - jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel8Layout.createSequentialGroup() + panelFirstImageLayout.setVerticalGroup( + panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelFirstImageLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(spinnerImgExp1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(spinnerImgAvg1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel11) + .addGroup(panelFirstImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(labelImgEng1) .addComponent(spinnerImgEng1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(25, Short.MAX_VALUE)) ); - jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Second Image")); + panelFirstImageLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {filler1, labelImgEng1}); + + panelSecondImage.setBorder(javax.swing.BorderFactory.createTitledBorder("Second Image")); jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel12.setText("Exposure(s):"); @@ -763,52 +860,62 @@ public class Eiger extends Panel { spinnerImgAvg2.setModel(new javax.swing.SpinnerNumberModel(1, 1, 1000, 1)); - jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel19.setText("Energy:"); + labelImgEng2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + labelImgEng2.setText("Energy:"); spinnerImgEng2.setModel(new javax.swing.SpinnerNumberModel(1000.0d, 90.0d, 2000.0d, 1.0d)); - javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); - jPanel10.setLayout(jPanel10Layout); - jPanel10Layout.setHorizontalGroup( - jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel10Layout.createSequentialGroup() + javax.swing.GroupLayout panelSecondImageLayout = new javax.swing.GroupLayout(panelSecondImage); + panelSecondImage.setLayout(panelSecondImageLayout); + panelSecondImageLayout.setHorizontalGroup( + panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelSecondImageLayout.createSequentialGroup() .addGap(14, 14, 14) - .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(labelImgEng2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spinnerImgExp2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerImgAvg2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerImgEng2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - jPanel10Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerImgAvg2, spinnerImgEng2, spinnerImgExp2}); + panelSecondImageLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerImgAvg2, spinnerImgEng2, spinnerImgExp2}); - jPanel10Layout.setVerticalGroup( - jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel10Layout.createSequentialGroup() + panelSecondImageLayout.setVerticalGroup( + panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelSecondImageLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(spinnerImgExp2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) .addComponent(spinnerImgAvg2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel19) + .addGroup(panelSecondImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelImgEng2) .addComponent(spinnerImgEng2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(25, Short.MAX_VALUE)) ); + checkImgAutosave.setSelected(true); + checkImgAutosave.setText("Autosave"); + + jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel20.setText("Measurements:"); + jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel21.setText("Method:"); + labelSwitching.setText("Switching:"); + + comboSwitch.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + spinnerImgMeasurements.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10000, 1)); comboImgMethod.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); @@ -818,123 +925,152 @@ public class Eiger extends Panel { } }); - jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel20.setText("Measurements:"); + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(labelSwitching) + .addComponent(jLabel21) + .addComponent(jLabel20)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.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)) + .addContainerGap()) + ); - checkImgAutosave.setSelected(true); - checkImgAutosave.setText("Autosave"); + jPanel5Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {checkImgAutosave, comboImgMethod, comboSwitch, spinnerImgMeasurements}); - labelSwitching.setText("Switching:"); - - comboSwitch.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - - deviceValuePanel11.setDeviceName("id1_pol"); - - jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel22.setText("Mode ID1:"); - - jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel28.setText("Mode ID2:"); - - deviceValuePanel12.setDeviceName("id2_pol"); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(comboImgMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel21)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.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)) + .addGap(6, 6, 6) + .addGroup(jPanel5Layout.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)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(checkImgAutosave) + .addContainerGap()) + ); javax.swing.GroupLayout panelImgControlsLayout = new javax.swing.GroupLayout(panelImgControls); panelImgControls.setLayout(panelImgControlsLayout); panelImgControlsLayout.setHorizontalGroup( panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelImgControlsLayout.createSequentialGroup() - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel28, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(panelImgControlsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(labelSwitching) - .addComponent(jLabel21) - .addComponent(jLabel20))) - .addGroup(panelImgControlsLayout.createSequentialGroup() - .addGap(22, 22, 22) - .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .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) - .addComponent(deviceValuePanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(deviceValuePanel12, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addContainerGap() + .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) + .addComponent(panelFirstImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .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) - .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(panelSecondImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); - panelImgControlsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {checkImgAutosave, comboImgMethod, comboSwitch, spinnerImgMeasurements}); + panelImgControlsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {panelFirstImage, panelSecondImage}); panelImgControlsLayout.setVerticalGroup( panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelImgControlsLayout.createSequentialGroup() .addContainerGap() - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(panelImgControlsLayout.createSequentialGroup() - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(comboImgMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel21)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .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)) - .addGap(6, 6, 6) - .addGroup(panelImgControlsLayout.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)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(checkImgAutosave)) - .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(24, 24, 24) - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(jLabel22) - .addComponent(deviceValuePanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(jLabel28) - .addComponent(deviceValuePanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(34, Short.MAX_VALUE)) + .addGroup(panelImgControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelFirstImage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(panelSecondImage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) ); + panelImgControlsLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jPanel5, panelFirstImage, panelSecondImage}); + + deviceValuePanel12.setDeviceName("id2_pol"); + + jLabel32.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel32.setText("Energy:"); + + jLabel28.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel28.setText("Mode ID2:"); + + deviceValuePanel2.setDeviceName("energy"); + + deviceValuePanel11.setDeviceName("id1_pol"); + + jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel22.setText("Mode ID1:"); + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelImgControls, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(buttonImgStart) - .addGap(76, 76, 76) - .addComponent(buttonImgAbort) - .addGap(0, 0, Short.MAX_VALUE))) + .addGap(35, 35, 35) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(buttonImgStart) + .addGap(76, 76, 76) + .addComponent(buttonImgAbort) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel32) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel28, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(deviceValuePanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(deviceValuePanel12, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonImgAbort, buttonImgStart}); + jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deviceValuePanel11, deviceValuePanel12, deviceValuePanel2}); + jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .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.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel22) + .addComponent(deviceValuePanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel28) + .addComponent(deviceValuePanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel32) + .addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonImgStart) .addComponent(buttonImgAbort)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deviceValuePanel11, deviceValuePanel12, deviceValuePanel2}); + jTabbedPane1.addTab("2-Images", jPanel2); jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); @@ -997,33 +1133,65 @@ public class Eiger extends Panel { } }); + buttonOpen.setText("Open"); + buttonOpen.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonOpenActionPerformed(evt); + } + }); + + buttonSave.setText("Save"); + buttonSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonSaveActionPerformed(evt); + } + }); + + buttonClear.setText("Clear"); + buttonClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonClearActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addGroup(jPanel4Layout.createSequentialGroup() - .addComponent(buttonAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE) - .addComponent(buttonRemove))) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonAdd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonRemove, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonOpen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonClear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); - jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAdd, buttonRemove}); + jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAdd, buttonOpen, buttonRemove, buttonSave}); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(buttonAdd) - .addComponent(buttonRemove)) - .addContainerGap()) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(buttonAdd) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonRemove) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonClear) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonOpen) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonSave) + .addGap(21, 21, 21)))) ); javax.swing.GroupLayout panelSpectrumLayout = new javax.swing.GroupLayout(panelSpectrum); @@ -1045,7 +1213,7 @@ public class Eiger extends Panel { .addComponent(spinnerSpecScans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerSpecExp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spinnerSpecAvg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -1096,6 +1264,21 @@ public class Eiger extends Panel { } }); + jLabel33.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel33.setText("Mode ID1:"); + + deviceValuePanel13.setDeviceName("id1_pol"); + + deviceValuePanel14.setDeviceName("id2_pol"); + + jLabel34.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel34.setText("Mode ID2:"); + + jLabel35.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel35.setText("Energy:"); + + deviceValuePanel3.setDeviceName("energy"); + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( @@ -1103,37 +1286,66 @@ public class Eiger extends Panel { .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(panelSpectrum, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(buttonSpecStart) .addGap(76, 76, 76) .addComponent(buttonSpecAbort) - .addGap(0, 0, Short.MAX_VALUE))) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(panelSpectrum, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(35, 35, 35) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel35) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel34, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel33, javax.swing.GroupLayout.Alignment.LEADING))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(deviceValuePanel14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(deviceValuePanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) + .addComponent(deviceValuePanel13, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonSpecAbort, buttonSpecStart}); + jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deviceValuePanel13, deviceValuePanel14, deviceValuePanel3}); + jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(panelSpectrum, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(76, 76, 76) + .addGap(18, 18, 18) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel33) + .addComponent(deviceValuePanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel34) + .addComponent(deviceValuePanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel35) + .addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonSpecStart) .addComponent(buttonSpecAbort)) - .addGap(73, 73, 73)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deviceValuePanel13, deviceValuePanel14, deviceValuePanel3}); + jTabbedPane1.addTab("Absorption Spectrum", jPanel3); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 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, 680, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1209,13 +1421,13 @@ public class Eiger extends Panel { private void buttonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoveActionPerformed int row = tableRegions.getSelectedRow(); - if (row>=0){ + if (row >= 0) { modelRegions.removeRow(row); } }//GEN-LAST:event_buttonRemoveActionPerformed private void buttonSetNormActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetNormActionPerformed - try{ + try { JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getContext().getConfig().dataPath)); FileNameExtensionFilter filter = new FileNameExtensionFilter("Image File", "tif", "tiff"); chooser.setFileFilter(filter); @@ -1226,9 +1438,9 @@ public class Eiger extends Panel { textNorm.setText(chooser.getSelectedFile().getAbsoluteFile().toString()); this.setSetting("NORM_FILE", textNorm.getText()); } - } catch (Exception ex){ - showException (ex); - } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_buttonSetNormActionPerformed private void textNormKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNormKeyReleased @@ -1240,24 +1452,24 @@ public class Eiger extends Panel { }//GEN-LAST:event_textNormKeyTyped private void buttonShowDetectorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowDetectorPanelActionPerformed - try{ + try { this.showDevicePanel("eiger"); - } catch (Exception ex){ - showException (ex); + } 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()); + try { + this.enableNorm(buttonShowNorm.isSelected()); buttonShowNorm.setText(buttonShowNorm.isSelected() ? "Hide" : "Show"); - } catch (Exception ex){ - showException (ex); + } catch (Exception ex) { + showException(ex); } }//GEN-LAST:event_buttonShowNormActionPerformed private void textSelectOutliersMaskActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textSelectOutliersMaskActionPerformed - try{ + try { JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getContext().getConfig().dataPath)); FileNameExtensionFilter filter = new FileNameExtensionFilter("Image File", "tif", "tiff"); chooser.setFileFilter(filter); @@ -1268,9 +1480,9 @@ public class Eiger extends Panel { textOutliersMask.setText(chooser.getSelectedFile().getAbsoluteFile().toString()); this.setSetting("OUTLIERS_MASK_FILE", textOutliersMask.getText()); } - } catch (Exception ex){ - showException (ex); - } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_textSelectOutliersMaskActionPerformed private void textOutliersMaskKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textOutliersMaskKeyTyped @@ -1282,38 +1494,137 @@ public class Eiger extends Panel { }//GEN-LAST:event_textOutliersMaskKeyReleased private void textClearOutliersMaskActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textClearOutliersMaskActionPerformed - try{ + try { setSetting("OUTLIERS_MASK_FILE", null); textOutliersMask.setText(""); - } catch (Exception ex){ - showException (ex); - } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_textClearOutliersMaskActionPerformed private void spinnerOutliersThresholdStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerOutliersThresholdStateChanged - try{ + try { setSetting("OUTLIERS_THRESHOLD", spinnerOutliersThreshold.getValue()); - } catch (Exception ex){ - showException (ex); - } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_spinnerOutliersThresholdStateChanged private void buttonMeasurementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMeasurementsActionPerformed - try{ + try { evalAsync(buttonMeasurements.isSelected() ? "start_measurements()" : "stop_measurements()"); - } catch (Exception ex){ - showException (ex); - } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_buttonMeasurementsActionPerformed + private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed + try { + JFileChooser chooser = new JFileChooser(ABSORTION_SPECTRUM_PATH); + FileNameExtensionFilter filter = new FileNameExtensionFilter("Absortion Spectrum scan definition file", ABSORTION_SPECTRUM_EXT); + chooser.setFileFilter(filter); + int rVal = chooser.showOpenDialog(this); + if (rVal == JFileChooser.APPROVE_OPTION) { + Object[] obj = (Object[]) Serializer.decode(Files.readAllBytes(chooser.getSelectedFile().toPath()), Serializer.EncoderType.bin); + Object[][] table = (Object[][]) obj[0]; + modelRegions.setDataVector(table, SwingUtils.getTableColumnNames(tableRegions)); + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonOpenActionPerformed + + private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed + try { + JFileChooser chooser = new JFileChooser(ABSORTION_SPECTRUM_PATH); + FileNameExtensionFilter filter = new FileNameExtensionFilter("Absortion Spectrum scan definition file", ABSORTION_SPECTRUM_EXT); + chooser.setFileFilter(filter); + int rVal = chooser.showSaveDialog(this); + if (rVal == JFileChooser.APPROVE_OPTION) { + File f = chooser.getSelectedFile(); + if (IO.getExtension(f).isEmpty()) { + f = new File(f.getPath() + "." + ABSORTION_SPECTRUM_EXT); + } + Object[] obj = new Object[]{SwingUtils.getTableData(tableRegions)}; + Files.write(f.toPath(), Serializer.encode(obj, Serializer.EncoderType.bin)); + + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonSaveActionPerformed + + private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed + try { + modelRegions.setNumRows(0); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonClearActionPerformed + + private void buttonRoiClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiClearActionPerformed + try { + clearRois(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonRoiClearActionPerformed + + private void buttonRoiSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiSaveActionPerformed + try { + JFileChooser chooser = new JFileChooser(ROIS_PATH); + FileNameExtensionFilter filter = new FileNameExtensionFilter("ROIs definition file", ROIS_EXT); + chooser.setFileFilter(filter); + int rVal = chooser.showSaveDialog(this); + if (rVal == JFileChooser.APPROVE_OPTION) { + File f = chooser.getSelectedFile(); + if (IO.getExtension(f).isEmpty()) { + f = new File(f.getPath() + "." + ROIS_EXT); + } + Object[] obj = new Object[]{SwingUtils.getTableData(tableRoi)}; + Files.write(f.toPath(), Serializer.encode(obj, Serializer.EncoderType.bin)); + + } + } catch (Exception ex) { + showException(ex); + } }//GEN-LAST:event_buttonRoiSaveActionPerformed + + private void buttonRoiOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiOpenActionPerformed + try { + JFileChooser chooser = new JFileChooser(ROIS_PATH); + FileNameExtensionFilter filter = new FileNameExtensionFilter("ROIs definition file", ROIS_EXT); + chooser.setFileFilter(filter); + int rVal = chooser.showOpenDialog(this); + if (rVal == JFileChooser.APPROVE_OPTION) { + Object[] obj = (Object[]) Serializer.decode(Files.readAllBytes(chooser.getSelectedFile().toPath()), Serializer.EncoderType.bin); + Object[][] table = (Object[][]) obj[0]; + clearRois(); + for (Object[] row : table) { + Point pos = new Point((Integer)row[1], (Integer)row[2]); + Dimension size = new Dimension((Integer)row[3], (Integer)row[4]); + Rect roi = new Rect(null, pos, size); + addRoi(roi); + } + } + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonRoiOpenActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAdd; + private javax.swing.JButton buttonClear; private javax.swing.JButton buttonImgAbort; private javax.swing.JButton buttonImgStart; private javax.swing.JToggleButton buttonMeasurements; + private javax.swing.JButton buttonOpen; private javax.swing.JButton buttonRemove; private javax.swing.JButton buttonRoiAdd; + private javax.swing.JButton buttonRoiClear; + private javax.swing.JButton buttonRoiOpen; private javax.swing.JButton buttonRoiRemove; + private javax.swing.JButton buttonRoiSave; + private javax.swing.JButton buttonSave; private javax.swing.JButton buttonSetNorm; private javax.swing.JButton buttonShowDetectorPanel; private javax.swing.JToggleButton buttonShowNorm; @@ -1329,10 +1640,13 @@ public class Eiger extends Panel { private javax.swing.JComboBox<String> comboSwitch; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel11; private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel12; - private javax.swing.JLabel jLabel11; + private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel13; + private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel14; + private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2; + private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel3; + private javax.swing.Box.Filler filler1; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel17; - private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; @@ -1344,22 +1658,29 @@ public class Eiger extends Panel { private javax.swing.JLabel jLabel29; private javax.swing.JLabel jLabel30; private javax.swing.JLabel jLabel31; + private javax.swing.JLabel jLabel32; + private javax.swing.JLabel jLabel33; + private javax.swing.JLabel jLabel34; + private javax.swing.JLabel jLabel35; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel10; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel5; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JLabel labelImgEng1; + private javax.swing.JLabel labelImgEng2; private javax.swing.JLabel labelSwitching; + private javax.swing.JPanel panelFirstImage; private javax.swing.JPanel panelImgControls; private javax.swing.JPanel panelNorm; private javax.swing.JPanel panelNorm1; private javax.swing.JPanel panelRoi; + private javax.swing.JPanel panelSecondImage; private javax.swing.JPanel panelSpectrum; private ch.psi.pshell.imaging.Renderer rendererRoi; private javax.swing.JSpinner spinnerImgAvg1; diff --git a/plugins/Experiment.form b/plugins/Experiment.form index 3b7684a..076acb3 100644 --- a/plugins/Experiment.form +++ b/plugins/Experiment.form @@ -28,6 +28,7 @@ </Group> <Component id="panelDataFile" alignment="0" max="32767" attributes="0"/> <Component id="jPanel6" alignment="0" max="32767" attributes="0"/> + <Component id="jPanel7" alignment="0" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> @@ -38,6 +39,8 @@ <EmptySpace min="-2" max="-2" attributes="0"/> <Component id="jPanel6" max="32767" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="jPanel7" max="32767" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> <Component id="jPanel1" max="32767" attributes="0"/> <EmptySpace type="separate" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> @@ -527,5 +530,99 @@ </Component> </SubComponents> </Container> + <Container class="javax.swing.JPanel" name="jPanel7"> + <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="Notification"/> + </Border> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="jLabel13" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="comboNotification" min="-2" max="-2" attributes="0"/> + <EmptySpace type="separate" min="-2" max="-2" attributes="0"/> + <Component id="jLabel14" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="textRecipients" max="32767" attributes="0"/> + <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> + <Component id="buttonNotificationApply" linkSize="11" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="buttonNotificationUndo" linkSize="11" 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="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel14" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="textRecipients" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="buttonNotificationApply" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="buttonNotificationUndo" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="comboNotification" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel13"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Mode:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel14"> + <Properties> + <Property name="horizontalAlignment" type="int" value="11"/> + <Property name="text" type="java.lang.String" value="Recipients:"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="textRecipients"> + </Component> + <Component class="javax.swing.JComboBox" name="comboNotification"> + <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="<String>"/> + </AuxValues> + </Component> + <Component class="javax.swing.JButton" name="buttonNotificationApply"> + <Properties> + <Property name="text" type="java.lang.String" value="Set"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonNotificationApplyActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="buttonNotificationUndo"> + <Properties> + <Property name="text" type="java.lang.String" value="Undo"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonNotificationUndoActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> </SubComponents> </Form> diff --git a/plugins/Experiment.java b/plugins/Experiment.java index 29aeb60..b594d9c 100644 --- a/plugins/Experiment.java +++ b/plugins/Experiment.java @@ -1,7 +1,10 @@ +import ch.psi.pshell.core.Configuration.NotificationLevel; import ch.psi.pshell.ui.Panel; import ch.psi.utils.State; import ch.psi.utils.swing.SwingUtils; +import ch.psi.utils.swing.SwingUtils.OptionResult; +import ch.psi.utils.swing.SwingUtils.OptionType; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; @@ -18,6 +21,7 @@ public class Experiment extends Panel { public Experiment() { initComponents(); updateRsync(); + SwingUtils.setEnumCombo(comboNotification, NotificationLevel.class); } //Overridable callbacks @@ -31,7 +35,8 @@ public class Experiment extends Panel { @Override public void onStateChange(State state, State former) { - updateControls(); + updateControls(); + updateNotify(); } @Override @@ -93,11 +98,11 @@ public class Experiment extends Panel { undo(); } - boolean updatingRsync; + boolean updatingControls; void updateRsync() { try { - updatingRsync = true; + updatingControls = true; String user = null; String host = null; String path = null; @@ -122,9 +127,21 @@ public class Experiment extends Panel { buttonSetFolder.setEnabled(false); } finally { - updatingRsync = false; + updatingControls = false; } } + + void updateNotify() { + try { + updatingControls = true; + comboNotification.setSelectedItem(getContext().getConfig().notificationLevel); + textRecipients.setText(getContext().getNotificationManager().getConfig().to); + } finally { + updatingControls = false; + } + } + + void updateControls() { boolean editable = getState().isInitialized() && !getState().isProcessing(); @@ -183,6 +200,13 @@ public class Experiment extends Panel { textRsyncHost = new javax.swing.JTextField(); checkRsyncRemove = new javax.swing.JCheckBox(); buttonUndoFolder = new javax.swing.JButton(); + jPanel7 = new javax.swing.JPanel(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + textRecipients = new javax.swing.JTextField(); + comboNotification = new javax.swing.JComboBox<>(); + buttonNotificationApply = new javax.swing.JButton(); + buttonNotificationUndo = new javax.swing.JButton(); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Metadata")); @@ -520,6 +544,66 @@ public class Experiment extends Panel { .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Notification")); + + jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel13.setText("Mode:"); + + jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + jLabel14.setText("Recipients:"); + + comboNotification.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + buttonNotificationApply.setText("Set"); + buttonNotificationApply.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonNotificationApplyActionPerformed(evt); + } + }); + + buttonNotificationUndo.setText("Undo"); + buttonNotificationUndo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonNotificationUndoActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); + jPanel7.setLayout(jPanel7Layout); + jPanel7Layout.setHorizontalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(comboNotification, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(jLabel14) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textRecipients) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonNotificationApply) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonNotificationUndo) + .addContainerGap()) + ); + + jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonNotificationApply, buttonNotificationUndo}); + + jPanel7Layout.setVerticalGroup( + jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel7Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel13) + .addComponent(jLabel14) + .addComponent(textRecipients, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(buttonNotificationApply) + .addComponent(buttonNotificationUndo) + .addComponent(comboNotification, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -535,6 +619,7 @@ public class Experiment extends Panel { .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(panelDataFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonClear, buttonUndo}); @@ -547,6 +632,8 @@ public class Experiment extends Panel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -639,7 +726,13 @@ public class Experiment extends Panel { }//GEN-LAST:event_textNamePatternKeyReleased private void checkRsyncEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkRsyncEnableActionPerformed - if (!updatingRsync) { + if (!updatingControls) { + if (!checkRsyncEnable.isSelected()) { + if (SwingUtils.showOption(getTopLevel(), "Disable Data Transfer", "Do you want to disable data transfer and remove the user authentication?", OptionType.YesNo) != OptionResult.Yes) { + updateRsync(); + return; + } + } try { setSetting("RSYNC_USER", ""); //setSetting("RSYNC_PATH", ""); @@ -698,7 +791,7 @@ public class Experiment extends Panel { }//GEN-LAST:event_buttonSetFolderActionPerformed private void checkRsyncRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkRsyncRemoveActionPerformed - if (!updatingRsync) { + if (!updatingControls) { try { setSetting("RSYNC_DEL", checkRsyncRemove.isSelected()); } catch (Exception ex) { @@ -720,10 +813,37 @@ public class Experiment extends Panel { buttonSetFolder.setEnabled(checkRsyncEnable.isSelected()); }//GEN-LAST:event_textRsyncPathKeyReleased + private void buttonNotificationUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonNotificationUndoActionPerformed + try { + updateNotify(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonNotificationUndoActionPerformed + + private void buttonNotificationApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonNotificationApplyActionPerformed + try { + NotificationLevel level = (NotificationLevel) comboNotification.getSelectedItem(); + String to = textRecipients.getText().trim(); + if (level!=NotificationLevel.Off){ + if (to.isEmpty()){ + throw new Exception("To enable notifications please set the recepient list."); + } + } + getContext().getConfig().notificationLevel =level; + getContext().getNotificationManager().setRecipients(to.split(";")); + getContext().getNotificationManager().initialize(); //Remove this when fix setRecipients + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonNotificationApplyActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonApply; private javax.swing.JButton buttonClear; private javax.swing.JButton buttonDefaultPath; + private javax.swing.JButton buttonNotificationApply; + private javax.swing.JButton buttonNotificationUndo; private javax.swing.JButton buttonSetFolder; private javax.swing.JButton buttonSetPath; private javax.swing.JButton buttonSetSeq; @@ -733,9 +853,12 @@ public class Experiment extends Panel { private javax.swing.JButton buttonUndoSeq; private javax.swing.JCheckBox checkRsyncEnable; private javax.swing.JCheckBox checkRsyncRemove; + private javax.swing.JComboBox<String> comboNotification; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; @@ -746,6 +869,7 @@ public class Experiment extends Panel { private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel6; + private javax.swing.JPanel jPanel7; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JPanel panelDataFile; private javax.swing.JSpinner spinnerSeq; @@ -755,6 +879,7 @@ public class Experiment extends Panel { private javax.swing.JTextField textPGroup; private javax.swing.JTextField textProposal; private javax.swing.JTextField textProposer; + private javax.swing.JTextField textRecipients; private javax.swing.JTextField textRsyncHost; private javax.swing.JTextField textRsyncPath; private javax.swing.JTextField textRsyncUser; diff --git a/script/devices/eiger.py b/script/devices/eiger.py index 9abb2bd..99a951f 100644 --- a/script/devices/eiger.py +++ b/script/devices/eiger.py @@ -5,8 +5,9 @@ import ch.psi.pshell.imaging.Pen as Pen import java.awt.Rectangle as Rectangle import ch.psi.pshell.imaging.Data as Data import ch.psi.pshell.device.Camera.DataType as DataType +import ch.psi.utils.Chrono as Chrono - +CONTINOUS_MODE_MIN_TIME = 4000 ############################################################################### # ROI Integration ############################################################################### @@ -179,31 +180,111 @@ def trigger_eiger(wait=False): if wait: eiger.waitNewImage(20000) - -def set_exposure_time(exposure): - if exposure == eiger.getExposure(): - return +def get_eiger_exposure_readback(): + return caget("X11MA-ES1-SD1:cam1:AcquireTime_RBV",'f') + +def set_exposure_time(value, check = True, retries=3): + if value == eiger.getExposure(): + return started = eiger.isStarted() if started: - eiger.stop() - time.sleep(0.2) - eiger.setExposure(exposure) + stop_eiger() + for i in range(retries): + try: + eiger.setExposure(value) + if check: + readback=get_eiger_exposure_readback() + if abs(value - readback) > 0.01: + raise Exception("Error changing Eiger exposure time to %f: readback=%f" % (value, readback)) + except: + if i==(retries-1): + raise + else: + print "Error changing Eiger exposure time: retrying" + time.sleep(0.3) + if started: if eiger.grabMode==eiger.GrabMode.Continuous: eiger.start() +def get_eiger_number_of_frames(): + return caget("X11MA-ES1-SD1:cam1:NumFrames_RBV",'i') -def restore_eiger(): +def set_eiger_number_of_frames(value, check = True): + if value == get_eiger_number_of_frames(): + return + started = eiger.isStarted() + if started: + stop_eiger() + + caput("X11MA-ES1-SD1:cam1:NumFrames",value) + if check: + readback = get_eiger_number_of_frames() + if value != readback: + raise Exception("Error changing Eiger number of frames to %d: readback=%d" % (value, readback)) + + if started: + if eiger.grabMode==eiger.GrabMode.Continuous: + eiger.start() + + + #Wait for channel to chenge + +def stop_eiger(): + global chrono_eiger + chrono_eiger.waitTimeout(CONTINOUS_MODE_MIN_TIME) + started = eiger.isStarted() + if started: + eiger.stop() + eiger.grabMode=eiger.GrabMode.Single + eiger.stop() + time.sleep(0.3) + if eiger.acquire.read() >0: + raise Exception("Error stopping Eiger") + +chrono_eiger = Chrono() + +def init_eiger(exposure=None, check=True, retries=2): + """ + Set Eiger scan mode + """ + global chrono_eiger + chrono_eiger.waitTimeout(CONTINOUS_MODE_MIN_TIME) + for i in range(retries): + try: + stop_eiger() #Set mode single + eiger.setNumImages(1)# Is it relevant? + set_eiger_number_of_frames(1) + if exposure: + set_exposure_time(exposure, check) + break + except: + if i==(retries-1): + raise + else: + print "Error initializing Eiger, retrying: " + str(sys.exc_info()[1]) + +def restore_eiger(check=True, retries=2): """ Set Eiger default mode """ - if eiger.isStarted(): - eiger.stop() - time.sleep(0.2) - eiger.grabMode=eiger.GrabMode.Continuous - eiger.setExposure(0.2) - eiger.setNumImages(1) - eiger.start() + global chrono_eiger + for i in range(retries): + try: + stop_eiger() + eiger.setNumImages(1)# Is it relevant? + set_eiger_number_of_frames(1, check) + set_exposure_time(0.2, check) + eiger.grabMode=eiger.GrabMode.Continuous + eiger.start() + chrono_eiger = Chrono() + break + except: + if i==(retries-1): + raise + else: + print "Error restoring Eiger, retrying " + str(sys.exc_info()[1]) + _outliers_mask_timestamp = 0 _outliers_mask = None diff --git a/script/devices/id.py b/script/devices/id.py index c12be89..0599545 100644 --- a/script/devices/id.py +++ b/script/devices/id.py @@ -96,17 +96,20 @@ def put_id_pol(id, pol, alpha=None): elif pol == 2: mode_dev.write("CIRC -") elif pol == 3: - mode_dev.write("LINEAR") - time.sleep(0.5) + if mode_dev.read() != "LINEAR": + mode_dev.write("LINEAR") + time.sleep(0.5) alpha_dev.write(0) elif pol == 4: - mode_dev.write("LINEAR") - time.sleep(0.5) + if mode_dev.read() != "LINEAR": + mode_dev.write("LINEAR") + time.sleep(0.5) alpha_dev.write(90) elif pol == 5: - mode_dev.write("LINEAR") - if alpha is not None: + if mode_dev.read() != "LINEAR": + mode_dev.write("LINEAR") time.sleep(0.5) + if alpha is not None: alpha_dev.write(alpha) @@ -153,3 +156,90 @@ class EnOptDesc(ReadonlyRegisterBase): add_device(EnOptDesc(), True) energy_opt_desc.setPolling(2000) + + +#Polarizarion Switch Tools + +_switching_type = None +_switching_active_id = None +_switching_current_pol = None +_switching_pol_id1 = None +_switching_pol_id2 = None +_switching_id = None + + +def init_pol_switch(switching_type, sid = None, pol_id1=None, pol_id2=None): + global _switching_type, _switching_active_id, _switching_current_pol, _switching_pol_id1, _switching_pol_id2, _switching_id + if sid is None: + sid = get_setting("ID") + if pol_id1 is None: + #pol_id1 = POL_IDS[get_setting("POL_ID_1")] #From config + pol_id1=get_id_pol(1) #Current + if pol_id2 is None: + #pol_id2 =POL_IDS[get_setting("POL_ID_2")] #From config + pol_id2 =get_id_pol(2) #Current + _switching_type = switching_type + _switching_id =sid + _switching_pol_id1=pol_id1 + _switching_pol_id2=pol_id2 + print "Init pol switch: %s id:%s pol_id1:%s pol_id2:%s" %(_switching_type, _switching_id, _switching_pol_id1, _switching_pol_id2) + _switching_active_id = 1 + if _switching_id == "ID1": + _switching_current_pol = _switching_pol_id1 + elif _switching_id == "ID2": + _switching_current_pol = _switching_pol_id2 + elif _switching_id == "ID1_ID2": + _switching_current_pol=_switching_pol_id1 + + if switching_type == "Tune_Detune": + tune_detune(1) #Tune ID1, Detune ID2 + else: + if _switching_id == "ID1_ID2": + put_id_pol(2, _switching_current_pol) #Force both IDs to same polarization + wait_channel("X11PHS:alldone", 1) + + +def nextpol(): + global _switching_type, _switching_active_id, _switching_current_pol, _switching_pol_id1, _switching_pol_id2 + if _switching_type == "Normal": + if _switching_current_pol==1: return 2 #circ+ -> circ- + elif _switching_current_pol==2: return 1 #circ+ -> circ- + elif _switching_current_pol==3: return 4 #lin hor -> lin vert + elif _switching_current_pol==4: return 3 #lin vert -> lin hor + elif _switching_current_pol==5: return5 #lin rot -> lin rot + else: raise "Invalid pol: " + str(_switching_current_pol) + elif _switching_type == "Tune_Detune": + if _switching_active_id==1: return _switching_pol_id2 + elif _switching_active_id==2: return _switching_pol_id1 + else: raise "Invalid ID: " + str(_switching_active_id) + else: raise "Invalid switching: " + str(_switching_type) + +def switch_pol(): + global _switching_type, _switching_active_id, _switching_current_pol, _switching_pol_id1, _switching_pol_id2, _switching_id + if DRY_RUN: + return + newpol=nextpol() + print "Switch pol: ", newpol + if _switching_id == "ID1": + put_id_pol(1,newpol) + elif _switching_id == "ID2": + put_id_pol(2,newpol) + elif ID == "ID1_ID2": + if _switching_type == "Normal": + put_id_pol(1, newpol) + put_id_pol(2, newpol) + elif _switching_type == "Tune_Detune": + if _switching_active_id==1: + _switching_active_id=2 + else: + _switching_active_id=1 + tune_detune(_switching_active_id) + + if _switching_type == "Normal": + _switching_current_pol = newpol + + time.sleep(1.0) + wait_channel("X11PHS:alldone", 1) + +def get_cur_pol(): + return _switching_current_pol \ No newline at end of file diff --git a/script/local.py b/script/local.py index 7675e3f..c6987a4 100644 --- a/script/local.py +++ b/script/local.py @@ -409,7 +409,7 @@ def write_logfile(msg): """ def put_energy(v): - if DRY_RUN: return + if get_dry_run(): return if v>91 and v<2500: caput("X11PHS:alldone",0) caput("X11PHS-E:GO.A",v) @@ -423,7 +423,7 @@ def is_done(): return True if caget("X11PHS:alldone") else False def wait_done(): - if DRY_RUN: return + if get_dry_run(): return time.sleep(1.0) #in order to reduce trafic on the IOC wait_channel("X11PHS:alldone", 1) """ @@ -434,6 +434,13 @@ def put_energy(v): wait_channel(ALL_DONE, 1, type = 'i') +def change_energy(v): + if v<91 or v>2500: + raise Exception ("Invalid energy: " + str(v)) + if DRY_RUN: + return + put_energy(v) + ################################################################################################### #Image measurements ################################################################################################### @@ -560,7 +567,80 @@ def play_sound(name): Audio.playFile(File(get_context().setup.expandPath("{home}/sounds/" + name + ".wav")), False) except: log("Error playing sound " + name + ": " + str(sys.exc_info()[1]), False) - + + +################################################################################################### +#Beamline setup +################################################################################################### + +def apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2): + if get_dry_run(): + return + + 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, ALPHA_ID_1 if (POL_ID_1=="Lin") else None ) + caput('X11MA-ID2-GAP:SET',100) #open Gap ID2 + id1_harmonic.write(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, ALPHA_ID_2 if (POL_ID_2=="Lin") else None ) + caput('X11MA-ID1-GAP:SET',100) #open Gap ID1 + id2_harmonic.write(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, ALPHA_ID_1 if (POL_ID_1=="Lin") else None ) + put_id_pol(2,POL_ID_2, ALPHA_ID_2 if (POL_ID_2=="Lin") else None ) + #current_pol=polID1 + id1_harmonic.write(int(HARMONIC_ID_1)) + id2_harmonic.write(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 + + #wait_channel("X11PHS:alldone", 1) + energy.write(ENERGY) + wait_channel("X11PHS:alldone", 1) + +def set_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2): + 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) + apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2) + +#Restore beamline initial config +def restore_beamline_setup(): + ID = get_setting("ID") + ENERGY = float(get_setting("ENERGY")) + POL_ID_1 = get_setting("POL_ID_1") + ALPHA_ID_1 = float(get_setting("ALPHA_ID_1")) + HARMONIC_ID_1 = get_setting("HARMONIC_ID_1") + OFFSET_ID_1 = float(get_setting("OFFSET_ID_1")) + POL_ID_2 = get_setting("POL_ID_2") + ALPHA_ID_2 = float(get_setting("ALPHA_ID_2")) + HARMONIC_ID_2 = get_setting("HARMONIC_ID_2") + OFFSET_ID_2 = float(get_setting("OFFSET_ID_2")) + apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2) + + ################################################################################################### #Settings ################################################################################################### diff --git a/script/templates/Eiger2Img.py b/script/templates/Eiger2Img.py index 5dfd925..26cdf03 100644 --- a/script/templates/Eiger2Img.py +++ b/script/templates/Eiger2Img.py @@ -13,11 +13,11 @@ if get_exec_pars().source == CommandSource.ui: AVERAGE_2 = 2.0 ENERGY_2= 900.0 #POLARIZATION_2 = "Circ_Minus" - + DRY_RUN = get_dry_run() SHOW_IMAGES = True -SAVE_DIAGS = True +SAVE_DIAGS = False ID = get_setting("ID") @@ -98,78 +98,14 @@ def assert_status_ok(): if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true": open_vg10() - -active_id = 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": - current_pol = pol_id1 - elif ID == "ID2": - current_pol = pol_id2 - elif ID == "ID1_ID2": - current_pol=pol_id1 - if SWITCHING == "Tune_Detune": - tune_detune(1) #Tune ID1, Detune ID2 - else: - if ID == "ID1_ID2": - put_id_pol(2, current_pol) #Force both IDs to same polarization - wait_channel("X11PHS:alldone", 1) + init_pol_switch(SWITCHING) def imageinfo(info): pass - -#Beamline setting -def nextpol(): - 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- - 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 pol_id2 - if active_id==2: return pol_id1 - - -def switch_pol(): - global active_id - if DRY_RUN: - return - newpol=nextpol() - if ID == "ID1": - put_id_pol(1,newpol) - elif ID == "ID2": - put_id_pol(2,newpol) - 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: - active_id=2 - else: - active_id=1 - tune_detune(active_id) - time.sleep(1.0) - wait_channel("X11PHS:alldone", 1) - -def change_energy(v): - if v<91 or v>2500: - raise Exception ("Invalid energy: " + str(v)) - if DRY_RUN: - return - put_energy(v) - - - def save_image_file(frame, cycle=-1, frame_index=0): if SHOW_IMAGES: plot(frame.matrix if (type(frame) == Data) else get_ip_array(frame), name = get_image_file_name(cycle, frame_index, True)) @@ -181,10 +117,8 @@ def save_image_file(frame, cycle=-1, frame_index=0): print filename # log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0")) -eiger.stop() -eiger.grabMode=eiger.GrabMode.Single -time.sleep(0.3) - +init_eiger() +#print "Startup time: " + str(time.time() - start) try: #Do the measurement loop for cycle in range(1, MEASUREMENTS + 1): @@ -201,7 +135,9 @@ try: assert_status_ok() set_exposure_time(EXPOSURE[i]) print "--- Grabing " + str(AVERAGE[i])+ " frames - cycle: " + str(cycle) + " step: " + str(i) + #s=time.time() ret = grab_frames(image, AVERAGE[i], roi=None, wait_next=True) + #print "--- Time: " + str(time.time() - s) frames.append(average_frames(ret) if AVERAGE[i] > 1 else ret[0]) imageinfo("I") save_image_file(frames[i], cycle, i) @@ -218,8 +154,8 @@ try: change_energy(ENERGY_2) #time.sleep(1) - if (METHOD == "Two_Pol") or (METHOD == "Two_Energies"): - if (METHOD == "Two_Energies") or ((current_pol == 2) or (current_pol==3)): + if (METHOD == "Two_Pol") or (METHOD == "Two_Energies"): + if (METHOD == "Two_Energies") or (get_cur_pol() in (2,3)): ###??? autocontrast??? frames.append(frames[0].copy()) frames[2].div(frames[1]) diff --git a/script/templates/EigerAbsSpec.py b/script/templates/EigerAbsSpec.py index a362f68..2f95069 100644 --- a/script/templates/EigerAbsSpec.py +++ b/script/templates/EigerAbsSpec.py @@ -13,6 +13,10 @@ if get_exec_pars().source == CommandSource.ui: DRY_RUN = get_dry_run() SAVE_DIAGS = True +if SWITCH_POL: + init_pol_switch("Normal") + + log("ROIs: " + str(ROI)) if len(RANGES) == 0: @@ -20,10 +24,7 @@ if len(RANGES) == 0: start = time.time() -eiger.stop() -eiger.grabMode=eiger.GrabMode.Single -time.sleep(0.3) -set_exposure_time(EXPOSURE) +init_eiger(exposure=EXPOSURE) #set_exec_pars(path="{data}/{year}_{month}/{date}/{seq}%03d_AbsortionSpectrum", format="csv", layout="table") set_exec_pars(name="AbsortionSpectrum", format="csv", layout="table") @@ -88,7 +89,6 @@ if not DRY_RUN and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true": #put_id_offset(2, OFFSET_ID_2) #offset on ID2 - """ if ID == "ID1": current_pol=POL_IDS[POL_ID_1] #get_id_pol(1) @@ -106,10 +106,16 @@ elif ID == "ID1_ID2": put_id_pol(2,polID2) wait_channel("X11PHS:alldone", 1) """ - + + + +def after_pass(pass_number, scan): + if SWITCH_POL: + if pass_number<scan.numberOfPasses: + switch_pol() try: #tscan(rois, 10, 0.1, format="csv", before_read=grab_image, passes = NUMBER_SCANS, tag=tag) - rscan(sync_energy, sensors, RANGES, latency = 0.0 , passes = NUMBER_SCANS, tag=tag, before_read=grab_image, save=SAVE_SPECTRUM, split=True, keep=False) + rscan(sync_energy, sensors, RANGES, latency = 0.0 , passes = NUMBER_SCANS, tag=tag, before_read=grab_image, save=SAVE_SPECTRUM, split=True, keep=False, after_pass=after_pass) finally: if AVERAGE>1: for i in range(len(rois)): diff --git a/script/templates/SetupBeamline.py b/script/templates/SetupBeamline.py index e3f49f1..2943c4e 100644 --- a/script/templates/SetupBeamline.py +++ b/script/templates/SetupBeamline.py @@ -11,63 +11,4 @@ if get_exec_pars().source == CommandSource.ui: HARMONIC_ID_2 = 1 OFFSET_ID_2 = 0.0 -DRY_RUN = get_dry_run() - - -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) -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, ALPHA_ID_1 if (POL_ID_1=="Lin") else None ) - caput('X11MA-ID2-GAP:SET',100) #open Gap ID2 - id1_harmonic.write(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, ALPHA_ID_2 if (POL_ID_2=="Lin") else None ) - caput('X11MA-ID1-GAP:SET',100) #open Gap ID1 - id2_harmonic.write(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, ALPHA_ID_1 if (POL_ID_1=="Lin") else None ) - put_id_pol(2,POL_ID_2, ALPHA_ID_2 if (POL_ID_2=="Lin") else None ) - #current_pol=polID1 - id1_harmonic.write(int(HARMONIC_ID_1)) - id2_harmonic.write(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 - - - -#wait_channel("X11PHS:alldone", 1) - -energy.write(ENERGY) -wait_channel("X11PHS:alldone", 1) - - - - \ No newline at end of file +set_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2)