Startup
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#Thu Apr 06 10:26:03 CEST 2017
|
||||
#Wed Apr 12 14:54:29 CEST 2017
|
||||
colormap=Flame
|
||||
colormapAutomatic=true
|
||||
colormapMax=1000.0
|
||||
colormapMin=10.0
|
||||
flipHorizontally=true
|
||||
flipVertically=false
|
||||
colormapAutomatic=false
|
||||
colormapMax=2000.0
|
||||
colormapMin=0.0
|
||||
flipHorizontally=false
|
||||
flipVertically=true
|
||||
grayscale=false
|
||||
imageHeight=2160
|
||||
imageWidth=2560
|
||||
imageHeight=1680
|
||||
imageWidth=1744
|
||||
invert=false
|
||||
regionStartX=1
|
||||
regionStartY=1
|
||||
regionStartX=433
|
||||
regionStartY=241
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
@@ -21,9 +21,9 @@ rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
serverURL=localhost\:10000
|
||||
spatialCalOffsetX=-1279.0
|
||||
spatialCalOffsetY=-1079.0
|
||||
spatialCalScaleX=-53.020711215318485
|
||||
spatialCalScaleY=-53.02454840203798
|
||||
spatialCalOffsetX=-861.0
|
||||
spatialCalOffsetY=-820.0
|
||||
spatialCalScaleX=-18.90359168241966
|
||||
spatialCalScaleY=-19.37984496124031
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#Mon Apr 10 12:04:04 CEST 2017
|
||||
defaultSpeed=2000.0
|
||||
#Wed Apr 12 14:14:27 CEST 2017
|
||||
defaultSpeed=282.842712474619
|
||||
estbilizationDelay=0
|
||||
hasEnable=false
|
||||
homingType=None
|
||||
maxSpeed=8000.0
|
||||
maxValue=51500.0
|
||||
minSpeed=50.0
|
||||
minValue=-56903.0
|
||||
minValue=-56789.2
|
||||
offset=0.0
|
||||
precision=1
|
||||
resolution=0.1
|
||||
|
||||
@@ -18,13 +18,21 @@
|
||||
<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="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="comboWireScan" min="-2" pref="332" max="-2" attributes="0"/>
|
||||
<Component id="comboWireScan" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel8" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="buttonMoveStart" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonScan" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonAbort" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jLabel2" linkSize="1" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jLabel3" linkSize="1" alignment="1" max="32767" attributes="0"/>
|
||||
@@ -34,44 +42,35 @@
|
||||
<Component id="jLabel10" linkSize="1" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="comboSelection" pref="332" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="comboSelection" max="32767" attributes="0"/>
|
||||
<Component id="textBpm1" max="32767" attributes="0"/>
|
||||
<Component id="textBpm2" max="32767" attributes="0"/>
|
||||
<Component id="comboBpm3" alignment="0" pref="332" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="textStart" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="comboBpm3" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="spinnerStart" max="32767" attributes="0"/>
|
||||
<Component id="spinnerVel" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel7" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textEnd" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||
<Component id="spinnerEnd" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel9" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textCycles" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||
<Component id="spinnerCycles" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="stateWireScan" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="panelStatus" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel8" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textVel" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="20" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jToggleButton1" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
|
||||
<Component id="jToggleButton2" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="23" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -89,18 +88,20 @@
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textEnd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" 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="spinnerEnd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="spinnerStart" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textVel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textCycles" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerVel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerCycles" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
@@ -117,17 +118,18 @@
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboBpm3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="41" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="jLabel10" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="panelStatus" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="stateWireScan" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="34" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jToggleButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jToggleButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonScan" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonMoveStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="50" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="48" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -191,10 +193,6 @@
|
||||
<Property name="text" type="java.lang.String" value="Start (µm):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textStart">
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textEnd">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
@@ -207,38 +205,71 @@
|
||||
<Property name="text" type="java.lang.String" value="Vel (µm/s):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textVel">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel9">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Cycles:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textCycles">
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Scan"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Abort"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="stateWireScan">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel10">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Scan status:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonScan">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Scan"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScanActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonAbort">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Abort"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonMoveStart">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Go to Start"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveStartActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerStart">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="1000.0" maximum="10000.0" minimum="-10000.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerEnd">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="1000.0" maximum="10000.0" minimum="-10000.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerVel">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="200.0" maximum="10000.0" minimum="1.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerCycles">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="1" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelStatus">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -2,22 +2,13 @@
|
||||
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.device.Device;
|
||||
import ch.psi.pshell.epics.Epics;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.Plugin;
|
||||
import ch.psi.utils.IO;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.script.ScriptException;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
|
||||
/**
|
||||
@@ -65,7 +56,9 @@ public class WireScan extends Panel {
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
|
||||
buttonMoveStart.setEnabled(state==State.Ready);
|
||||
buttonScan.setEnabled(state==State.Ready);
|
||||
buttonAbort.setEnabled(state==State.Busy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,17 +86,18 @@ public class WireScan extends Panel {
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
comboBpm3 = new javax.swing.JComboBox();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
textStart = new javax.swing.JTextField();
|
||||
textEnd = new javax.swing.JTextField();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
textVel = new javax.swing.JTextField();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
textCycles = new javax.swing.JTextField();
|
||||
jToggleButton1 = new javax.swing.JToggleButton();
|
||||
jToggleButton2 = new javax.swing.JToggleButton();
|
||||
stateWireScan = new ch.psi.pshell.swing.DeviceStatePanel();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
buttonScan = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
buttonMoveStart = new javax.swing.JButton();
|
||||
spinnerStart = new javax.swing.JSpinner();
|
||||
spinnerEnd = new javax.swing.JSpinner();
|
||||
spinnerVel = new javax.swing.JSpinner();
|
||||
spinnerCycles = new javax.swing.JSpinner();
|
||||
panelStatus = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
|
||||
comboWireScan.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -148,27 +142,57 @@ public class WireScan extends Panel {
|
||||
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel9.setText("Cycles:");
|
||||
|
||||
jToggleButton1.setText("Scan");
|
||||
|
||||
jToggleButton2.setText("Abort");
|
||||
|
||||
stateWireScan.setBorder(null);
|
||||
|
||||
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel10.setText("Scan status:");
|
||||
|
||||
buttonScan.setText("Scan");
|
||||
buttonScan.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonScanActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonAbort.setText("Abort");
|
||||
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonAbortActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonMoveStart.setText("Go to Start");
|
||||
buttonMoveStart.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonMoveStartActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
||||
|
||||
spinnerEnd.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
||||
|
||||
spinnerVel.setModel(new javax.swing.SpinnerNumberModel(200.0d, 1.0d, 10000.0d, 1.0d));
|
||||
|
||||
spinnerCycles.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(comboWireScan, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(comboWireScan, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel8)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(buttonMoveStart, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonScan, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@@ -177,35 +201,27 @@ public class WireScan extends Panel {
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(comboSelection, 0, 332, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(comboSelection, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(textBpm1)
|
||||
.addComponent(textBpm2)
|
||||
.addComponent(comboBpm3, 0, 332, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(textStart, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(spinnerStart)
|
||||
.addComponent(spinnerVel))
|
||||
.addGap(46, 46, 46)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel7)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textEnd, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(8, 8, 8)
|
||||
.addComponent(spinnerEnd))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel9)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textCycles, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(stateWireScan, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel8)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textVel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(20, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jToggleButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(63, 63, 63)
|
||||
.addComponent(jToggleButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(8, 8, 8)
|
||||
.addComponent(spinnerCycles))))
|
||||
.addComponent(panelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addContainerGap(23, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel10, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9});
|
||||
@@ -222,17 +238,18 @@ public class WireScan extends Panel {
|
||||
.addComponent(comboSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(textStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(spinnerEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(spinnerStart, 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.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(textVel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel9)
|
||||
.addComponent(textCycles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerCycles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3)
|
||||
@@ -245,15 +262,16 @@ public class WireScan extends Panel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel5)
|
||||
.addComponent(comboBpm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel10)
|
||||
.addComponent(stateWireScan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
|
||||
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jToggleButton1)
|
||||
.addComponent(jToggleButton2))
|
||||
.addContainerGap(50, Short.MAX_VALUE))
|
||||
.addComponent(buttonAbort)
|
||||
.addComponent(buttonScan)
|
||||
.addComponent(buttonMoveStart))
|
||||
.addContainerGap(48, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -264,31 +282,72 @@ public class WireScan extends Panel {
|
||||
textBpm2.setText((ret==null) ? "" : ret.get(1));
|
||||
|
||||
comboSelection.setSelectedIndex(Epics.get(comboWireScan.getSelectedItem().toString() + ":WIRE_SP", Integer.class));
|
||||
textVel.setText(Epics.get(comboWireScan.getSelectedItem().toString() + ":SCAN_VELO_SP", String.class));
|
||||
textCycles.setText(Epics.get(comboWireScan.getSelectedItem().toString() + ":NB_CYCL_SP", String.class));
|
||||
if (stateWireScan.getDevice()!=null){
|
||||
stateWireScan.getDevice().close();
|
||||
spinnerVel.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":SCAN_VELO_SP", Double.class));
|
||||
spinnerCycles.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":NB_CYCL_SP", Integer.class));
|
||||
if (panelStatus.getDevice()!=null){
|
||||
panelStatus.getDevice().close();
|
||||
}
|
||||
Device dev= (Device)eval("newScanInfoDevice('Wire scan state', '" + comboWireScan.getSelectedItem().toString()+ "')", true);
|
||||
stateWireScan.setDevice(dev);
|
||||
Device dev= (Device)eval("newScanInfoDevice(None, '" + comboWireScan.getSelectedItem().toString()+ "')", true);
|
||||
panelStatus.setDevice(dev);
|
||||
|
||||
} catch (Exception ex) {
|
||||
stateWireScan.setDevice(null);
|
||||
panelStatus.setDevice(null);
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboWireScanActionPerformed
|
||||
|
||||
private void comboSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboSelectionActionPerformed
|
||||
try {
|
||||
textStart.setText(Epics.get(comboWireScan.getSelectedItem().toString()+ ":" + comboSelection.getSelectedItem().toString() + "_START_SP", String.class));
|
||||
textEnd.setText(Epics.get(comboWireScan.getSelectedItem().toString() + ":" + comboSelection.getSelectedItem().toString() + "_END_SP", String.class));
|
||||
spinnerStart.setValue(Epics.get(comboWireScan.getSelectedItem().toString()+ ":" + comboSelection.getSelectedItem().toString() + "_START_SP", Double.class));
|
||||
spinnerEnd.setValue(Epics.get(comboWireScan.getSelectedItem().toString() + ":" + comboSelection.getSelectedItem().toString() + "_END_SP", Double.class));
|
||||
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboSelectionActionPerformed
|
||||
|
||||
private void buttonScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanActionPerformed
|
||||
ArrayList parameters = new ArrayList();
|
||||
parameters.add(comboWireScan.getSelectedItem().toString());
|
||||
parameters.add(comboSelection.getSelectedItem().toString());
|
||||
parameters.add(spinnerStart.getValue());
|
||||
parameters.add(spinnerEnd.getValue());
|
||||
parameters.add(spinnerCycles.getValue());
|
||||
parameters.add(spinnerVel.getValue());
|
||||
parameters.add(comboBpm3.getSelectedItem().toString().isEmpty() ? null: comboBpm3.getSelectedItem().toString());
|
||||
try {
|
||||
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
|
||||
if (ex != null) {
|
||||
getLogger().info("Exception executing scan: " + ex);
|
||||
} else {
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonScanActionPerformed
|
||||
|
||||
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
||||
try {
|
||||
abort();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed
|
||||
try {
|
||||
Epics.putq(comboWireScan.getSelectedItem().toString() + ":INIT.PROC", 1);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonMoveStartActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonMoveStart;
|
||||
private javax.swing.JButton buttonScan;
|
||||
private javax.swing.JComboBox comboBpm3;
|
||||
private javax.swing.JComboBox comboSelection;
|
||||
private javax.swing.JComboBox comboWireScan;
|
||||
@@ -302,14 +361,12 @@ public class WireScan extends Panel {
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JToggleButton jToggleButton1;
|
||||
private javax.swing.JToggleButton jToggleButton2;
|
||||
private ch.psi.pshell.swing.DeviceStatePanel stateWireScan;
|
||||
private ch.psi.pshell.swing.DeviceValuePanel panelStatus;
|
||||
private javax.swing.JSpinner spinnerCycles;
|
||||
private javax.swing.JSpinner spinnerEnd;
|
||||
private javax.swing.JSpinner spinnerStart;
|
||||
private javax.swing.JSpinner spinnerVel;
|
||||
private javax.swing.JTextField textBpm1;
|
||||
private javax.swing.JTextField textBpm2;
|
||||
private javax.swing.JTextField textCycles;
|
||||
private javax.swing.JTextField textEnd;
|
||||
private javax.swing.JTextField textStart;
|
||||
private javax.swing.JTextField textVel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -2,35 +2,42 @@ import ch.psi.pshell.epics.Motor
|
||||
|
||||
|
||||
class WireScanInfo(DeviceBase):
|
||||
def __init__(self, name, prefix):
|
||||
self.prefix = prefix
|
||||
def __init__(self, name, prefix):
|
||||
DeviceBase.__init__(self, name)
|
||||
self.prefix = prefix
|
||||
self.nb_cycles = Channel(self.prefix + ":NB_CYCL_SP", 'l')
|
||||
self.curr_cycl = Channel(self.prefix + ":CURR_CYCL", 'l', callback = self.on_cycle_change)
|
||||
self.curr_cycl.set_monitored(True)
|
||||
set_device_alias(self.curr_cycl, "current_cycle")
|
||||
self.current_cycle = self.curr_cycl.get()
|
||||
self.status_channels=[]
|
||||
for s in ("SCANNING", "SCAN_DONE", "INITIALIZING", "INIT_DONE", "ABORTED", "ERROR"):
|
||||
c = Channel(self.prefix + ":" + s, 'i', callback = self.on_status_change);
|
||||
c.set_monitored(True)
|
||||
self.status_channels.append(c)
|
||||
self.cycles = self.nb_cycles.get()
|
||||
self.on_status_change(None)
|
||||
self.initialize()
|
||||
|
||||
def on_status_change(self, val):
|
||||
try:
|
||||
if self.status_channels[0].get() == 1:
|
||||
self.setCache("scanning", None)
|
||||
self.setCache("Scanning " + str(self.current_cycle) + "/" + str(self.cycles), None)
|
||||
self.setState(State.Busy)
|
||||
elif self.status_channels[1].get() == 1:
|
||||
self.setCache( "scan done", None)
|
||||
self.setCache("Scan done", None)
|
||||
self.setState(State.Ready)
|
||||
elif self.status_channels[2].get() == 1:
|
||||
self.setCache("traveling", None)
|
||||
self.setState(State.Initializing)
|
||||
self.setCache("Traveling", None)
|
||||
self.setState(State.Paused)
|
||||
elif self.status_channels[3].get() == 1:
|
||||
self.setCache("at start", None)
|
||||
self.setCache("At start", None)
|
||||
self.setState(State.Ready)
|
||||
elif self.status_channels[4].get() == 1:
|
||||
self.setCache("abort", None)
|
||||
self.setCache("Abort", None)
|
||||
self.setState(State.Ready)
|
||||
elif self.status_channels[5].get() == 1:
|
||||
self.setCache("error", None)
|
||||
self.setCache("Error", None)
|
||||
self.setState(State.Fault)
|
||||
else:
|
||||
pass #All zero, a transition
|
||||
@@ -38,11 +45,18 @@ class WireScanInfo(DeviceBase):
|
||||
self.setCache("offline", None)
|
||||
self.setState(State.Offline)
|
||||
|
||||
def doClose(self):
|
||||
def on_cycle_change(self, val):
|
||||
#print "Wire scan cycle change: ", val
|
||||
self.current_cycle = val
|
||||
self.on_status_change(val)
|
||||
|
||||
def doClose(self):
|
||||
self.nb_cycles.close()
|
||||
self.curr_cycl.close()
|
||||
for c in self.status_channels:
|
||||
c.close()
|
||||
|
||||
def newScanInfoDevice(name, prefix):
|
||||
def newScanInfoDevice(name, prefix):
|
||||
return WireScanInfo(name, prefix)
|
||||
|
||||
|
||||
@@ -50,19 +64,16 @@ class WireScanner(WireScanInfo):
|
||||
Selection = [Garage, W1X, W1Y, W2X, W2Y, Foil] = "GARAGE", "W1X", "W1Y", "W2X", "W2Y", "FOIL"
|
||||
|
||||
def __init__(self, prefix, sel = None, start=None , end=None, cycles=None, velocity=None, continuous = None):
|
||||
WireScanInfo.__init__(self, "Wire Scan " + prefix, prefix)
|
||||
WireScanInfo.__init__(self, "Wire Scan " + prefix, prefix)
|
||||
self.motor = ch.psi.pshell.epics.Motor("WireScanner motor", self.prefix + ":MOTOR_1")
|
||||
self.motor.uploadConfig()
|
||||
self.motor.initialize()
|
||||
self.motor_bs_readback = Channel(self.prefix + ":ENC_1_BS")
|
||||
self.motor_bs_readback = Channel(self.prefix + ":ENC_1_BS") #, callback = self.on_readback_change)
|
||||
#self.motor_bs_readback.set_monitored(True)
|
||||
self.wire_velocity = Channel(self.prefix + ":SCAN_VELO_SP") #wire coordinates
|
||||
self.motor_velocity = Channel(self.prefix + ":SCAN_M_VELO") #motor coordinates
|
||||
self.travel_velocity = Channel(self.prefix + ":TRAVEL_VELO_SP") #motor coordinates
|
||||
self.nb_cycles = Channel(self.prefix + ":NB_CYCL_SP", 'l')
|
||||
self.curr_cycl = Channel(self.prefix + ":CURR_CYCL", 'l', callback = self.on_cycle_change)
|
||||
self.curr_cycl.set_monitored(True)
|
||||
set_device_alias(self.curr_cycl, "current_cycle")
|
||||
self.wire_sel = Channel(self.prefix + ":WIRE_SP", 'l')
|
||||
self.current_cycle = self.curr_cycl.get()
|
||||
self.wire_sel = Channel(self.prefix + ":WIRE_SP", 'l')
|
||||
self.selection = None
|
||||
self.u0 = None
|
||||
self.offset = None
|
||||
@@ -77,22 +88,22 @@ class WireScanner(WireScanInfo):
|
||||
self.start.write(float(start))
|
||||
if end is not None:
|
||||
self.end.write(float(end))
|
||||
if cycles is not None:
|
||||
self.nb_cycles.write(int(cycles))
|
||||
if velocity is not None:
|
||||
self.wire_velocity.write(float(velocity))
|
||||
if cycles is not None:
|
||||
self.nb_cycles.write(int(cycles))
|
||||
if continuous is not None:
|
||||
caputq(self.prefix + ":SCAN_MODE_SP", 0 if continuous else 1)
|
||||
|
||||
|
||||
self.readback = self.motor_bs_readback.get()
|
||||
self.cycles = self.nb_cycles.get()
|
||||
self.velocity = self.wire_velocity.get()
|
||||
self.scan_range = [self.start.get(), self.end.get()]
|
||||
self.initialize()
|
||||
|
||||
def on_cycle_change(self, val):
|
||||
#print "Wire scan cycle change: ", val
|
||||
self.current_cycle = val
|
||||
|
||||
#def on_readback_change(self, val):
|
||||
# self.readback = val
|
||||
|
||||
def set_selection(self, sel):
|
||||
if not sel in WireScanner.Selection:
|
||||
raise Exception("Invalid Wire Scan selection: " + str(sel))
|
||||
@@ -104,6 +115,19 @@ class WireScanner(WireScanInfo):
|
||||
self.end = Channel(self.prefix + ":" + self.selection + "_END_SP")
|
||||
self.wire_sel.put(WireScanner.Selection.index(sel))
|
||||
|
||||
def abort(self):
|
||||
caputq(self.prefix + ":ABORT.PROC", 1)
|
||||
|
||||
def init(self):
|
||||
caputq(self.prefix + ":INIT.PROC", 1)
|
||||
|
||||
def park(self):
|
||||
caputq(self.prefix + ":GARAGE_SEL.PROC", 1)
|
||||
|
||||
def scan(self):
|
||||
self.cycles = self.nb_cycles.get()
|
||||
caputq(self.prefix + ":SCAN_WIRE", 1)
|
||||
|
||||
def doClose(self):
|
||||
WireScanState.doClose(self)
|
||||
self.motor.close()
|
||||
@@ -111,15 +135,13 @@ class WireScanner(WireScanInfo):
|
||||
self.wire_velocity.close()
|
||||
self.motor_velocity.close()
|
||||
self.travel_velocity.close()
|
||||
self.nb_cycles.close()
|
||||
self.curr_cycl.close()
|
||||
self.wire_sel.close()
|
||||
if self.u0 is not None: self.u0.close()
|
||||
if self.offset is not None: self.offset.close()
|
||||
if self.range is not None: self.range.close()
|
||||
if self.start is not None: self.start.close()
|
||||
if self.end is not None: self.end.close()
|
||||
|
||||
"""
|
||||
def get_cicle_time(self):
|
||||
range = abs(self.start.get() -self.end.get())
|
||||
speed = self.motor_velocity.get()
|
||||
@@ -127,21 +149,10 @@ class WireScanner(WireScanInfo):
|
||||
|
||||
def get_total_time(self):
|
||||
return self.get_cicle_time() * self.cycles
|
||||
|
||||
def abort(self):
|
||||
caputq("SINDI01-DWSC090:ABORT.PROC", 1)
|
||||
|
||||
def init(self):
|
||||
caputq("SINDI01-DWSC090:INIT.PROC", 1)
|
||||
|
||||
def park(self):
|
||||
caputq("SINDI01-DWSC090:GARAGE_SEL.PROC", 1)
|
||||
|
||||
def scan(self):
|
||||
self.cycles = self.nb_cycles.get()
|
||||
caputq("SINDI01-DWSC090:SCAN_WIRE", 1)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before ca
|
||||
run("Devices/Elements")
|
||||
run("Devices/WireScanner")
|
||||
|
||||
#BPM_SENSORS = {"x":"X1", "y":"Y1", "q":"Q1"}
|
||||
BPM_SENSORS = {"x":"X1"}
|
||||
|
||||
if is_panel:
|
||||
prefix = args[0]
|
||||
sel = args[1]
|
||||
@@ -11,7 +14,7 @@ if is_panel:
|
||||
velocity = args[5]
|
||||
bpm3 = args[6]
|
||||
else:
|
||||
prefix = "SINDI01-DWSC090" #"SARCL02-DWSC270"
|
||||
prefix = "S30CB09-DWSC440" #"SARCL02-DWSC270" # "SINDI01-DWSC090" #"SARCL02-DWSC270"
|
||||
sel = WireScanner.W1X
|
||||
start = -200
|
||||
end = 200
|
||||
@@ -19,28 +22,38 @@ else:
|
||||
velocity = 200
|
||||
bpm3 = None
|
||||
|
||||
print prefix, sel, start, end, cycles, cycles, bpm3
|
||||
#Creating WireScanner object
|
||||
if prefix not in get_wire_scans():
|
||||
raise Exception("Invalid wire scan: " + prefix)
|
||||
scanner = WireScanner(prefix, sel, start, end, cycles, velocity, True)
|
||||
scanner.init()
|
||||
scanner.waitValue("At start", 60000)
|
||||
|
||||
#Stream channels
|
||||
bs_position = scanner.motor_bs_readback.get_name()
|
||||
bpms = get_wire_scans_bpms(prefix)
|
||||
if bpms is None:
|
||||
raise Exception("Cannot determine wire scan bpms: " + prefix)
|
||||
channels = [("w_pos", bs_position)]
|
||||
channels = [("w_pos", scanner.motor_bs_readback.get_name()),
|
||||
("cur_cycle", scanner.curr_cycl.get_name()),
|
||||
("scanning", scanner.status_channels[0].get_name())]
|
||||
if bpm3 is not None:
|
||||
bpms.append(bpm3)
|
||||
|
||||
bpms = ["SINDI01-DBPM060", "SINDI02-DBPM010"]
|
||||
for i in range (len(bpms)):
|
||||
channels.append (("bpm" + str(i+1) + "_x", bpms[i] + ":X1"))
|
||||
channels.append (("bpm" + str(i) + "_y", bpms[i] + ":Y1"))
|
||||
channels.append (("bpm" + str(i) + "_q", bpms[i] + ":Q1"))
|
||||
for sensor in BPM_SENSORS.keys():
|
||||
channels.append (("bpm" + str(i+1) + "_" + sensor, bpms[i] + ":" + BPM_SENSORS[sensor]))
|
||||
channels.append (("timer", "SINDI01-RLLE-STA:SLAVE1-CPUTIMER"))
|
||||
|
||||
#Stream creation
|
||||
st = Stream("pulse_id", dispatcher)
|
||||
#st.setFilter(scanner.status_channels[0].get_name() + ">0") #Not used because we must the reansition to know when the finished
|
||||
scanner.curr_cycl.write(0)
|
||||
st.setFilter(scanner.curr_cycl.get_name() + ">0")
|
||||
for c in channels:
|
||||
print c[1]
|
||||
st.addScalar(c[0], c[1], 10, 0)
|
||||
st.initialize()
|
||||
st.start()
|
||||
@@ -52,8 +65,9 @@ scanner.waitState(State.Busy, 60000)
|
||||
scan_complete=False
|
||||
def check_end_scan(record, scan):
|
||||
global scan_complete
|
||||
if scanner.isReady():
|
||||
print "Abort Scan"
|
||||
#print record[1] ,scanner.readback
|
||||
if record[3]<1:
|
||||
print "Data aquisition completed"
|
||||
scan_complete=True
|
||||
scan.abort()
|
||||
|
||||
@@ -67,10 +81,9 @@ def write_metadata(path):
|
||||
set_attribute(path, "Velocity", scanner.velocity )
|
||||
except:
|
||||
pass
|
||||
|
||||
#Scan
|
||||
try:
|
||||
mscan (st, st.getReadables() +[scanner.curr_cycl] , -1, scanner.get_total_time() * 2.0, after_read =check_end_scan) # *2.0 to account for accelerations an dother delays
|
||||
mscan (st, st.getReadables(), -1, -1, after_read =check_end_scan)
|
||||
except:
|
||||
if not scanner.isReady():
|
||||
print "Aborting Wire Scan"
|
||||
|
||||
Reference in New Issue
Block a user