This commit is contained in:
sfop
2017-05-01 10:50:49 +02:00
parent 92a4d630e6
commit 6128571145
8 changed files with 295 additions and 47 deletions
+10 -10
View File
@@ -1,16 +1,16 @@
#Fri Apr 28 08:09:58 CEST 2017
#Mon May 01 09:48:54 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=372.0
colormapMax=500.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=2160
imageWidth=2560
imageHeight=2148
imageWidth=2272
invert=false
regionStartX=1
regionStartY=1
regionStartX=129
regionStartY=7
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-1038.4850588526797
spatialCalOffsetY=-469.50758047873336
spatialCalScaleX=-8.51063859886098
spatialCalScaleY=-8.23581685648336
spatialCalOffsetX=-226.5485440792231
spatialCalOffsetY=-401.5108176113712
spatialCalScaleX=-7.61744675127048
spatialCalScaleY=-7.774538465366242
spatialCalUnits=mm
transpose=false
+8
View File
@@ -0,0 +1,8 @@
#Mon May 01 09:25:44 CEST 2017
maxValue=10.0
minValue=-10.0
offset=0.0
precision=3
resolution=0.007
scale=1.0
unit=A
+5 -5
View File
@@ -1,4 +1,4 @@
#Wed Apr 12 15:36:21 CEST 2017
#Mon May 01 09:53:33 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=578.797
@@ -18,9 +18,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=-861.4939970777481
spatialCalOffsetY=-820.4883730911062
spatialCalScaleX=-18.90359092620482
spatialCalScaleY=-19.37984500632817
spatialCalOffsetX=-226.5485440792231
spatialCalOffsetY=-401.5108176113712
spatialCalScaleX=-7.61744675127048
spatialCalScaleY=-7.774538465366242
spatialCalUnits=mm
transpose=false
+49 -14
View File
@@ -56,6 +56,8 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
@@ -74,6 +76,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
@@ -1510,9 +1513,8 @@ public class ScreenPanel extends Panel {
return (Epics.get("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", Integer.class) == 0);
}
void elog(String title, String message, String[] attachments) throws Exception {
String domain = "";
String logbook = "SwissFEL commissioning data";
void elog(String logbook, String title, String message, String[] attachments) throws Exception {
String domain = "";
String category = "Info";
String entry = "";
StringBuffer cmd = new StringBuffer();
@@ -1579,23 +1581,56 @@ public class ScreenPanel extends Panel {
}
}
void saveSnapshot() throws Exception {
void saveSnapshot() throws Exception {
String snapshotFile = getContext().getSetup().expandPath("{images}/{date}_{time}_snapshot.png");
renderer.saveSnapshot(snapshotFile, "png", true);
getContext().setExecutionPars("snapshot");
String path = "/data";
getContext().getDataManager().setDataset(path, renderer.getData().getMatrix(), renderer.getData().isUnsigned());
getContext().getDataManager().setAttribute(path, "Camera", String.valueOf(cameraName));
getContext().getDataManager().setAttribute(path, "Screen", String.valueOf(valueScreen.getLabel().getText()));
getContext().getDataManager().setAttribute(path, "Filter", String.valueOf(valueFilter.getLabel().getText()));
getContext().getDataManager().closeOutput();
StringBuilder message = new StringBuilder();
message.append("Camera: ").append(cameraName).append(" (").
append((camera instanceof Camtool) ? "camtool" : "direct").append(")").append("\n");
message.append("Data file: ").append(getContext().getExecutionPars().getPath()).append("\n");
if ((fitOv != null) && (fitOv.length > 5)) {
Overlays.Text text = (Overlays.Text) fitOv[5];
message.append(text.getText()).append("\n");
}
elog("ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
SwingUtils.showMessage(getTopLevel(), "Success", "Generated data file:\n" + getContext().getExecutionPars().getPath(), 5000);
JPanel panel = new JPanel();
GridBagLayout layout = new GridBagLayout();
layout.columnWidths = new int[]{0, 180}; //Minimum width
layout.rowHeights = new int[]{30, 30, 30}; //Minimum height
panel.setLayout(layout);
JComboBox comboLogbook = new JComboBox(new String[]{"SwissFEL commissioning data", "SwissFEL commissioning"});
JTextField textComment = new JTextField();
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
panel.add(new JLabel("Data file:"), c);
c.gridy = 1;
panel.add(new JLabel("Logbook:"), c);
c.gridy = 2;
panel.add(new JLabel("Comment:"), c);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1;
panel.add(textComment, c);
c.gridy = 1;
panel.add(comboLogbook, c);
c.gridy = 0;
panel.add(new JLabel(getContext().getExecutionPars().getPath()), c);
if (SwingUtils.showOption(getTopLevel(), "Success", panel, OptionType.OkCancel) == OptionResult.Yes){
StringBuilder message = new StringBuilder();
message.append("Camera: ").append(cameraName).append(" (").
append((camera instanceof Camtool) ? "camtool" : "direct").append(")").append("\n");
message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n");
message.append("Filter: ").append(String.valueOf(valueFilter.getLabel().getText())).append("\n");
message.append("Data file: ").append(getContext().getExecutionPars().getPath()).append("\n");
message.append("Comment: ").append(textComment.getText()).append("\n");
if ((fitOv != null) && (fitOv.length > 5)) {
Overlays.Text text = (Overlays.Text) fitOv[5];
message.append(text.getText()).append("\n");
}
elog((String) comboLogbook.getSelectedItem(), "ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
}
//SwingUtils.showMessage(getTopLevel(), "Success", "Generated data file:\n" + getContext().getExecutionPars().getPath(), 5000);
//elog("SwissFEL commissioning data", "ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
}
void saveStack() throws Exception {
+47 -2
View File
@@ -42,9 +42,12 @@
<Component id="jLabel6" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel10" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="labelStartY" linkSize="1" alignment="1" max="32767" attributes="0"/>
<Component id="jLabel18" alignment="1" max="32767" attributes="0"/>
</Group>
<Component id="jLabel4" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel5" linkSize="1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel16" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel17" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -84,6 +87,9 @@
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="comboBlm3" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm2" alignment="0" max="32767" attributes="0"/>
<Component id="comboBlm1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
@@ -179,7 +185,22 @@
<Component id="comboBpm3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" pref="24" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel18" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboBlm1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboBlm2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel17" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboBlm3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel16" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPosition" linkSize="5" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -209,7 +230,7 @@
<Component id="jLabel10" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelStatus" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" pref="24" max="32767" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonScan" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -479,5 +500,29 @@
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelPosition1">
</Component>
<Component class="javax.swing.JLabel" name="jLabel16">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="BLM 3:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboBlm3">
</Component>
<Component class="javax.swing.JLabel" name="jLabel17">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="BLM 2:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboBlm2">
</Component>
<Component class="javax.swing.JComboBox" name="comboBlm1">
</Component>
<Component class="javax.swing.JLabel" name="jLabel18">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="BLM 1:"/>
</Properties>
</Component>
</SubComponents>
</Form>
+77 -8
View File
@@ -37,6 +37,7 @@ import javax.swing.JTextField;
public class WireScan extends Panel {
final String[] seriesNames = new String[]{"bpm1_x", "bpm1_y", "bpm1_q", "bpm2_x", "bpm2_y", "bpm2_q"};
final JComboBox[] bpmCombos;
final JComboBox[] blmCombos;
final int[] seriesYAxis = new int[]{1, 1, 2, 1, 1, 2};
LinePlotSeries[] series = new LinePlotSeries[seriesNames.length];
boolean homed;
@@ -54,6 +55,7 @@ public class WireScan extends Panel {
plot.getAxis(Plot.AxisId.Y2).setLabel("pc");
plot.setLegendVisible(true);
bpmCombos = new JComboBox[]{comboBpm1, comboBpm2, comboBpm3};
blmCombos = new JComboBox[]{comboBlm1, comboBlm2, comboBlm3};
}
//Overridable callbacks
@@ -89,6 +91,17 @@ public class WireScan extends Panel {
}
cb.setModel(model);
}
ret = (List<String>) ((Plugin)this).eval("get_blms()", true);
for (JComboBox cb : blmCombos){
model = new DefaultComboBoxModel();
model.addElement("");
for (String scan: ret){
model.addElement(scan);
}
cb.setModel(model);
}
if (App.hasArgument("ws")){
comboWireScanner.setSelectedItem(App.getArgumentValue("ws"));
}
@@ -150,9 +163,12 @@ public class WireScan extends Panel {
buttonScan.setEnabled((state==State.Ready) && validWireScan && homed);
buttonAbort.setEnabled(state==State.Busy);
comboScanType.setEnabled(validWireScan);
comboBpm1.setEnabled(validWireScan);
comboBpm2.setEnabled(validWireScan);
comboBpm3.setEnabled(validWireScan);
for (JComboBox cb : bpmCombos){
cb.setEnabled(validWireScan);
}
for (JComboBox cb : blmCombos){
cb.setEnabled(validWireScan);
}
buttonMotorPanel.setEnabled(validWireScan);
buttonScannerPanel.setEnabled(validWireScan);
buttonHoming.setEnabled(validWireScan);
@@ -317,6 +333,12 @@ public class WireScan extends Panel {
spinnerEndY = new javax.swing.JSpinner();
jLabel15 = new javax.swing.JLabel();
panelPosition1 = new ch.psi.pshell.swing.DeviceValuePanel();
jLabel16 = new javax.swing.JLabel();
comboBlm3 = new javax.swing.JComboBox();
jLabel17 = new javax.swing.JLabel();
comboBlm2 = new javax.swing.JComboBox();
comboBlm1 = new javax.swing.JComboBox();
jLabel18 = new javax.swing.JLabel();
comboWireScanner.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -452,6 +474,15 @@ public class WireScan extends Panel {
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel15.setText("Trigger(Hz):");
jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel16.setText("BLM 3:");
jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel17.setText("BLM 2:");
jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel18.setText("BLM 1:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -479,9 +510,12 @@ public class WireScan extends Panel {
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.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)
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17, 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)
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -511,7 +545,10 @@ public class WireScan extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStartY)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
@@ -598,7 +635,19 @@ public class WireScan extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboBpm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(18, 24, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18)
.addComponent(comboBlm1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboBlm2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboBlm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel11)
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -623,7 +672,7 @@ public class WireScan extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel10)
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 24, Short.MAX_VALUE)
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAbort)
.addComponent(buttonScan)
@@ -655,10 +704,16 @@ public class WireScan extends Panel {
for (JComboBox cb : bpmCombos){
cb.setSelectedItem("");
}
for (JComboBox cb : blmCombos){
cb.setSelectedItem("");
}
} else {
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scanners_bpms('" + currentScannner + "')", true);
comboBpm1.setSelectedItem((ret==null) ? "" : ret.get(0));
comboBpm2.setSelectedItem((ret==null) ? "" : ret.get(1));
ret = (List<String>) ((Plugin)this).eval("get_wire_scanners_blms('" + currentScannner + "')", true);
comboBlm1.setSelectedItem((ret==null) ? "" : ret.get(0));
comboBlm2.setSelectedItem((ret==null) ? "" : ret.get(1));
int selection = Epics.get(currentScannner + ":WIRE_SP", Integer.class);
//comboSelection.setSelectedIndex(selection); //TODO: FIX
spinnerVel.setValue(Epics.get(currentScannner + ":SCAN_VELO_SP", Double.class));
@@ -690,6 +745,9 @@ public class WireScan extends Panel {
for (JComboBox cb : bpmCombos){
cb.setSelectedItem("");
}
for (JComboBox cb : blmCombos){
cb.setSelectedItem("");
}
}
onStateChange(getState(), getState());
}//GEN-LAST:event_comboWireScannerActionPerformed
@@ -734,6 +792,11 @@ public class WireScan extends Panel {
}
parameters.add(bpms);
ArrayList blms = new ArrayList();
for (JComboBox cb : blmCombos){
if (!cb.getSelectedItem().toString().isEmpty()){
blms.add(cb.getSelectedItem().toString());
}
}
parameters.add(blms);
getContext().addScanListener(scanListener);
@@ -830,6 +893,9 @@ public class WireScan extends Panel {
private javax.swing.JButton buttonPark;
private javax.swing.JButton buttonScan;
private javax.swing.JButton buttonScannerPanel;
private javax.swing.JComboBox comboBlm1;
private javax.swing.JComboBox comboBlm2;
private javax.swing.JComboBox comboBlm3;
private javax.swing.JComboBox comboBpm1;
private javax.swing.JComboBox comboBpm2;
private javax.swing.JComboBox comboBpm3;
@@ -842,6 +908,9 @@ public class WireScan extends Panel {
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
+75
View File
@@ -0,0 +1,75 @@
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
CAMERA = "S10DI01-DSCR020" #"simulation"
QUADRUPOLE = "S10CB02-MQUA230"
CHARGE_BPM = "SINEG01-DBPM340:Q1"
CHARGE_ICT = "SINEG01-DICT215:B1_CHARGE-OP"
RANGE = (-2.0, 2.0)
STEPS = 10
SETTLING_TIME = 1.0
#kill_camtool()
check_camtool()
print camtool.getCameras()
#camtool.start("SINBD01-DSCR010")
camtool.start(CAMERA)
camtool.stream.waitCacheChange(10000)
print camtool.value.identifiers
#plot(camtool.getValue("y_fit_gauss_function"))
m=camtool.getDataMatrix()
x = camtool.stream.getChild("x_fit_mean")
y = camtool.stream.getChild("y_fit_mean")
"""
ax = create_averager(x, 5, -1, "X Fit")
ay = create_averager(y, 5, -1, "Y Fit")
ay.monitored = True
"""
set_device_alias(m,"image")
#Create quadrupole device
quad = ControlledVariable(QUADRUPOLE, QUADRUPOLE + ":I-SET", QUADRUPOLE + ":I-READ")
quad.config.minValue =-10.0
quad.config.maxValue = 10.0
quad.config.precision = 3
quad.config.resolution = 0.007
quad.config.save()
quad.initialize()
bpm = Channel(CHARGE_BPM, 'd', alias = "Charge BPM")
ict = Channel(CHARGE_ICT, 'd', alias = "Charge ICT")
#Metadata
try:
set_attribute("/", "Camera", CAMERA)
set_attribute("/", "Quadrupole", QUADRUPOLE)
set_attribute("/", "Scan Parameters", RANGE + (STEPS,))
set_attribute("/", "Screen Position", caget(CAMERA + ":GET_SCREEN1_POS", 's'))
set_attribute("/", "Camera", CAMERA)
except:
pass
try:
laser_off()
#save_dataset("/Background", m.read())
#mscan (camtool.stream, m, 10) #Saves 10 next frames -> For machine at 10 -> 100Hz
tscan(m, 10, 1.0) # 10 samples every 0.2 s -> For machine at 1Hz
laser_on()
#tscan((m, x, y), 10, 1.0) # 10 samples every 1.0 s
#mscan (camtool.stream,(m, x, y), -1, 5.0) #Saves all frames received in 5s
#mscan (camtool.stream,(m, x, y), 50) # Saves firs 50 frames
#lscan(quad, (m, x, y), RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME)
readables = camtool.stream.getReadables().clone() + [bpm, ict]
readables.remove(camtool.stream.getChild("image"))
readables.insert(0,m)
lscan(quad, readables, RANGE[0], RANGE[1], STEPS, latency=SETTLING_TIME)
finally:
quad.close()
camtool.stop()
+24 -8
View File
@@ -1,16 +1,32 @@
#check_camtool()
CAMERA = "simulation"
#kill_camtool()
check_camtool()
print camtool.getCameras()
#camtool.start("SINBD01-DSCR010")
camtool.start(CAMERA)
camtool.stream.waitCacheChange(10000)
#print camtool.getValue().getIdentifiers()
print camtool.value.identifiers
#plot(camtool.getValue("y_fit_gauss_function"))
x = CamtoolValue("gr_x_fit_mean")
m=camtool.getDataMatrix()
x = camtool.stream.getChild("x_fit_mean")
y = camtool.stream.getChild("y_fit_mean")
"""
ax = create_averager(x, 5, -1, "X Fit")
ay = create_averager(y, 5, -1, "Y Fit")
ay.monitored = True
"""
set_device_alias(m,"image")
av = create_averager(x, 5, 0.05, "Average")
av.setMonitored(True)
tscan(av, 10, 1.0)
try:
tscan((m, x, y), 10, 1.0)
mscan (camtool.stream,(m, x, y), -1, 5.0)
finally:
camtool.stop()