From 612857114537f5e5de86e0d9caf6eba08e15cb71 Mon Sep 17 00:00:00 2001 From: sfop Date: Mon, 1 May 2017 10:50:49 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 20 +++---- devices/S10CB02-MQUA230.properties | 8 +++ devices/camtool.properties | 10 ++-- plugins/ScreenPanel.java | 63 +++++++++++++++++----- plugins/WireScan.form | 49 ++++++++++++++++- plugins/WireScan.java | 85 +++++++++++++++++++++++++++--- script/Diagnostics/CamtoolScan.py | 75 ++++++++++++++++++++++++++ script/test/TestCamtoolClient.py | 32 ++++++++--- 8 files changed, 295 insertions(+), 47 deletions(-) create mode 100644 devices/S10CB02-MQUA230.properties create mode 100644 script/Diagnostics/CamtoolScan.py diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 3ec529a..c0b5b9b 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -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 diff --git a/devices/S10CB02-MQUA230.properties b/devices/S10CB02-MQUA230.properties new file mode 100644 index 0000000..54a61e1 --- /dev/null +++ b/devices/S10CB02-MQUA230.properties @@ -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 diff --git a/devices/camtool.properties b/devices/camtool.properties index 2062a38..ded17f8 100644 --- a/devices/camtool.properties +++ b/devices/camtool.properties @@ -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 diff --git a/plugins/ScreenPanel.java b/plugins/ScreenPanel.java index 135ae37..5149878 100644 --- a/plugins/ScreenPanel.java +++ b/plugins/ScreenPanel.java @@ -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 { diff --git a/plugins/WireScan.form b/plugins/WireScan.form index c650e1c..f186818 100644 --- a/plugins/WireScan.form +++ b/plugins/WireScan.form @@ -42,9 +42,12 @@ + + + @@ -84,6 +87,9 @@ + + + @@ -179,7 +185,22 @@ - + + + + + + + + + + + + + + + + @@ -209,7 +230,7 @@ - + @@ -479,5 +500,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/WireScan.java b/plugins/WireScan.java index 11a291b..b4e2ef4 100644 --- a/plugins/WireScan.java +++ b/plugins/WireScan.java @@ -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) ((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 ret = (List) ((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) ((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; diff --git a/script/Diagnostics/CamtoolScan.py b/script/Diagnostics/CamtoolScan.py new file mode 100644 index 0000000..4f09b6a --- /dev/null +++ b/script/Diagnostics/CamtoolScan.py @@ -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() + diff --git a/script/test/TestCamtoolClient.py b/script/test/TestCamtoolClient.py index 384ee9f..cbcb8ee 100644 --- a/script/test/TestCamtoolClient.py +++ b/script/test/TestCamtoolClient.py @@ -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()