This commit is contained in:
X11MA
2016-04-01 13:36:19 +02:00
parent dd2448b42e
commit 968ebe0826
6 changed files with 1667 additions and 2 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
NewTest.java=disabled
EnergyScan_TBT.java=enabled
DelayScan.java=enabled
EnergyScan.java=enabled
Test.java=disabled
+614
View File
@@ -0,0 +1,614 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroupPlot">
</Component>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="EnergyScan_buttonGroup1"/>
</AuxValues>
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
<Component id="panelParameters" alignment="0" max="32767" attributes="0"/>
<Component id="panelSetup" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="panelSetup" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="30" max="32767" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panelParameters">
<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="Parameters"/>
</Border>
</Property>
</Properties>
<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="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="radioK1" linkSize="7" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="radioK3" linkSize="7" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel8" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerOffset1" linkSize="5" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE1" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" linkSize="2" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE2" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="spinnerOffset2" linkSize="5" alignment="1" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="comboRunType" min="-2" pref="105" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRounds" linkSize="5" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerMag" min="-2" pref="66" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerE1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerE2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerMag" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel16" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset1" alignment="3" max="32767" attributes="0"/>
<Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerOffset2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboRunType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRounds" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="radioK1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="radioK3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="E start:"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerE1">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="680.0" maximum="9999.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="E end:"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerE2">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="750.0" maximum="9999.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Time(min):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerTime">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="2.0" maximum="60.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Delay(s):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerDelay">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10.0" maximum="600.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Offset1:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerOffset1">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="20.0" minimum="-20.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel13">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Offset2:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerOffset2">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="20.0" minimum="-20.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="text" type="java.lang.String" value="Run Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboRunType">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="7">
<StringItem index="0" value="+/-"/>
<StringItem index="1" value="+"/>
<StringItem index="2" value="-"/>
<StringItem index="3" value="LH/LV"/>
<StringItem index="4" value="LH"/>
<StringItem index="5" value="LV"/>
<StringItem index="6" value="+--+/+--+"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="EnergyScan_comboRunType"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Nb of repetitions"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerRounds">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="10" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="text" type="java.lang.String" value="Plot Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="radioK1">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="K2 / K1"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 22]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioK1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioK3">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroupPlot"/>
</Property>
<Property name="text" type="java.lang.String" value="K2 / K3"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerMag">
</Component>
<Component class="javax.swing.JLabel" name="jLabel16">
<Properties>
<Property name="text" type="java.lang.String" value="B(T)"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<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="Scan Control"/>
</Border>
</Property>
</Properties>
<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="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jRadioButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="74" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jRadioButton3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="48" max="-2" attributes="0"/>
<Component id="jCheckBox4" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jSpinner1" max="32767" attributes="0"/>
<Component id="jSpinner2" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="buttonExecute" alignment="2" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="2" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<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="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel15" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonExecute" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="60" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jRadioButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jRadioButton3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="13" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonExecute">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonExecuteActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Properties>
<Property name="text" type="java.lang.String" value="set offsets"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBox1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton2">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="ID2"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton1">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="ID1"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton3">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="ID1+ID2"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox2">
<Properties>
<Property name="text" type="java.lang.String" value="Signal channel 0 p/n"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBox2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox3">
<Properties>
<Property name="text" type="java.lang.String" value="I_0 channel 2 p/n"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="ID mode"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="Data channels"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner1">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" maximum="1000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner2">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" maximum="1000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="Signal pos"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel14">
<Properties>
<Property name="text" type="java.lang.String" value="I_0 pos"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel15">
<Properties>
<Property name="text" type="java.lang.String" value="Camshaft position"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox4">
<Properties>
<Property name="text" type="java.lang.String" value="Save array data"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelSetup">
<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="Setup"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboSetup" min="-2" pref="152" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonConfigure" 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 min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboSetup" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonConfigure" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JComboBox" name="comboSetup">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboSetupActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonConfigure">
<Properties>
<Property name="text" type="java.lang.String" value="Configure"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonConfigureActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="text" type="java.lang.String" value="Element:"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
+701
View File
@@ -0,0 +1,701 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import java.awt.Component;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.DsvEditor;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.nio.file.Files;
import javax.swing.DefaultComboBoxModel;
/**
*
*/
public class EnergyScan_TBT extends Panel {
public EnergyScan_TBT() {
initComponents();
}
double energyCache = 0;
boolean restart;
@Override
public void onInitialize(int runCount) {
super.onInitialize(runCount);
loadConfig();
}
@Override
public void onStateChange(State state, State former) {
setEnabled(state == State.Ready);
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
boolean otf;
void stopScan() {
try {
getLogger().info("Stopping scan");
evalAsync("caput('START', 'STOP')");
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
}
}
Path getConfigFile() {
return Paths.get(getController().getSetup().getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;
LinePlotSeries scanSeries;
@Override
public void setEnabled(boolean value) {
super.setEnabled(value);
buttonExecute.setEnabled(value);
//buttonPlot.setEnabled(value);
checkParameterControls();
}
void checkParameterControls() {
boolean enabled;
enabled = isEnabled();
for (Component c : panelParameters.getComponents()) {
if (!(c instanceof JLabel)) {
c.setEnabled(enabled);
}
}
for (Component c : panelSetup.getComponents()) {
if (!(c instanceof JLabel)) {
c.setEnabled(enabled);
}
}
//spinnerAlpha.setEnabled(enabled && comboMode.getSelectedItem().equals("LINEAR"));
}
double last = 0;
void run() throws Exception {
HashMap args = new HashMap();
Double e1 = (Double) spinnerE1.getValue();
Double e2 = (Double) spinnerE2.getValue();
args.put("E1", (Double) spinnerE1.getValue());
args.put("E2", (Double) spinnerE2.getValue());
args.put("TIME", (Double) spinnerTime.getValue());
args.put("DELAY", (Double) spinnerDelay.getValue());
args.put("OFFSET1", (Double) spinnerOffset1.getValue());
args.put("OFFSET2", (Double) spinnerOffset2.getValue());
args.put("MAG", (Double) spinnerMag.getValue());
args.put("RUNTYPE", comboRunType.getSelectedItem().toString());
args.put("ROUNDS", (Integer) spinnerRounds.getValue());
args.put("PLOT_TYPE", radioK1.isSelected() ? 1 : 2);
args.put("SET_OFFSETS", jCheckBox1.isSelected() ? 1 : 2);
args.put("ID1", jRadioButton1.isSelected() ? 1 : 2);
args.put("ID2", jRadioButton2.isSelected() ? 1 : 2);
args.put("MCP_1", jCheckBox2.isSelected() ? 1 : 2);
args.put("MCP_2", jCheckBox3.isSelected() ? 1 : 2);
args.put("Cam_start", jSpinner1.getValue());
args.put("Cam_end", jSpinner2.getValue());
args.put("Save_array_data", jCheckBox4.isSelected() ? 1 : 2);
buttonAbort.setEnabled(true);
runAsync("EnergyScan", args).handle((ok, ex) -> {
try {
buttonAbort.setEnabled(false);
if (ex != null) {
throw ex;
} else {
}
} catch (Throwable t) {
getLogger().log(Level.WARNING, null, ex);
//showException((Exception)ex);
}
return ok;
});
if (scanPlot != null) {
scanPlot.getAxis(Plot.AxisId.X).setRange(Math.min(e1, e2), Math.max(e1, e2));
}
}
void loadConfig() {
DefaultComboBoxModel model = (DefaultComboBoxModel) comboSetup.getModel();
model.removeAllElements();
try {
for (String line : Files.readAllLines(getConfigFile())) {
if ((line != null) && (!line.trim().isEmpty())) {
String[] tokens = line.split("=");
if (tokens.length > 0) {
model.addElement(tokens[0].trim());
}
}
}
} catch (Exception ex) {
}
}
void setElement() throws Exception {
String selection = comboSetup.getSelectedItem().toString();
for (String line : Files.readAllLines(getConfigFile())) {
if ((line != null) && (!line.trim().isEmpty())) {
String[] tokens = line.split("=");
if (tokens.length < 2) {
throw new Exception("Invalid file format");
}
if (tokens[0].equals(selection)) {
tokens = tokens[1].trim().split(";");
if (tokens.length < 6) {
throw new Exception("Invalid file format");
}
spinnerE1.setValue(Double.valueOf(tokens[0].trim()));
spinnerE2.setValue(Double.valueOf(tokens[1].trim()));
spinnerTime.setValue(Double.valueOf(tokens[2].trim()));
spinnerDelay.setValue(Double.valueOf(tokens[3].trim()));
spinnerOffset1.setValue(Double.valueOf(tokens[4].trim()));
spinnerOffset2.setValue(Double.valueOf(tokens[5].trim()));
break;
}
}
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroupPlot = new javax.swing.ButtonGroup();
buttonGroup1 = new javax.swing.ButtonGroup();
panelParameters = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
spinnerE1 = new javax.swing.JSpinner();
jLabel2 = new javax.swing.JLabel();
spinnerE2 = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
spinnerTime = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
spinnerDelay = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
spinnerOffset1 = new javax.swing.JSpinner();
jLabel13 = new javax.swing.JLabel();
spinnerOffset2 = new javax.swing.JSpinner();
jLabel11 = new javax.swing.JLabel();
comboRunType = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
spinnerRounds = new javax.swing.JSpinner();
jLabel12 = new javax.swing.JLabel();
radioK1 = new javax.swing.JRadioButton();
radioK3 = new javax.swing.JRadioButton();
spinnerMag = new javax.swing.JSpinner();
jLabel16 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
buttonExecute = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jCheckBox1 = new javax.swing.JCheckBox();
jRadioButton2 = new javax.swing.JRadioButton();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton3 = new javax.swing.JRadioButton();
jCheckBox2 = new javax.swing.JCheckBox();
jCheckBox3 = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jSpinner1 = new javax.swing.JSpinner();
jSpinner2 = new javax.swing.JSpinner();
jLabel9 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jCheckBox4 = new javax.swing.JCheckBox();
panelSetup = new javax.swing.JPanel();
comboSetup = new javax.swing.JComboBox();
buttonConfigure = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
panelParameters.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("E start:");
jLabel1.setToolTipText("");
spinnerE1.setModel(new javax.swing.SpinnerNumberModel(680.0d, 0.0d, 9999.0d, 1.0d));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("E end:");
jLabel2.setToolTipText("");
spinnerE2.setModel(new javax.swing.SpinnerNumberModel(750.0d, 0.0d, 9999.0d, 1.0d));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Time(min):");
spinnerTime.setModel(new javax.swing.SpinnerNumberModel(2.0d, 0.0d, 60.0d, 1.0d));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Delay(s):");
spinnerDelay.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 600.0d, 1.0d));
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Offset1:");
spinnerOffset1.setModel(new javax.swing.SpinnerNumberModel(0.0d, -20.0d, 20.0d, 1.0d));
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel13.setText("Offset2:");
spinnerOffset2.setModel(new javax.swing.SpinnerNumberModel(0.0d, -20.0d, 20.0d, 1.0d));
jLabel11.setText("Run Type:");
comboRunType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "+/-", "+", "-", "LH/LV", "LH", "LV", "+--+/+--+" }));
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Nb of repetitions");
jLabel5.setToolTipText("");
spinnerRounds.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));
jLabel12.setText("Plot Type:");
buttonGroupPlot.add(radioK1);
radioK1.setText("K2 / K1");
radioK1.setMinimumSize(new java.awt.Dimension(100, 22));
radioK1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioK1ActionPerformed(evt);
}
});
buttonGroupPlot.add(radioK3);
radioK3.setText("K2 / K3");
jLabel16.setText("B(T)");
javax.swing.GroupLayout panelParametersLayout = new javax.swing.GroupLayout(panelParameters);
panelParameters.setLayout(panelParametersLayout);
panelParametersLayout.setHorizontalGroup(
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel12)
.addGap(18, 18, 18)
.addComponent(radioK1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(radioK3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerOffset1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerTime, javax.swing.GroupLayout.Alignment.TRAILING, 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)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerE2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(spinnerOffset2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(22, 22, 22)
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerMag, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39))))
);
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerE1, spinnerTime});
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel2, jLabel4, jLabel8});
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerDelay, spinnerE2, spinnerOffset1, spinnerOffset2, spinnerRounds});
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {radioK1, radioK3});
panelParametersLayout.setVerticalGroup(
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(spinnerE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(spinnerE2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerMag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(spinnerDelay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(spinnerOffset1)
.addComponent(jLabel13)
.addComponent(spinnerOffset2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboRunType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jLabel5)
.addComponent(spinnerRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(radioK1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(radioK3))
.addContainerGap())
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
buttonExecute.setText("Start");
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExecuteActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.setEnabled(false);
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jCheckBox1.setText("set offsets");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText("ID2");
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText("ID1");
buttonGroup1.add(jRadioButton3);
jRadioButton3.setSelected(true);
jRadioButton3.setText("ID1+ID2");
jCheckBox2.setText("Signal channel 0 p/n");
jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox2ActionPerformed(evt);
}
});
jCheckBox3.setText("I_0 channel 2 p/n");
jCheckBox3.setToolTipText("");
jLabel6.setText("ID mode");
jLabel7.setText("Data channels");
jSpinner1.setModel(new javax.swing.SpinnerNumberModel(0, 0, 1000, 1));
jSpinner2.setModel(new javax.swing.SpinnerNumberModel(0, 0, 1000, 1));
jLabel9.setText("Signal pos");
jLabel14.setText("I_0 pos");
jLabel15.setText("Camshaft position");
jCheckBox4.setText("Save array data");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2)
.addComponent(jLabel6))
.addGap(74, 74, 74)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jCheckBox3)
.addComponent(jCheckBox2)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jRadioButton3)
.addGap(48, 48, 48)
.addComponent(jCheckBox4)))
.addGap(31, 31, 31)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSpinner1)
.addComponent(jSpinner2))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(buttonExecute, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jCheckBox1))
.addComponent(jLabel15))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel15))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonExecute)
.addComponent(jCheckBox1)
.addComponent(jRadioButton1)
.addComponent(jCheckBox2))
.addGap(16, 16, 16)
.addComponent(buttonAbort))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14)))))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(60, 60, 60)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton2)
.addComponent(jCheckBox3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton3)
.addComponent(jCheckBox4))))
.addContainerGap(13, Short.MAX_VALUE))
);
panelSetup.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
comboSetup.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboSetupActionPerformed(evt);
}
});
buttonConfigure.setText("Configure");
buttonConfigure.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonConfigureActionPerformed(evt);
}
});
jLabel10.setText("Element:");
javax.swing.GroupLayout panelSetupLayout = new javax.swing.GroupLayout(panelSetup);
panelSetup.setLayout(panelSetupLayout);
panelSetupLayout.setHorizontalGroup(
panelSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSetupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonConfigure)
.addContainerGap())
);
panelSetupLayout.setVerticalGroup(
panelSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSetupLayout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(panelSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(buttonConfigure))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelSetup, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(panelSetup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void radioK1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioK1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_radioK1ActionPerformed
private void comboSetupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSetupActionPerformed
try {
if (comboSetup.getSelectedItem() != null) {
setElement();
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_comboSetupActionPerformed
private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed
try {
//Desktop.getDesktop().open(getConfigFile().toFile());
if ((dlgConfig == null) || (!dlgConfig.isShowing())) {
String[] columns = new String[]{"Element", "E1", "E2", "Time", "Delay", "Offset1", "Offset2"};
Class[] types = new Class[]{String.class, Double.class, Double.class, Double.class, Double.class, Double.class, Double.class};
DsvEditor editor = new DsvEditor(columns, types, ";");
dlgConfig = editor.getDialog(getView(), false);
editor.load(getConfigFile().toString());
editor.setTitle("Energy Scan Configuration");
dlgConfig.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
if (System.currentTimeMillis() - new File(dlgConfig.getEditor().getFileName()).lastModified() < 5000) {
loadConfig();
}
}
});
}
dlgConfig.setSize(680, 320);
showWindow(dlgConfig);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonConfigureActionPerformed
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCheckBox2ActionPerformed
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCheckBox1ActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
abort();
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
try {
run();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonExecuteActionPerformed
EditorDialog dlgConfig;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonConfigure;
private javax.swing.JButton buttonExecute;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroupPlot;
private javax.swing.JComboBox comboRunType;
private javax.swing.JComboBox comboSetup;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JCheckBox jCheckBox3;
private javax.swing.JCheckBox jCheckBox4;
private javax.swing.JLabel jLabel1;
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 jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel3;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JSpinner jSpinner1;
private javax.swing.JSpinner jSpinner2;
private javax.swing.JPanel panelParameters;
private javax.swing.JPanel panelSetup;
private javax.swing.JRadioButton radioK1;
private javax.swing.JRadioButton radioK3;
private javax.swing.JSpinner spinnerDelay;
private javax.swing.JSpinner spinnerE1;
private javax.swing.JSpinner spinnerE2;
private javax.swing.JSpinner spinnerMag;
private javax.swing.JSpinner spinnerOffset1;
private javax.swing.JSpinner spinnerOffset2;
private javax.swing.JSpinner spinnerRounds;
private javax.swing.JSpinner spinnerTime;
// End of variables declaration//GEN-END:variables
}
+1 -1
View File
@@ -237,7 +237,7 @@ else:
caput ("X11PHS-E:OPT","PGM+ID1+ID2")
number_of_scans = 1
if RUNTYPE in ["+/-", "+", "-", "+--+/+--+"]:
if RUNTYPE in ["+/-", "+", "-"]:
caput(OTF_MODE1,1) # circ + in ID1
caput(OTF_MODE2,2) # circ - in ID2
wait_channel(OTF_DONE, 1, type = 'i')
+349
View File
@@ -0,0 +1,349 @@
import os
import traceback
import thread
############################PGM+ID1+ID2###################################################
if str(SET_OFFSETS) == "1":
print "Setting offsets"
if RUNTYPE in ["+/-", "+" , "-", "+--+/+--+"]:
caput(OTF_MODE1,1) # circ + in ID1
caput(OTF_MODE2,2) # circ - in ID2
elif RUNTYPE in ["LH/LV", "LH", "LV"]:
caput(OTF_MODE1,0)
caput(OTF_MODE2,0)
wait_channel(OTF_DONE, 1, type = 'i')
caput(OTF_ALPHA1, 0.0) # LH in ID1
caput(OTF_ALPHA2, 90.0) # LV in ID2
wait_channel(OTF_DONE, 1, type = 'i')
else:
raise Exception("Invalid run type: " + RUNTYPE)
caput(OTF_OFF1,OFFSET1)
caput(OTF_OFF2,OFFSET2-40) #detune ID2
wait_channel(OTF_DONE, 1, type = 'i')
print "Offsets are set"
import sys
sys.exit(0)
else:
print "Running full script"
file_prefix = time.strftime("%y%m%d")
input_path = "/sls/X11MA/Data1/public/X11MA/temp/"+file_prefix+"/"
output_path = input_path #+file_prefix+"/" #"/sls/X11MA/Data1/public/e10989/"+file_prefix+"/"
#Parameters
"""
E1 = 680
E2 = 750
TIME = 2 #min
DELAY = 10.0 #s
OFFSET1 = 1.0 #eV
OFFSET2 = -1.0 #eV
MAG = 1 T
PREFIX = 'Data'
RUNTYPE = "+/-"
ROUNDS = 1
PLOT_TYPE = 1
"""
print "\nStarting energy scan - Parameters: ",
print E1,E2,TIME,DELAY,OFFSET1,OFFSET2,RUNTYPE#,ALPHA1,ALPHA2
###############################################################################
# Plotting
###############################################################################
task = None
running = False
MCP1 = []
MCP2 = []
def _startPlot(type):
global running
sep = "\t"
line_sep = "\r\n"
print "Starting plot: type " + str(type)
running = True
p = plot(None,name="Energy")[0]
s = p.getSeries(0)
cur = 0
time.sleep(3.0)
while running:
try:
if otf_start.read() == 0:
break
e = energy.read()
if (MCP_1 == 1 or MCP_2 == 1):
aK1=keithley_1a.read()
#aP=FillingPattern.read()
#aPr = []
#for z in aP:
# aPr.append(z)
aPr = FillingPattern.read().tolist()
SumaP=0
CamaP=0
for z in xrange(0,480):
SumaP = SumaP + aPr[z]
for z in xrange(460,470):
CamaP = CamaP + aPr[z]
aK1norm = aK1 * CamaP / SumaP
if MCP_1 == 1:
#a1=MCPArray1.read()
#a1r = []
#for i in a1:
# a1r.append(i)
a1r = MCPArray1.read().tolist()
Sum1a1 = 0
Cam1a1 = 0
Sum2a1 = 0
Cam2a1 = 0
MCP1.append(line_sep)
MCP1.append(e)
for i in xrange(0,480):
Sum1a1 = Sum1a1 + a1r[i]
#for i in xrange(Cam_start,Cam_end+1):
# Cam1a1 = Cam1a1 + a1r[i]
Cam1a1 = a1r[Cam_start]
MCP1.append(Sum1a1)
MCP1.append(Cam1a1)
MCP1.append(aK1norm)
if NrCounters.read() > 460:
for i in xrange(480,960):
Sum2a1 = Sum2a1 + a1r[i]
#for i in xrange(Cam_start+480,Cam_end+481):
# Cam2a1 = Cam2a1 + a1r[i]
Cam2a1 = a1r[Cam_start+480]
MCP1.append(Sum2a1)
MCP1.append(Cam2a1)
if Save_array_data == 1:
MCP1.append(a1r)
if MCP_2 == 1:
#a2=MCPArray2.read()
#a2r = []
#for j in a2:
# a2r.append(j)
a2r = MCPArray2.read().tolist()
Sum1a2 = 0
Cam1a2 = 0
Sum2a2 = 0
Cam2a2 = 0
MCP2.append(line_sep)
MCP2.append(e)
for j in xrange(0,480):
Sum1a2 = Sum1a2 + a2r[j]
#for j in xrange(Cam_start,Cam_end+1):
# Cam1a2 = Cam1a2 + a2r[j]
Cam1a2 = a2r[Cam_end]
MCP2.append(Sum1a2)
MCP2.append(Cam1a2)
MCP2.append(aK1norm)
if NrCounters.read() > 460:
for j in xrange(480,960):
Sum2a2 = Sum2a2 + a2r[j]
#for j in xrange(Cam_start+480,Cam_end+481):
# Cam2a2 = Cam2a2 + a2r[j]
Cam2a2 = a2r[Cam_end+481]
MCP2.append(Sum2a2)
MCP2.append(Cam2a2)
if Save_array_data == 1:
MCP2.append(a2r)
time.sleep(SamplingTime.read()*0.001)
if (abs(e-cur)) > 0.1:
v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() )))
s.appendData(e,v)
cur = e
# time.sleep(0.2)
except:
pass
print "Done Plotting"
if MCP_1 == 1:
output_file_MCP1 = output_path+"MCP_1_"+file_prefix+"_" + suffix + ".dat"
MCP1out = open(output_file_MCP1, "a+")
sMCP1 = sep.join(str(x) for x in MCP1) + line_sep # MCP1.write("%s" + sep % i)
sMCP1out = sep + "rbkenergy" + sep + "Sum1" + sep + "Cam1" + sep + "Keithley1_norm"
if NrCounters.read() > 460:
sMCP1out = sMCP1out + sep + "Sum2" + sep + "Cam2"
if Save_array_data == 1:
sMCP1out = sMCP1out + sep + "Array"
sMCP1out = sMCP1out + line_sep + sMCP1
MCP1out.write(sMCP1out)
MCP1out.close()
print "Saved MCP signal data"
if MCP_2 == 1:
output_file_MCP2 = output_path+"MCP_2_"+file_prefix+"_" + suffix + ".dat"
MCP2out = open(output_file_MCP2, "a+")
sMCP2 = sep.join(str(y) for y in MCP2) + line_sep
sMCP2out = sep + "rbkenergy" + sep + "Sum1" + sep + "Cam1" + sep + "Keithley1_norm"
if NrCounters.read() > 460:
sMCP2out = sMCP2out + sep + "Sum2" + sep + "Cam2"
if Save_array_data == 1:
sMCP2out = sMCP2out + sep + "Array"
sMCP2out = sMCP2out + line_sep + sMCP2
MCP2out.write(sMCP2out)
MCP2out.close()
print "Saved MCP I_0 data"
def startPlot(type = 1):
global task
task = fork((_startPlot,(type,)),)
def stopPlot():
global task, running
running = False
ret = join(task)
############################PGM+ID1+ID2###################################################
def switchpol(activeID, runtype):
global pol_str
if activeID == 1:
caput(OTF_OFF1,OFFSET1)
caput(OTF_OFF2,OFFSET2-40) #detune ID2
if runtype in ["+/-", "+", "+--+/+--+"]:
pol_str = "circ +"
elif runtype in ["LH/LV", "LH"]:
pol_str = "Lin. Horizontal"
elif activeID == 2:
caput(OTF_OFF1,OFFSET1-40) #detune ID1
caput(OTF_OFF2,OFFSET2)
if runtype in ["+/-", "-", "+--+/+--+"]:
pol_str = "circ -"
elif runtype in ["LH/LV", "LV"]:
pol_str = "Lin. Vertical"
else:
raise Exception("Invalid parameter")
pol_str = None
polswitch = 1
fid = get_next_fid(input_path, "o" + file_prefix)
###############################################################################
#Prepare scan
###############################################################################
if ID1 == 1:
caput ("X11PHS-E:OPT","PGM+ID1")
elif ID2 == 1:
caput ("X11PHS-E:OPT","PGM+ID2")
else:
caput ("X11PHS-E:OPT","PGM+ID1+ID2")
number_of_scans = 1
if RUNTYPE in ["+/-", "+", "-", "+--+/+--+"]:
caput(OTF_MODE1,1) # circ + in ID1
caput(OTF_MODE2,2) # circ - in ID2
wait_channel(OTF_DONE, 1, type = 'i')
if RUNTYPE == "+/-":
number_of_scans = 2 * ROUNDS
else:
number_of_scans = ROUNDS
elif RUNTYPE in ["LH/LV", "LH", "LV"]:
caput(OTF_MODE1,0)
caput(OTF_MODE2,0)
wait_channel(OTF_DONE, 1, type = 'i')
caput(OTF_ALPHA1, 0.0) # LH in ID1
caput(OTF_ALPHA2, 90.0) # LV in ID2
wait_channel(OTF_DONE, 1, type = 'i')
if RUNTYPE == "LH/LV":
number_of_scans = 2 * ROUNDS
else:
number_of_scans = ROUNDS
else:
raise Exception("Invalid run type: " + RUNTYPE)
if RUNTYPE in ["-", "LV"]:
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV
polswitch = 0
elif RUNTYPE in ["+/-", "+", "LH/LV", "LH", "+--+/+--+"]:
switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+ or LH
time.sleep(1.0)
wait_channel(OTF_DONE, 1, type = 'i')
open_vg10()
time.sleep(0.5)
open_vg11()
time.sleep(0.5)
open_vg12()
time.sleep(0.5)
open_vg13()
for scan_no in range(number_of_scans):
suffix = ("%03d" % fid)
input_file = input_path + "o" + file_prefix + "_" + suffix + ".dat"
caput(OTF_E1, E1)
caput(OTF_E2, E2)
caput(OTF_TIME, TIME)
caput(OTF_FTS,file_prefix)
caput(OTF_FID,fid)
caput(TBT_MAG,MAG)
time.sleep(2.0)
caput(OTF_ESET, E1)
wait_channel(OTF_DONE, 1, type = 'i')
time.sleep(DELAY)
time.sleep(2.0)
startPlot(PLOT_TYPE)
#Start the OTF scan
#caput(OTF_START, 'GO')
otf_start.write(1)
time.sleep(3.0)
print "Running scan " + str(scan_no+1) + " out of " + str(number_of_scans)
try:
#wait_channel(OTF_START, 'STOP', timeout = int(TIME*60), type = 's')
otf_start.waitValue(0, (15 + int(TIME*60)) *1000)
except:
print "******** OTF STOP TIMEOUT **********"
otf_start.write(0)
finally:
stopPlot()
time.sleep(5.0)
#TODO: wait for file instead of sleep
#Convert file
output_file = output_path+"os"+file_prefix+"_" + suffix + ".dat"
print("Converting data file: " + output_file);
convert_file(input_file, output_file, pol_str)
plot_file(output_file, file_prefix+"_" + suffix) #"Scan " + str(scan_no+1))
print "Finished scan " + str(scan_no+1) + " out of " + str(number_of_scans)
if RUNTYPE in ["+/-", "LH/LV"]:
if polswitch == 1:
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV
polswitch = 0
else:
polswitch = 1
switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+ or LH
elif RUNTYPE == "+--+/+--+":
step_no = scan_no % 10
if step_no in [1,6]:
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C-
elif step_no%10 == 4:
caput(TBT_MAG,-1*MAG)
elif step_no%10 in [3,8]:
switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+
else:
print "running in one polarization mode, no switching"
time.sleep(3.0)
fid = fid + 1
caput(OTF_ESET, E1)
caput(TBT_MAG,MAG)
close_vg13()
print "Finished Energy scan"
print("Success")
+1
View File
@@ -34,6 +34,7 @@ TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
TIME_DELAY_VAL = "X11MA-ES2:Theta-Cur.VAL"
TIME_DELAY_START = "X11MA-ES2:SCAN-START"
TIME_DELAY_COMPLETE = "X11MA-ES2-scan1.SMSG"
TBT_MAG = "X11MA-LSCI632:MFIELD"
FST = time.strftime("%y%m%d")