Fix grab_frame

This commit is contained in:
gac-x11ma
2021-12-14 14:25:13 +01:00
parent 69915afdb6
commit 065e33ad05
76 changed files with 5774 additions and 1156 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
config/ROIs/saraROI.roi Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1,39 +1,23 @@
#Fri Mar 05 11:56:08 CET 2021
imageSourcesFile={config}/imaging.properties
#Wed Oct 27 10:03:30 CEST 2021
autoSaveScanData=true
simulation=false
commandExecutionEvents=true
logDaysToLive=7
dataScanSaveOutput=false
userAuthenticator=
logLevelConsole=Off
scanStreamerPort=-1
dataScanSaveScript=false
dataScanSaveSetpoints=false
notifiedTasks=EigerAbsSpec|Eiger2Img
parallelInitialization=true
dataTransferPath=~/Data1
scanStreamingPort=-1
saveConsoleSessionFiles=false
devicePoolFile={config}/devices.properties
versionTrackingManual=true
dataTransferMode=Off
hostName=null
userManagement=true
instanceName=SIM
disableEmbeddedAttributes=false
dataServerPort=-1
hideServerMessages=false
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}/{date}_{seq}%04d_{name}
serverEnabled=false
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
logLevel=Info
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
dataLayout=table
disableDataFileLogs=false
sessionHandling=On
@@ -41,10 +25,31 @@ deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=Completion
terminalPort=3579
tasksFile={config}/tasks.properties
dataTransferUser=
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x11ma.git
imageSourcesFile={config}/imaging.properties
commandExecutionEvents=true
logDaysToLive=7
logLevelConsole=Off
filePermissionsConfig=Public
scanStreamerPort=-1
dataScanSaveSetpoints=false
versionTrackingManual=true
dataTransferMode=Off
userManagement=true
instanceName=SIM
dataServerPort=-1
hideServerMessages=false
dataScanReleaseRecords=false
dataScanPreserveTypes=false
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
filePermissionsLogs=Public
filePermissionsScripts=Public
tasksFile={config}/tasks.properties
filePermissionsData=Default
createSessionFiles=false
dataProvider=txt
saveCommandStatistics=false

12
config/devices.properties Executable file → Normal file
View File

@@ -1,6 +1,5 @@
#fe_slit_V_ctr:offset=ch.psi.pshell.epics.ChannelDouble||||
eiger=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-SD1|||true
fe_slit_V_ctr=ch.psi.pshell.epics.Motor|X11MA-FE-SV:center|||true
#fe_slit_H_ctr_offset=ch.psi.pshell.epics.ChannelDouble||||
fe_slit_H_ctr=ch.psi.pshell.epics.Motor|X11MA-FE-SH:center|||true
fe_slit_V_size_offs=ch.psi.pshell.epics.ChannelDouble|X11MA-FE-DSVER.A|||true
fe_slit_V_size=ch.psi.pshell.epics.Motor|X11MA-FE-SV:size|||true
@@ -69,7 +68,6 @@ keithley_1a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true
keithley_2a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true
keithley_3a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true
otf_start=ch.psi.pshell.epics.ChannelInteger|X11MA-OTF:GO|||true
eiger=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-SD1|||true
eiger_bit_depth_rbv=ch.psi.pshell.epics.ChannelInteger|X11MA-ES1-SD1:cam1:BitDepth_RBV|Read||true
eiger_mode_rbv=ch.psi.pshell.epics.ChannelString|X11MA-ES1-SD1:cam1:ImageMode_RBV|Read||true
eiger_exposure_rbv=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1-SD1:cam1:AcquireTime_RBV 2|Read||true
@@ -78,15 +76,15 @@ eiger_bit_depth=ch.psi.pshell.epics.ChannelInteger|X11MA-ES1-SD1:cam1:BitDepth||
eiger_mode=ch.psi.pshell.epics.ChannelInteger|X11MA-ES1-SD1:cam1:ImageMode|||true
eiger_exposure=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1-SD1:cam1:AcquireTime 2|||true
Ecrbk=ch.psi.pshell.epics.ChannelDouble|X11MA-PGM:CERBK|Read||true
#CADC1=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true
#CADC2=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true
#CADC3=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true
CADC1=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true
CADC2=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true
CADC3=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true
#CADC4=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC4|Read||true
#CADC5=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC5|Read||true
#CADC6=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC6|Read||true
#CADC7=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC7|Read||true
girder_x=ch.psi.pshell.epics.Positioner|X11MA-HG:X_SET X11MA-HG:X1|||true
cam2=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-CAM2|||true
image=ch.psi.pshell.imaging.CameraSource|eiger|||true
raw=ch.psi.pshell.imaging.CameraSource|eiger|||true
image2=ch.psi.pshell.imaging.CameraSource|cam2|||true
axis=ch.psi.pshell.imaging.MjpegSource|http://axis-x11ma.psi.ch/axis-cgi/mjpg/video.cgi?id=176 true||-200|false

View File

@@ -1,3 +1,10 @@
Align_ComputeShifts.java=disabled
Imaging.java=disabled
Initialization.java=disabled
TestLuka.java=disabled
Align_TranslationFilter.java=disabled
ShiftsIO.java=disabled
Align_ComplexEdgeFiltering.java=disabled
OTFScanBase.java=enabled
EnergyScanBase.java=enabled
DelayScanBase.java=enabled

View File

@@ -1,5 +1,5 @@
#Thu Sep 02 13:21:00 CEST 2021
#Sat Dec 04 14:45:18 CET 2021
keywords=List;[]
ownerEmail=String;jinghui.luo@psi.ch
ownerEmail=String;arik.beck@psi.ch
contactEmail=String;armin.kleibert@psi.ch
owner=String;Jinghui Luo
owner=String;Federico Stramaglia

View File

@@ -1,2 +1,2 @@
#Fri Sep 03 09:21:14 CEST 2021
SessionCounter=38
#Mon Nov 29 10:07:24 CET 2021
SessionCounter=54

12
config/settings.properties Executable file → Normal file
View File

@@ -1,18 +1,18 @@
#Thu Sep 09 14:50:51 CEST 2021
#Tue Dec 14 13:48:54 CET 2021
HARMONIC_ID_1=1
RSYNC_USER=
OUTLIERS_THRESHOLD=1000000000
NORM_FILE=/sls/X11MA/data/X11MA/Data1/2021/Yona250121/s250121
NORM_FILE=/sls/X11MA/data/e19357/Data1/2021_10
AUTO_SWITCH_VALVE=true
DRY_RUN=false
POL_ID_2=Lin_Hor
OFFSET_ID_1=0.0
OFFSET_ID_1=-5.0
ID=ID2
OFFSET_ID_2=0.0
OFFSET_ID_2=-2.1
proposal=proposal
ENERGY=706.3
ENERGY=800.0
proposer=proposer
POL_ID_1=Circ_Plus
POL_ID_1=Lin_Hor
RSYNC_HOST=
sample=sample
RSYNC_PATH=

8
config/variables.properties Executable file → Normal file
View File

@@ -1,4 +1,4 @@
#Mon Sep 13 13:08:47 CEST 2021
LastRunDate=210913
FileSequentialNumber=9757
DaySequentialNumber=34
#Sat Dec 11 05:45:56 CET 2021
LastRunDate=211211
FileSequentialNumber=11873
DaySequentialNumber=66

4
devices/girder_x.properties Executable file → Normal file
View File

@@ -1,10 +1,10 @@
#Wed May 05 15:14:33 CEST 2021
#Tue Nov 02 11:19:09 CET 2021
offset=0.0
maxValue=3.0
rotation=false
precision=3
scale=1.0
resolution=0.005
minValue=2.0
minValue=-2.0
unit=mm
sign_bit=0

View File

@@ -1,4 +1,4 @@
#Mon Sep 13 13:04:13 CEST 2021
#Mon Oct 25 14:11:15 CEST 2021
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
@@ -6,12 +6,12 @@ scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=7000.0
colormapMax=2000.0
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=2000.0
colormapMin=0.0
rotationCrop=false
rotation=0.0
rescaleFactor=1.0
@@ -19,7 +19,7 @@ spatialCalUnits=null
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false

25
devices/raw.properties Normal file
View File

@@ -0,0 +1,25 @@
#Fri Nov 26 15:39:45 CET 2021
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false

View File

@@ -0,0 +1,20 @@
#Wed Oct 27 15:54:42 CEST 2021
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -330,16 +330,23 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
<Component id="rendererRoi" pref="427" max="32767" attributes="0"/>
<Component id="rendererRoi" pref="439" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="buttonRoiRemove" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="buttonRoiAdd" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiClear" alignment="0" max="32767" attributes="0"/>
<Component id="buttonRoiOpen" alignment="0" max="32767" attributes="0"/>
<Component id="buttonRoiSave" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="buttonRoiRemove" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="buttonRoiAdd" alignment="0" pref="200" max="32767" attributes="0"/>
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiClear" alignment="0" max="32767" attributes="0"/>
<Component id="buttonRoiOpen" alignment="0" max="32767" attributes="0"/>
<Component id="buttonRoiSave" alignment="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textFOV" min="-2" pref="158" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
</Group>
@@ -355,10 +362,15 @@
<Component id="buttonRoiAdd" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiRemove" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textFOV" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel26" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="175" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="227" max="32767" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiClear" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
@@ -485,6 +497,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiOpenActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textFOV">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="FOV:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">

View File

@@ -27,6 +27,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.script.ScriptException;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
@@ -34,6 +36,7 @@ import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.filechooser.FileNameExtensionFilter;
@@ -165,6 +168,22 @@ public class DataAcquisition extends Panel {
public void onExecutedFile(String fileName, Object result) {
}
@Override
protected void onShow() {
super.onShow();
new Thread(()->{
String fov="";
try {
fov = String.valueOf(eval("microscope.get_preset_label()", true));
} catch (Exception ex) {
}
String label =fov;
SwingUtilities.invokeLater(()->{
textFOV.setText(label);
});
}).start();
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
@@ -261,8 +280,8 @@ public class DataAcquisition extends Panel {
model.setValueAt(rois.get(i).getWidth(), i, 3);
model.setValueAt(rois.get(i).getHeight(), i, 4);
}
Map<String, List<Integer>> roi_dict = getRois();
setGlobalVar("DAQ_PANEL_ROIS", roi_dict);
Map<String, List<Integer>> roi_dict = getRois();
setGlobalVar("DAQ_PANEL_ROIS", roi_dict);
}
void addRoi(Rect roi) {
@@ -493,6 +512,8 @@ public class DataAcquisition extends Panel {
buttonRoiClear = new javax.swing.JButton();
buttonRoiSave = new javax.swing.JButton();
buttonRoiOpen = new javax.swing.JButton();
textFOV = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
buttonImgStart = new javax.swing.JButton();
buttonImgAbort = new javax.swing.JButton();
@@ -860,22 +881,33 @@ public class DataAcquisition extends Panel {
}
});
textFOV.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textFOV.setDisabledTextColor(new java.awt.Color(0, 0, 0));
textFOV.setEnabled(false);
jLabel7.setText("FOV:");
javax.swing.GroupLayout panelRoiLayout = new javax.swing.GroupLayout(panelRoi);
panelRoi.setLayout(panelRoiLayout);
panelRoiLayout.setHorizontalGroup(
panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRoiLayout.createSequentialGroup()
.addGap(17, 17, 17)
.addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE)
.addComponent(rendererRoi, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(buttonRoiRemove, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(buttonRoiAdd, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jLabel26)
.addComponent(buttonRoiClear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRoiOpen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRoiSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(buttonRoiRemove, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(buttonRoiAdd, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jLabel26)
.addComponent(buttonRoiClear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRoiOpen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRoiSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelRoiLayout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(13, 13, 13))
);
panelRoiLayout.setVerticalGroup(
@@ -888,10 +920,14 @@ public class DataAcquisition extends Panel {
.addComponent(buttonRoiAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonRoiRemove, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelRoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel26)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(buttonRoiClear, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -2036,6 +2072,7 @@ public class DataAcquisition extends Panel {
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
@@ -2099,6 +2136,7 @@ public class DataAcquisition extends Panel {
private javax.swing.JTable tableRegions;
private javax.swing.JTable tableRoi;
private javax.swing.JButton textClearOutliersMask;
private javax.swing.JTextField textFOV;
private javax.swing.JTextField textNorm;
private javax.swing.JTextField textOutliersMask;
private javax.swing.JButton textSelectOutliersMask;

View File

@@ -20,29 +20,46 @@
<EmptySpace 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="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="renderer" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="224" max="-2" attributes="0"/>
<Component id="buttonDone" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonCloseVG10" min="-2" pref="127" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="spinnerExposure" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel3" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel4" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonShowDetectorPanel" min="-2" pref="127" max="-2" attributes="0"/>
<Component id="checkMeasurements" min="-2" max="-2" attributes="0"/>
<Component id="comboScale" alignment="0" min="-2" pref="104" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="spinnerMax" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerMin" alignment="0" pref="72" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="spinnerExposure" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel3" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel4" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonShowDetectorPanel" min="-2" pref="127" max="-2" attributes="0"/>
</Group>
<Component id="textFOV" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="86" pref="86" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="comboMode" linkSize="1" min="-2" max="-2" attributes="0"/>
@@ -60,24 +77,14 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonOpenVG10" min="-2" pref="127" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="118" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="renderer" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="checkMeasurements" min="-2" max="-2" attributes="0"/>
<Component id="comboScale" alignment="0" min="-2" pref="104" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="spinnerMax" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerMin" alignment="0" pref="72" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="310" pref="310" max="-2" attributes="0"/>
<Component id="buttonDone" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonCloseVG10" min="-2" pref="127" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="118" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@@ -114,6 +121,11 @@
<Component id="deviceValuePanel4" linkSize="2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonShowDetectorPanel" alignment="2" min="-2" pref="35" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textFOV" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
@@ -134,7 +146,7 @@
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="renderer" pref="409" max="32767" attributes="0"/>
<Component id="renderer" pref="368" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@@ -329,5 +341,19 @@
<Property name="text" type="java.lang.String" value="Min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="FOV:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textFOV">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -6,6 +6,7 @@ import ch.psi.utils.State;
import java.io.IOException;
import java.util.logging.Level;
import java.util.concurrent.TimeUnit;
import javax.swing.SwingUtilities;
/**
*
@@ -69,16 +70,32 @@ public class Eiger extends Panel {
try{
spinnerExposure.setValue(exposure.take());
} catch (Exception ex){
}
}
comboDepth.setEnabled(bitDepth.isInitialized());
comboMode.setEnabled(mode.isInitialized());
spinnerExposure.setEnabled(exposure.isInitialized());
} finally{
updatingControls=false;
}
}
}
@Override
protected void onShow() {
super.onShow();
new Thread(()->{
String fov="";
try {
fov = String.valueOf(eval("microscope.get_preset_label()", true));
} catch (Exception ex) {
}
String label =fov;
SwingUtilities.invokeLater(()->{
textFOV.setText(label);
});
}).start();
}
//Callback to perform update - in event thread
@Override
@@ -112,6 +129,8 @@ public class Eiger extends Panel {
spinnerMin = new javax.swing.JSpinner();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
textFOV = new javax.swing.JTextField();
renderer.setDeviceName("image");
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Stretch);
@@ -224,6 +243,12 @@ public class Eiger extends Panel {
jLabel6.setText("Min:");
jLabel7.setText("FOV:");
textFOV.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textFOV.setDisabledTextColor(new java.awt.Color(0, 0, 0));
textFOV.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -231,41 +256,6 @@ public class Eiger extends Panel {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(224, 224, 224)
.addComponent(buttonDone, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(118, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -278,10 +268,50 @@ public class Eiger extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spinnerMax, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerMin, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(86, 86, 86)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(310, 310, 310)
.addComponent(buttonDone, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(118, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure, textFOV});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -309,6 +339,10 @@ public class Eiger extends Panel {
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(textFOV, 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.createSequentialGroup()
.addGap(36, 36, 36)
@@ -328,10 +362,10 @@ public class Eiger extends Panel {
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE))))
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExposure});
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExposure, textFOV});
}// </editor-fold>//GEN-END:initComponents
@@ -515,9 +549,11 @@ public class Eiger extends Panel {
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spinnerExposure;
private javax.swing.JSpinner spinnerMax;
private javax.swing.JSpinner spinnerMin;
private javax.swing.JTextField textFOV;
// End of variables declaration//GEN-END:variables
}

595
plugins/Imaging.form Normal file
View File

@@ -0,0 +1,595 @@
<?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="buttonGroup1">
</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">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="renderer" pref="376" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="renderer" max="32767" attributes="0"/>
<Component id="jPanel4" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer">
<Properties>
<Property name="mode" type="ch.psi.pshell.imaging.RendererMode" editor="org.netbeans.modules.form.editors.EnumEditor">
<Value id="Fit"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel4">
<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" max="-2" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<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="Auto-Intensity"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStartAutoIntensity" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStartAutoIntensity" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStartAutoIntensity">
<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="buttonStartAutoIntensityActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<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>
<Container class="javax.swing.JPanel" name="jPanel1">
<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="ROI"/>
</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" attributes="0">
<Component id="buttonRoiClear" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonRoiSet" linkSize="3" min="-2" pref="60" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerWidth" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel2" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerHeight" linkSize="2" min="-2" 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">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonRoiClear" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonRoiSet" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerWidth" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerHeight" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonRoiSet">
<Properties>
<Property name="text" type="java.lang.String" value="Set"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiSetActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonRoiClear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRoiClearActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Width:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerWidth">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="16"/>
<ListItem value="32"/>
<ListItem value="64"/>
<ListItem value="128"/>
<ListItem value="256"/>
<ListItem value="512"/>
</SpinnerModel>
</Property>
<Property name="value" type="java.lang.Object" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="&quot;256&quot;" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerWidthStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Height"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerHeight">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="16"/>
<ListItem value="32"/>
<ListItem value="64"/>
<ListItem value="128"/>
<ListItem value="256"/>
<ListItem value="512"/>
</SpinnerModel>
</Property>
<Property name="value" type="java.lang.Object" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="&quot;256&quot;" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerHeightStateChanged"/>
</Events>
</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="Auto-Focus"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerAverage" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRuns" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExposition" linkSize="5" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="97" max="-2" attributes="0"/>
<Component id="buttonStartAutoFocus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jPanel6" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerAverage" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRuns" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExposition" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Component id="jPanel6" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="buttonStartAutoFocus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStartAutoFocus">
<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="buttonStartAutoFocusActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Average:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerAverage">
<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>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerAverageStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Runs:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerRuns">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="10" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerRunsStateChanged"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel5">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="radioObjective" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="radioStigA" min="-2" max="-2" attributes="0"/>
<Component id="radioStigB" min="-2" max="-2" attributes="0"/>
<Component id="radioAll" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="radioObjective" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="radioStigA" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="radioStigB" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="radioAll" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JRadioButton" name="radioObjective">
<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="Objective"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioObjectiveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioStigA">
<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="Stigmator A"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioStigAActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioStigB">
<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="Stigmator B"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioStigBActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioAll">
<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="All"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioAllActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<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" attributes="0">
<Component id="jLabel5" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRangeObj" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel6" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepObj" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel7" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRangeStig" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel8" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepStig" linkSize="7" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRangeObj" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepObj" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerRangeStig" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepStig" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JSpinner" name="spinnerRangeObj">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="4.0" maximum="10.0" minimum="1.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerRangeObjStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Range Objective:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Step Objective:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepObj">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.2" maximum="1.0" minimum="0.1" numberType="java.lang.Double" stepSize="0.1" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerStepObjStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Range Stigmator:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerRangeStig">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="20.0" maximum="40.0" minimum="1.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerRangeStigStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Step Stigmator:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepStig">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="2.0" maximum="10.0" minimum="1.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerStepStigStateChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="Exposure:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerExposition">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="NaN" maximum="NaN" minimum="0.01" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerExpositionStateChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

747
plugins/Imaging.java Normal file
View File

@@ -0,0 +1,747 @@
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays.Rect;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.RendererListener;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.awt.Rectangle;
import java.util.HashMap;
/**
*
*/
public class Imaging extends Panel {
static double NaNd = Double.NaN; //Bug on editor?
public Imaging() {
initComponents();
renderer.addListener(rendererListener);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
try {
setGlobalVar("IMAGING_RENDERER", renderer);
setRoi(getRoi());
} catch (Exception ex) {
showException(ex);
}
}
@Override
public void onStateChange(State state, State former) {
buttonAbort.setEnabled(state.isProcessing());
updateButtons();
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
void updateButtons(){
boolean enabled = getState()==State.Ready;
boolean hasRoi = false;
try{
hasRoi = getRoi()!=null;
} catch (Exception ex){
}
buttonStartAutoFocus.setEnabled(hasRoi && enabled);
buttonStartAutoIntensity.setEnabled(enabled);
buttonRoiClear.setEnabled(hasRoi && enabled);
buttonRoiSet.setEnabled(!hasRoi && enabled);
spinnerAverage.setEnabled(enabled);
spinnerRuns.setEnabled(enabled);
spinnerExposition.setEnabled(enabled);
spinnerRangeObj.setEnabled((radioObjective.isSelected() || radioAll.isSelected()) && enabled);
spinnerStepObj.setEnabled(spinnerRangeObj.isEnabled());
spinnerRangeStig.setEnabled((!radioObjective.isSelected()) && enabled);
spinnerStepStig.setEnabled(spinnerRangeStig.isEnabled());
radioObjective.setEnabled(enabled);
radioStigA.setEnabled(enabled);
radioStigB.setEnabled(enabled);
radioAll.setEnabled(enabled);
}
@Override
protected void onShow() {
super.onShow();
renderer.setDeviceName("image");
}
@Override
protected void onHide() {
super.onHide();
renderer.setDeviceName(null);
}
Rectangle getRoi(){
return (Rectangle) getGlobalVar("IMAGING_ROI");
}
void setRoi(Rectangle roi){
setGlobalVar("IMAGING_ROI", roi);
try{
renderer.clearOverlays();
if (roi!=null){
Rect ov = new Rect(renderer.getPenProfile(), roi.getLocation(), roi.getSize());
ov.setMovable(true);
renderer.addOverlay(ov);
}
} finally {
updateButtons();
}
}
final RendererListener rendererListener = new RendererListener(){
@Override
public void onMoveFinished(Renderer renderer, Overlay overlay) {
setGlobalVar("IMAGING_ROI", overlay.getBounds());
}
@Override
public void onDeleted(Renderer renderer, Overlay overlay) {
if (getRoi()!=null){
setRoi(null);
}
}
};
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
renderer = new ch.psi.pshell.imaging.Renderer();
jPanel4 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
buttonStartAutoIntensity = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
buttonRoiSet = new javax.swing.JButton();
buttonRoiClear = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
spinnerWidth = new javax.swing.JSpinner();
jLabel2 = new javax.swing.JLabel();
spinnerHeight = new javax.swing.JSpinner();
jPanel3 = new javax.swing.JPanel();
buttonStartAutoFocus = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
spinnerAverage = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
spinnerRuns = new javax.swing.JSpinner();
jPanel5 = new javax.swing.JPanel();
radioObjective = new javax.swing.JRadioButton();
radioStigA = new javax.swing.JRadioButton();
radioStigB = new javax.swing.JRadioButton();
radioAll = new javax.swing.JRadioButton();
jPanel6 = new javax.swing.JPanel();
spinnerRangeObj = new javax.swing.JSpinner();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
spinnerStepObj = new javax.swing.JSpinner();
jLabel7 = new javax.swing.JLabel();
spinnerRangeStig = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
spinnerStepStig = new javax.swing.JSpinner();
jLabel9 = new javax.swing.JLabel();
spinnerExposition = new javax.swing.JSpinner();
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Fit);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Auto-Intensity"));
buttonStartAutoIntensity.setText("Start");
buttonStartAutoIntensity.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartAutoIntensityActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoIntensity)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoIntensity)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("ROI"));
buttonRoiSet.setText("Set");
buttonRoiSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRoiSetActionPerformed(evt);
}
});
buttonRoiClear.setText("Clear");
buttonRoiClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRoiClearActionPerformed(evt);
}
});
jLabel1.setText("Width:");
spinnerWidth.setModel(new javax.swing.SpinnerListModel(new String[] {"16", "32", "64", "128", "256", "512"}));
spinnerWidth.setValue("256");
spinnerWidth.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerWidthStateChanged(evt);
}
});
jLabel2.setText("Height");
spinnerHeight.setModel(new javax.swing.SpinnerListModel(new String[] {"16", "32", "64", "128", "256", "512"}));
spinnerHeight.setValue("256");
spinnerHeight.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerHeightStateChanged(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(buttonRoiClear)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonRoiSet, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerHeight, spinnerWidth});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonRoiClear, buttonRoiSet});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonRoiClear)
.addComponent(buttonRoiSet)
.addComponent(jLabel1)
.addComponent(spinnerWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(spinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Auto-Focus"));
buttonStartAutoFocus.setText("Start");
buttonStartAutoFocus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartAutoFocusActionPerformed(evt);
}
});
jLabel3.setText("Average:");
spinnerAverage.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));
spinnerAverage.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerAverageStateChanged(evt);
}
});
jLabel4.setText("Runs:");
spinnerRuns.setModel(new javax.swing.SpinnerNumberModel(1, 0, 10, 1));
spinnerRuns.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerRunsStateChanged(evt);
}
});
buttonGroup1.add(radioObjective);
radioObjective.setSelected(true);
radioObjective.setText("Objective");
radioObjective.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioObjectiveActionPerformed(evt);
}
});
buttonGroup1.add(radioStigA);
radioStigA.setText("Stigmator A");
radioStigA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioStigAActionPerformed(evt);
}
});
buttonGroup1.add(radioStigB);
radioStigB.setText("Stigmator B");
radioStigB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioStigBActionPerformed(evt);
}
});
buttonGroup1.add(radioAll);
radioAll.setText("All");
radioAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
radioAllActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(radioObjective)
.addComponent(radioStigA)
.addComponent(radioStigB)
.addComponent(radioAll))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(radioObjective)
.addGap(0, 0, 0)
.addComponent(radioStigA)
.addGap(0, 0, 0)
.addComponent(radioStigB)
.addGap(0, 0, 0)
.addComponent(radioAll)
.addGap(0, 0, 0))
);
spinnerRangeObj.setModel(new javax.swing.SpinnerNumberModel(4.0d, 1.0d, 10.0d, 1.0d));
spinnerRangeObj.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerRangeObjStateChanged(evt);
}
});
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Range Objective:");
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Step Objective:");
spinnerStepObj.setModel(new javax.swing.SpinnerNumberModel(0.2d, 0.1d, 1.0d, 0.1d));
spinnerStepObj.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerStepObjStateChanged(evt);
}
});
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel7.setText("Range Stigmator:");
spinnerRangeStig.setModel(new javax.swing.SpinnerNumberModel(20.0d, 1.0d, 40.0d, 1.0d));
spinnerRangeStig.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerRangeStigStateChanged(evt);
}
});
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Step Stigmator:");
spinnerStepStig.setModel(new javax.swing.SpinnerNumberModel(2.0d, 1.0d, 10.0d, 1.0d));
spinnerStepStig.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerStepStigStateChanged(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRangeObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRangeStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, 0))
);
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7, jLabel8});
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerRangeObj, spinnerRangeStig, spinnerStepObj, spinnerStepStig});
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(spinnerRangeObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(spinnerStepObj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(spinnerRangeStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(spinnerStepStig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jLabel9.setText("Exposure:");
spinnerExposition.setModel(new javax.swing.SpinnerNumberModel(NaNd, 0.01d, NaNd, 1.0d));
spinnerExposition.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerExpositionStateChanged(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerAverage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerRuns, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerExposition, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(buttonStartAutoFocus)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerAverage, spinnerExposition, spinnerRuns});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(4, 4, 4)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(spinnerRuns, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(4, 4, 4)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(spinnerExposition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoFocus)
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
.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)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
private void buttonRoiClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiClearActionPerformed
try {
setRoi(null);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonRoiClearActionPerformed
private void buttonRoiSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRoiSetActionPerformed
try {
Rectangle roi = new Rectangle(0,0,Integer.valueOf(spinnerWidth.getValue().toString()),Integer.valueOf(spinnerHeight.getValue().toString()));
setRoi(roi);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonRoiSetActionPerformed
private void spinnerWidthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerWidthStateChanged
try {
Rectangle roi = getRoi();
if (roi!=null){
roi.width = Integer.valueOf(spinnerWidth.getValue().toString());
setRoi(roi);
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_spinnerWidthStateChanged
private void spinnerHeightStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerHeightStateChanged
try {
Rectangle roi = getRoi();
if (roi!=null){
roi.height = Integer.valueOf(spinnerHeight.getValue().toString());
setRoi(roi);
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_spinnerHeightStateChanged
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 buttonStartAutoFocusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartAutoFocusActionPerformed
try {
HashMap args = new HashMap();
String scan_type = "all";
if (radioObjective.isSelected()){
scan_type = "obj";
} else if (radioStigA.isSelected()){
scan_type = "stiga";
} else if (radioStigB.isSelected()){
scan_type = "stigb";
}
int average = (Integer)spinnerAverage.getValue();
int runs = (Integer)spinnerRuns.getValue();
Double exposure = (Double) spinnerExposition.getValue();
//runAsync("templates/AutoFocus", args).handle((ret, t) -> {
//auto_focus(range_obj=4.0, step_obj=0.2, range_stig=20.0, step_stig=2.0, average=1, runs=2, roi=None):
String cmd = "auto_focus(scan_type='" + scan_type + "'" +
", range_obj=" + spinnerRangeObj.getValue() +
", step_obj=" + spinnerStepObj.getValue() +
", range_stig=" + spinnerRangeStig.getValue() +
", step_stig=" + spinnerStepStig.getValue() +
", average=" + average +
", runs=" + runs +
", renderer=IMAGING_RENDERER"+
", roi=IMAGING_ROI"+
", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) + ")";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
showException((Exception) t);
}
return t;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartAutoFocusActionPerformed
private void buttonStartAutoIntensityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartAutoIntensityActionPerformed
try {
//String cmd = "scan_contrast(girder_x, 0.05, 0.005, average=3)";
String cmd = "auto_intensity(roi=IMAGING_ROI)";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
showException((Exception) t);
}
return t;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartAutoIntensityActionPerformed
private void spinnerAverageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerAverageStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerAverageStateChanged
private void spinnerRunsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRunsStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerRunsStateChanged
private void radioStigAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioStigAActionPerformed
updateButtons();
}//GEN-LAST:event_radioStigAActionPerformed
private void spinnerRangeObjStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRangeObjStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerRangeObjStateChanged
private void spinnerStepObjStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStepObjStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerStepObjStateChanged
private void spinnerRangeStigStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerRangeStigStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerRangeStigStateChanged
private void spinnerStepStigStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStepStigStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerStepStigStateChanged
private void radioAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioAllActionPerformed
updateButtons();
}//GEN-LAST:event_radioAllActionPerformed
private void radioObjectiveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioObjectiveActionPerformed
updateButtons();
}//GEN-LAST:event_radioObjectiveActionPerformed
private void radioStigBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioStigBActionPerformed
updateButtons();
}//GEN-LAST:event_radioStigBActionPerformed
private void spinnerExpositionStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpositionStateChanged
// TODO add your handling code here:
}//GEN-LAST:event_spinnerExpositionStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton buttonRoiClear;
private javax.swing.JButton buttonRoiSet;
private javax.swing.JButton buttonStartAutoFocus;
private javax.swing.JButton buttonStartAutoIntensity;
private javax.swing.JLabel jLabel1;
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 jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JRadioButton radioAll;
private javax.swing.JRadioButton radioObjective;
private javax.swing.JRadioButton radioStigA;
private javax.swing.JRadioButton radioStigB;
private ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spinnerAverage;
private javax.swing.JSpinner spinnerExposition;
private javax.swing.JSpinner spinnerHeight;
private javax.swing.JSpinner spinnerRangeObj;
private javax.swing.JSpinner spinnerRangeStig;
private javax.swing.JSpinner spinnerRuns;
private javax.swing.JSpinner spinnerStepObj;
private javax.swing.JSpinner spinnerStepStig;
private javax.swing.JSpinner spinnerWidth;
// End of variables declaration//GEN-END:variables
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,91"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
<Component id="buttonExecShellCmd" min="-2" pref="198" max="-2" attributes="0"/>
<EmptySpace pref="100" max="32767" 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="30" max="-2" attributes="0"/>
<Component id="buttonExecShellCmd" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="243" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonExecShellCmd">
<Properties>
<Property name="text" type="java.lang.String" value="Init"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonExecShellCmdActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,83 @@
import ch.psi.pshell.ui.Panel;
import javax.swing.JButton;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author gac-x11ma
*/
public class Initialization extends Panel {
/**
* Creates new form Initialization
*/
public Initialization() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonExecShellCmd = new javax.swing.JButton();
buttonExecShellCmd.setText("Init");
buttonExecShellCmd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExecShellCmdActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(buttonExecShellCmd, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(100, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(buttonExecShellCmd)
.addContainerGap(243, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonExecShellCmdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecShellCmdActionPerformed
try {
String shellCommand = "exec_cmd(\"ls\")";
boolean background = false;
evalAsync(shellCommand, background).handle((ret, ex) -> {
((JButton) evt.getSource()).setEnabled(true);
if (ex != null) {
showException((Exception) ex);
} else {
getContext().scriptingLog(String.format("Shell command '%s' return value: %s", shellCommand, String.valueOf(ret)));
}
return ret;
});
((JButton) evt.getSource()).setEnabled(false);
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonExecShellCmdActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonExecShellCmd;
// End of variables declaration//GEN-END:variables
}

28
plugins/TestLuka.form Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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">
<EmptySpace min="0" pref="449" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="137" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

52
plugins/TestLuka.java Normal file
View File

@@ -0,0 +1,52 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
/**
*
*/
public class TestLuka extends Panel {
public TestLuka() {
initComponents();
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 449, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 137, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View File

@@ -47,17 +47,17 @@ def update_roi():
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
update_roi()
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# update_roi()
# r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# update_roi()
# r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# update_roi()
# r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# update_roi()
# r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
# update_roi()
# r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
final_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Final state:" , final_state

View File

@@ -0,0 +1,34 @@
#auto_intensity()
#time_sleep(2)
#TakeImage at 710 eV at the given polarization
# do autoajust, give 1 minute to settle, do image aquisition with 5 frame average and go to sleep after
# entire run should take 10 min per loop execution
#Constants
# otf_img(700, 750, time=1, delay = 0.1, exposure=0.2, roi="test", name="test", save_images=True)
AVERAGE1 = 1
AVERAGE2 = 5
EXPOSURE1 = 0.5
EXPOSURE2 = 1.0
MEASUREMENTS = 1
i = 0
#change_energy(709.4)
time.sleep(20)
for i in range(0, 30):
# open_vg10()
#time.sleep(1)
#auto_intensity()
#close_vg10()
time.sleep(30)
#open_vg10()
#otf_img(704, 720, time=1.5, delay = 0.1, exposure=0.5, roi="test", name="400C_H2", save_images=True)
#time.sleep(10)
#close_vg10()
abs_spec(ranges="Fe_L3__Arik_Beck_fine", roi="test", switch_pol = False, scans=1, exposure=EXPOSURE1, average=AVERAGE1)
time.sleep(10)
change_energy(709.4)
time.sleep(10)
take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE1, average=AVERAGE2)
time.sleep(270)
print(i)

View File

@@ -0,0 +1,22 @@
#auto_intensity()
#time_sleep(2)
#TakeImage at 710 eV at the given polarization
# do autoajust, give 1 minute to settle, do image aquisition with 5 frame average and go to sleep after
# entire run should take 10 min per loop execution
#Constants
AVERAGE = 5
EXPOSURE = 1.0
MEASUREMENTS = 1
i = 0
change_energy(709.4)
time.sleep(60)
for i in range(0, 23):
# open_vg10()
#time.sleep(1)
#auto_intensity()
#close_vg10()
time.sleep(60)
take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(534)
print(i)

View File

@@ -0,0 +1,74 @@
#Constants
AVERAGE = 10
EXPOSURE = 5
MEASUREMENTS = 40
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
set_beamline_setup(id ="ID1_ID2", en=706.7, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
#TwoEnergies with lin hor polarization ID2 only (normal)
set_beamline_setup(id ="ID2", en=706.7, pol1="Lin_Hor")
two_energies(706.7, 703, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
#TwoEnergies with lin hor polarization ID2 only (normal)
set_beamline_setup(id ="ID2", en=464.2, pol1="Lin_Hor")
two_energies(462.6, 458.2, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
#Constants
AVERAGE2 = 4
EXPOSURE2 = 4.0
change_energy(703)
abs_spec(ranges="Fe_L32__Arik_Beck_fine", roi="saraROI", switch_pol=False, scans=1, exposure=EXPOSURE2, average=AVERAGE2)
#Constants
AVERAGE3 = 1
EXPOSURE3 = 4.0
change_energy(450)
abs_spec(ranges="Ti_Sara", roi="saraROI", switch_pol=False, scans=1, exposure=EXPOSURE3, average=AVERAGE3)
change_energy(523)
abs_spec(ranges="O_Sara", roi="saraROI", switch_pol=False, scans=1, exposure=EXPOSURE3, average=AVERAGE3)
#TakeImage at 710 eV at the given polarization
#change_energy(710)
#take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
#set_beamline_setup(id ="ID1_ID2", en=710, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
#two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#TwoEnergies with lin hor polarization ID2 only (normal)
#set_beamline_setup(id ="ID2", en=710, pol1="Lin_Hor")
#two_energies(705, 710, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#abs_spec(ranges=[[500.0, 1000.0, 100.0],], switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE) #Use manulally defined ranges and rois defined in GUI
#Direct functions to change energy, pol, offset:
#change_energy(700)
#change_pol(1, "Circ_Plus" ) #Pol on ID1: "Circ_Plus", "Circ_Minus" , "Lin_Hor", "Lin_Ver"
#change_pol(1, "Lin" , alpha = "0" ) #Lin pol on ID 1
#change_offset(1, 0.0) #offset on ID1
#Auto-switching:
#switch_pol()
#Restoring beamline state defined in last set_beamline_setut:
#restore_beamline_setup()

View File

@@ -0,0 +1,11 @@
set_exec_pars(open=False)
print('la')
run("templates/Eiger2Img", { \
"METHOD": "Take_Image", "AUTO_SAVE": True, \
"MEASUREMENTS": 1, "EXPOSURE": 1, "AVERAGE": 1, \
"SWITCHING": None, "SEQUENCE": None, \
"ENERGY_1":None, "ENERGY_2":None, \
"NUMBER_SCANS":1, "SWITCH_POL": False, \
})

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,21 @@
#Constants
AVERAGE = 1
EXPOSURE = 1.0
EXPOSURE = 2.0
MEASUREMENTS = 50
#Energies=[635, 635.5]
Energies=[637, 637.2, 637.4, 637.6, 637.8, 638, 638.2, 638.4, 638.6, 638.8, 639]
Energies=[]
step=0.2
for item in range(0,20,1):
Energies.append(round(642.0 - item*step, 1))
#Energies=[ 640.8,641,641.2,641.4,641.6,] #5 maximum
#Energies=[637, 637.2, 637.4, 637.6, 637.8, 638, 638.2, 638.4, 638.6, 638.8, 639, 639.2, 639.4, 639.6, 639.8, 640, 640.5, 641]
#TakeImage at 710 eV at the given polarization
change_energy(636)
change_energy(638.2)
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
set_beamline_setup(id ="ID1_ID2", en=636, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
set_beamline_setup(id ="ID1_ID2", en=638.2, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
time.sleep(2.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
for item in Energies:
change_energy(item)

View File

@@ -1,5 +1,5 @@
#Constants
AVERAGE = 1
AVERAGE = 3
EXPOSURE = 2.0
MEASUREMENTS = 50
@@ -9,11 +9,11 @@ change_energy(639)
time.sleep(2.0)
#TwoImages Two Pol with Lin_hor/lin_ver and ID1 + ID2, tune-detune, at 638.8 eV
set_beamline_setup(id ="ID1_ID2", en=638.6, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
set_beamline_setup(id ="ID1_ID2", en=638.8, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
change_energy(637.6)
change_energy(637.5)
time.sleep(2.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)

View File

@@ -0,0 +1,32 @@
#Constants
AVERAGE = 4
EXPOSURE = 2.0
MEASUREMENTS = 50
#TakeImage at 710 eV at the given polarization
#change_energy(639)
#take_image(scans=1, switch_pol=False, measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
#TwoImages Two Pol with Lin_hor/lin_ver and ID1 + ID2, tune-detune, at 638.8 eV
#set_beamline_setup(id ="ID1_ID2", en=638.9, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
#two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
#time.sleep(2.0)
for i in range(1):
change_energy(638.2)
time.sleep(2.0)
#TwoImages Two Pol with C+/C- and ID1 + ID2, tune-detune, at 710 eV
set_beamline_setup(id ="ID1_ID2", en=638.2, pol1="Circ_Plus", alp1=0.0, har1=1, off1=0.0, pol2="Circ_Minus", alp2=0.0, har2=1, off2=0.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)
change_energy(637.6)
time.sleep(2.0)
set_beamline_setup(id ="ID1_ID2", en=637.6, pol1="Lin_Hor", alp1=0.0, har1=1, off1=0.0, pol2="Lin_Ver", alp2=90.0, har2=1, off2=0.0)
time.sleep(2.0)
two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
time.sleep(2.0)

View File

@@ -8,16 +8,18 @@ TRY.write(3.0)
TRZ.write(41.25)
time.sleep(1)
##Sodium K edge ***requires 3rd Harmonic***
#caput('X11MA-ID2:HARMONIC', 3)
#time.sleep(15)
#nr_loops=1
#for i in range(nr_loops):
# caput('X11MA-KEI10:RANGE', 7)
# caput('X11MA-KEI11:RANGE', 8)
# caput('X11MA-KEI12:RANGE', 9)
# otf(start=1070, end=1110, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset=0.0, name='DB53_Na', folder='XAS/2021/2021_03/DB53/')
#caput('X11MA-ID2:HARMONIC', 1)
#time.sleep(15)
##Survey
#nr_loops=1
#for i in range(nr_loops):
@@ -29,7 +31,7 @@ time.sleep(1)
#Fluor + Fe edges
nr_loops=1
for i in range(nr_loops):
caput('X11MA-KEI10:RANGE', 7)
caput('X11MA-KEI10aput(':RANGE', 7)
caput('X11MA-KEI11:RANGE', 8)
caput('X11MA-KEI12:RANGE', 9)
otf(start=680, end=735, time=2, delay=10, mode='LINEAR', alpha = 0.0, offset=0.0, name='DB53_F-Fe', folder='XAS/2021/2021_03/DB53/')

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
#seting parameters
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
exit_slit.move(30.0)
speed = exit_slit.getSpeed()
min_speed=exit_slit.getMinSpeed()
exit_slit.setSpeed(min_speed)
#scan Energy Slit
run('beamline_init/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":keithley_1a, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0})
time.sleep(1)
#resetting parameters
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO
exit_slit.setSpeed(speed)

View File

@@ -0,0 +1,14 @@
#seting parameters
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
fe_slit_H_size.move(1.0)
fe_slit_V_size.move(1.0)
#scan SizeH
run('beamline_init/SlitCalib.py',{"Slit":fe_slit_H_size, "Slit_offset":fe_slit_H_size_offs, "detector":keithley_1a, "start":1.0, "end":-0.5, "step_size":0.03, "final_pos":1.0})
time.sleep(1)
#scan SizeV
#SlitCalib(Slit=fe_slit_V_size, Slit_offset=fe_slit_V_size_offs, detector = keithley_1a, start=1.0, end=-0.5, step_size=0.03, final_pos=1.0)
#resetting parameters
caput ('X11MA-FE-DSAPER', 0) # 0--> closed
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO

View File

@@ -0,0 +1,17 @@
STEPS = 10
class Line(ReadableArray):
def read(self):
r1 = cscan(fe_slit_V_ctr, (Keithley_1_raw), -0.5, 1.0 , steps=STEPS, save=False, hidden=True)
return r1[Keithley_1_raw]
def getSize(self):
return STEPS+1
def getCalibration(self):
return ArrayCalibration(0.15,-0.5)
line=Line()
set_device_alias(line, "FE scan")
lscan(fe_slit_H_ctr, line, -0.5, 1.0, 0.1, latency=1.0)

View File

@@ -0,0 +1,122 @@
import subprocess
import time
import traceback
running = False
counts = {}
def countHS(motor):
global counts
try:
time.sleep(1.0)
counts[motor]=0
def on_change(value):
global counts
print "HomeSW changed on" , motor, "to", value
if int(value) == 1:
counts[motor]=counts[motor]+1
with Channel(motor+".ATHM", callback=on_change, monitored=True, name="test") as ch:
if int(ch.read()) == 1:
counts[motor]=1
while(running==True):
time.sleep(0.1)
print "Home Switch motor "+motor +" reached "+ str(counts[motor]) + " times"
return counts[motor]
except:
print "Exception counting "+str(motor)
traceback.print_exc()
raise
def init():
try:
global running
running = True
print "startint CMU initilization"
x = caget('X11MA-OP-CM:ox')
y = caget('X11MA-OP-CM:oy')
z = caget('X11MA-OP-CM:oz')
Rx= caget('X11MA-OP-CM:oRx')
Ry= caget('X11MA-OP-CM:oRy')
Rz= caget('X11MA-OP-CM:oRz')
baf=caget('X11MA-OP2-CM:TRB.RBV')
print "Old motor positions: x = " +str(x)+ \
", y = " +str(y)+ \
", z = " +str(z)+ \
", Rx = " +str(Rx)+ \
", Ry = " +str(Ry)+ \
", Rz = " +str(Rz)+ \
", baffle = " +str(baf)
subprocess.call("X_X11MA_init-CMU.sh", shell=True)
print "Positions after initialisation: x = " +str(caget('X11MA-OP-CM:ox'))+ \
", y = " +str(caget('X11MA-OP-CM:oy'))+ \
", z = " +str(caget('X11MA-OP-CM:oz'))+ \
", Rx = " +str(caget('X11MA-OP-CM:oRx'))+ \
", Ry = " +str(caget('X11MA-OP-CM:oRy'))+ \
", Rz = " +str(caget('X11MA-OP-CM:oRz'))+ \
", baffle = " +str(caget('X11MA-OP2-CM:TRB.RBV'))
print "Restoring old motor positions"
caput('X11MA-OP-CM:y',y)
caput('X11MA-OP-CM:z',z)
caput('X11MA-OP-CM:Rx',Rx)
caput('X11MA-OP-CM:Ry',Ry)
caput('X11MA-OP-CM:Rz',Rz)
#check restored positions after restore
print "Restored positions: x = " +str(caget('X11MA-OP-CM:ox'))+ \
", y = " +str(caget('X11MA-OP-CM:oy'))+ \
", z = " +str(caget('X11MA-OP-CM:oz'))+ \
", Rx = " +str(caget('X11MA-OP-CM:oRx'))+ \
", Ry = " +str(caget('X11MA-OP-CM:oRy'))+ \
", Rz = " +str(caget('X11MA-OP-CM:oRz'))+ \
", baffle = " +str(caget('X11MA-OP2-CM:TRB.RBV'))
if(abs(caget('X11MA-OP-CM:ox')-x)>0.001):
print "X position not ok"
elif(abs(caget('X11MA-OP-CM:oy')-y)>0.001):
print "Y position not ok"
elif(abs(caget('X11MA-OP-CM:oz')-z)>0.001):
print "Z position not ok"
elif(abs(caget('X11MA-OP-CM:oRx')-Rx)>0.001):
print "Rx position not ok"
elif(abs(caget('X11MA-OP-CM:oRy')-Ry)>0.001):
print "Ry position not ok"
elif(abs(caget('X11MA-OP-CM:oRz')-Rz)>0.001):
print "Rz position not ok"
elif(abs(caget('X11MA-OP2-CM:TRB.RBV')-baf)>0.001):
print "baffle position not ok"
else:
print "All positions OK"
running = False
return 0
except:
print "Exception in init"
traceback.print_exc()
raise
#Fork and join
futures = fork(init,(countHS,("X11MA-OP2-CM:TRY",)), \
(countHS,("X11MA-OP2-CM:TRZ",)), \
(countHS,("X11MA-OP2-CM:ROX",)), \
(countHS,("X11MA-OP2-CM:ROY",)), \
(countHS,("X11MA-OP2-CM:ROZ",)), \
(countHS,("X11MA-OP2-CM:TRB",)) )
ret = join(futures)
#check home switch status after init
homesw=True
for i in range(1,5):
if(ret[i]!=1):
homesw=False
print "Home switch status for all motors: %s" %("OK" if homesw == True else "Not OK")
#final status report
if(homesw==True and ret[0]==0):
print "init-CMU: ==> done. OK!"
else:
print "init-CMU: ==> not done. NOT OK!"

View File

@@ -0,0 +1,123 @@
import time
import traceback
running = False
counts = {}
encoder_raw = {}
def crossZero(encoder):
global counts
global encoder_raw
try:
time.sleep(1.0)
counts[encoder]=0
if caget(encoder+".RVAL") > 0:
encoder_raw[encoder]=1
elif caget(encoder+".RVAL") < 0:
encoder_raw[encoder]=-1
def on_change(value):
global counts
global encoder_raw
if (encoder_raw[encoder]==1 and value < 0):
counts[encoder]=counts[encoder]+1
encoder_raw[encoder]=-1
print "Zero on" , encoder, "crossed"
elif(encoder_raw[encoder]==-1 and value > 0):
counts[encoder]=counts[encoder]+1
encoder_raw[encoder]=1
print "Zero on" , encoder, "crossed"
#if int(value) == 0:
# print "Raw vlaue on" , encoder, "crossed", value
# counts[encoder]=counts[encoder]+1
with Channel(encoder+".RVAL", callback=on_change, monitored=True, name="test") as ch:
while(running==True):
time.sleep(0.1)
print "Encoder "+encoder +" crossed 0 "+ str(counts[encoder]) + " times"
return counts[encoder]
except:
print "Exception counting "+str(encoder)
traceback.print_exc()
raise
def init():
try:
global running
running = True
print "startint FE slit initilization"
cenV = caget('X11MA-FE-SV:center')
cenH = caget('X11MA-FE-SH:center')
offV = caget('X11MA-FE-DSVER.A')
offH = caget('X11MA-FE-DSHOR.A')
print "Old motor positions: centerV = " +str(cenV)+ \
", centerH = " +str(cenH)+ \
", offset V = " +str(offV)+ \
", offset H = " +str(offH)
print "Initializing UP motor."
caput('X11MA-FE-DSUP:II.PROC',1)
time.sleep(1.0)
cawait('X11MA-FE-SV1:TR1.DMOV', 1)
print "Initializing DOWN motor."
caput('X11MA-FE-DSDW:II.PROC',1)
time.sleep(1.0)
cawait('X11MA-FE-SV1:TR2.DMOV', 1)
print "Initializing RING motor."
caput('X11MA-FE-DSRI:II.PROC',1)
time.sleep(1.0)
cawait('X11MA-FE-SH1:TR1.DMOV', 1)
print "Initializing WALL motor."
caput('X11MA-FE-DSWA:II.PROC',1)
time.sleep(1.0)
cawait('X11MA-FE-SH1:TR2.DMOV', 1)
print "Setting offH and offV to 0."
caput('X11MA-FE-DSVER.A',0)
caput('X11MA-FE-DSHOR.A',0)
print "Checking encoder offset values."
if(abs(caget('X11MA-FE-SV1:EC1Off')+42683)>10):
print "Up position not ok"
elif(abs(caget('X11MA-FE-SV1:EC2Off')+41362)>10):
print "Down position not ok"
elif(abs(caget('X11MA-FE-SH1:EC1Off')+40782)>10):
print "Ring position not ok"
elif(abs(caget('X11MA-FE-SH1:EC2Off')+39548)>10):
print "Wall position not ok"
else:
print "All positions OK"
print "restoring Center and off values"
caput('X11MA-FE-SV:center',cenV)
caput('X11MA-FE-SH:center',cenH)
caput('X11MA-FE-DSVER.A',offV)
caput('X11MA-FE-DSHOR.A',offH)
running = False
return 0
except:
print "Exception in init"
traceback.print_exc()
raise
#Fork and join
futures = fork(init,(crossZero,("X11MA-FE-SV1:EC1",)), \
(crossZero,("X11MA-FE-SV1:EC2",)), \
(crossZero,("X11MA-FE-SH1:EC1",)), \
(crossZero,("X11MA-FE-SH1:EC2",)) )
ret = join(futures)
#check zero crossing status after init
zerocr=True
for i in range(1,4):
if(ret[i] != 2):
zerocr=False
#final status report
print "Zero crossing status for all motors: %s" %("OK" if zerocr == True else "Not OK")
print "init FE-slits: ==> done. %s" % ("OK" if zerocr == True else "Not OK")

View File

@@ -5,24 +5,14 @@
from mathutils import fit_polynomial
from mathutils import PolynomialFunction
# Input parameters
Slit = exit_slit
Slit_offset = exit_slit_offset
detector = keithley_1a
start = 30.0
end = -20.0
step_size = 1.0
final_pos = 20.0
#setting parameters
if(Slit==exit_slit):
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
Slit.move(start)
speed = Slit.getSpeed()
min_speed=Slit.getMinSpeed()
Slit.setSpeed(min_speed)
time.sleep(1)
# Input parameters (example)
#Slit = exit_slit
#Slit_offset = exit_slit_offset
#detector = keithley_1a
#start = 30.0
#end = -20.0
#step_size = 1.0
#final_pos = 20.0
# Execute the scan
result=cscan(Slit, detector, start, end, float(step_size))
@@ -70,12 +60,7 @@ print k
#change the offset
offset=Slit_offset.read()
Slit_offset.write(offset+k)
#resetting parameters
if(Slit == exit_slit):
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO
Slit.setSpeed(speed)
#Slit_offset.write(offset+k)
Slit.write(final_pos)

3
script/beamline_init/test.sh Executable file
View File

@@ -0,0 +1,3 @@
ls
whoami
echo "init-CMU: ==> done"

4
script/devices/LEEM2000.py Executable file → Normal file
View File

@@ -24,7 +24,7 @@ class LEEM2000(TcpDevice):
try:
pl = self.get_preset_label()
except:
pl = "unknown" if microscope.client.isConnected() else "offline"
pl = "unknown" if self.client.isConnected() else "offline"
value = "%1.3f | %s" % (hv,pl) if hv!="" or pl!="" else None
self.setCache(value, None)
@@ -113,7 +113,7 @@ class LEEM2000(TcpDevice):
cmd = "prl"
return self.send_receive(cmd, timeout, retries)
def get_high_voltage(c):
def get_high_voltage(self):
return self.high_voltage.get(False)
def get_child(self, var, name=None):

66
script/devices/eiger.py Executable file → Normal file
View File

@@ -25,12 +25,30 @@ def stop_eiger_ioc():
subprocess.call("/work/sls/bin/X_X11MA_EigerStop.sh")
print "IOC stopped"
"""
def integrate_roi(source, x,y, w, h):
if source.data is None:
source.update()
roi = source.data.getRoi(Rectangle(x,y, w, h))
return roi.integrate(False)
"""
def integrate_roi(source, x,y, w, h):
if source.data is None:
source.update()
rect = Rectangle(x,y, w, h)
roi = source.data.getRoi(rect)
"""
outliers_mask = get_outliers_mask()
if outliers_mask is not None:
mask = outliers_mask.getRoi(rect)
roi.mult(mask)
outliers_threshold = get_outliers_threshold()
if outliers_threshold>0:
roi.threshold(outliers_threshold, False, 0.0)
"""
return roi.integrate(False)
class RoiIntensitySourceListener (ImageListener):
@@ -78,10 +96,12 @@ def create_roi_devices(roi_list, add = True):
def grab_frame(source, roi=None, wait_next=False, outliers_threshold=None, outliers_mask=None, retries=None, timeout=None):
global eiger_averaging_number_of_samples #, chrono_grab
#chrono_grab.waitTimeout(GRAB_MIN_TIME)
"""
if outliers_threshold is None:
outliers_threshold = get_outliers_threshold()
if outliers_mask is None:
outliers_mask = get_outliers_mask()
"""
if wait_next:
if retries is None:
retries = 3
@@ -89,11 +109,14 @@ def grab_frame(source, roi=None, wait_next=False, outliers_threshold=None, outli
timeout=10.0
exposures = 1 if (eiger_averaging_number_of_samples is None) else eiger_averaging_number_of_samples
retries=max(retries,1)
timeout = int(((eiger.exposure * eiger_averaging_number_of_samples) + timeout) * 1000)
timeout = int(((eiger.exposure * exposures) + timeout) * 1000)
for try_count in range(retries):
if str(eiger.grabMode)=="Single":
eiger.waitReady(5000)
eiger.start()
eiger.start()
elif str(eiger.grabMode)=="Continuous":
if not eiger.isStarted():
eiger.start()
try:
#eiger.getDataArray().waitCacheChange(timeout)
source.waitNext(timeout)
@@ -324,7 +347,9 @@ def apply_averaging_detector(value):
def average_eiger_frames(samples, roi=None, wait_next=False, sleep=0, outliers_threshold=None, outliers_mask=None, retries=None, timeout=None):
global eiger_averaging_number_of_samples #, chrono_eiger
sample = int(samples)
if is_averaging_detector():
if is_averaging_detector():
if caget("X11MA-ES1-SD1:Proc1:EnableFilter")!="Enable":
raise Excetion("Cannot average frames in Eiger: filter is disabled")
#chrono_eiger.waitTimeout(1000)
caput("X11MA-ES1-SD1:Proc1:NumFilter", samples)
caput("X11MA-ES1-SD1:cam1:NumCycles", samples)
@@ -371,7 +396,38 @@ def get_outliers_mask(data_type='f'):
eiger.setDataType(DataType.Float32)
eiger.getDataArray().monitored=True
class ProcImage(Filter):
def __init__(self):
Filter.__init__(self, "image")
self.roi=None
self.outliers_threshold=None
self.outliers_mask =None
def processData(self, data):
outliers_threshold = get_outliers_threshold() if (self.outliers_threshold is None) else self.outliers_threshold
outliers_mask = get_outliers_mask() if (self.outliers_mask is None) else self.outliers_mask
roi = self.roi
data=data.copy()
if roi is not None:
data = data.getRoi(Rectangle(roi[0], roi[1], roi[2], roi[3]))
#ret = load_image(img)
if outliers_mask is not None:
data.mult(outliers_mask)
if outliers_threshold>0:
data.threshold(outliers_threshold, False, None)
#chrono_grab = Chrono()
return data
def process(self, image, data):
return None #Does not generate BufferedImage here
#image.removeAllListeners()
proc_image=ProcImage()
raw.addListener(proc_image)
add_device(proc_image, True)
image.refresh()
if False:
integrate_roi(image, 10, 5, 20, 10)

119
script/local.py Executable file → Normal file
View File

@@ -251,6 +251,15 @@ def otf2(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None
"""
#folder = get_context().setup.expandPath("{year}_{month}/{date}");
run("templates/EnergyScan_v2", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "TAG":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf_img(start, end, time, delay = 0.0, exposure=0.2, roi=None, name = None, save_images=False):
folder = get_context().setup.expandPath("{year}_{month}/{date}");
if is_string(roi):
with open(expand_path("{config}/ROIs/" + roi + ".roi"), 'rb') as f:
roi = OrderedDict()
for r in Serializer.decode(f.read(), Serializer.EncoderType.bin)[0]:
roi[str(r[0])] = [int(r[1]), int(r[2]), int(r[3]), int(r[4])]
run("templates/EnergyScan_img", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "FOLDER":folder, "FILE":name, "ROI":roi, "EXPOSURE":exposure, "SAVE_IMAGES": save_images})
def two_pol(switching="Tune_Detune", sequence="A", measurements=1, exposure=1.0, average=1, name = None):
@@ -323,6 +332,42 @@ def abs_spec(ranges, roi=None, switch_pol=False, scans=1, exposure=1.0, average=
})
###################################################################################################
#Settings
###################################################################################################
def set_dry_run(value):
"""
"""
set_setting("DRY_RUN", bool(value))
def get_dry_run():
"""
"""
return str(get_setting("DRY_RUN")).lower() == "true"
def set_outliers_threshold(value):
set_setting("OUTLIERS_THRESHOLD", int(value))
def get_outliers_threshold():
try:
return int(get_setting("OUTLIERS_THRESHOLD"))
except:
return 0
def get_outliers_mask_file():
return get_setting("OUTLIERS_MASK_FILE")
def write_metadata():
for name in ["proposer", "proposal", "pgroup", "sample"]:
value = get_setting(name)
set_attribute("/", name, value)
setting = get_setting("authors")
set_attribute("/", "authors", setting.split("|") if setting is not None else [""])
###################################################################################################
#Devices
@@ -534,8 +579,10 @@ class MeasurementsFilter(Filter):
filter_measurements = None
def start_measurements(measurements=["StdDev"], source = image, renderer=None):
def start_measurements(measurements=["StdDev"], source = None, renderer=None):
global filter_measurements
if source is None:
source = image
stop_measurements()
filter_measurements = MeasurementsFilter(measurements)
filter_measurements.start(string_to_obj(source), string_to_obj(renderer))
@@ -612,7 +659,9 @@ def play_sound(name):
try:
Audio.playFile(File(get_context().setup.expandPath("{home}/sounds/" + name + ".wav")), False)
except:
log("Error playing sound " + name + ": " + str(sys.exc_info()[1]), False)
#TODO: sound does not work when logged as e-account
if not Sys.getUserName().startswith("e"):
log("Error playing sound " + name + ": " + str(sys.exc_info()[1]), False)
###################################################################################################
@@ -786,44 +835,32 @@ def fit(ydata, xdata = None, limit_to_range=False):
run("templates/FocusScan")
def auto_focus():
run("templates/AutoFocus")
def auto_focus(scan_type="all", range_obj=4.0, step_obj=0.2, range_stig=20.0, step_stig=2.0, average=1, runs=2, renderer = None, roi=None, exposure=None):
"""
RANGE_OBJ = 4.0
STEP_OBJ = 0.2
RANGE_STIG = 20.0
STEP_STIG = 2.0
UPDATE_POSITION = True
AVERAGE = 1
RUNS = 2
width, height = eiger.getImageSize()
ROI = Rectangle(width/3, height/3, width/3, height/3,)
"""
run("templates/AutoFocus", { \
"SCAN_TYPE": scan_type, \
"RANGE_OBJ": float(range_obj), \
"STEP_OBJ": float(step_obj), \
"RANGE_STIG": float(range_stig), \
"STEP_STIG": float(step_stig), \
"AVERAGE": int(average), \
"RUNS": int(runs), \
"UPDATE_POSITION": True, \
"RENDERER": renderer, \
"ROI":roi, \
"EXPOSURE":exposure \
})
def auto_intensity():
return scan_focus(girder_x, 0.05, 0.005, average=3)
def auto_intensity(roi=None):
return scan_contrast(girder_x, 0.05, 0.005, roi, average=3)
###################################################################################################
#Settings
###################################################################################################
def set_dry_run(value):
"""
"""
set_setting("DRY_RUN", bool(value))
def get_dry_run():
"""
"""
return str(get_setting("DRY_RUN")).lower() == "true"
def set_outliers_threshold(value):
set_setting("OUTLIERS_THRESHOLD", int(value))
def get_outliers_threshold():
try:
return int(get_setting("OUTLIERS_THRESHOLD"))
except:
return 0
def get_outliers_mask_file():
return get_setting("OUTLIERS_MASK_FILE")
def write_metadata():
for name in ["proposer", "proposal", "pgroup", "sample"]:
value = get_setting(name)
set_attribute("/", name, value)
setting = get_setting("authors")
set_attribute("/", "authors", setting.split("|") if setting is not None else [""])

View File

@@ -0,0 +1,32 @@
#wold be nice to print relative changes of the parameters
RANGE_OBJ = 1.0
STEP_OBJ = 0.1
RANGE_STIG = 10.0
STEP_STIG = 1.0
UPDATE_POSITION = True
AVERAGE = 1
width, height = eiger.getImageSize()
#ROI = Rectangle(width/3, height/3, width/3, height/3,)
#ROI = Rectangle(0, 0, width, height,)
ROI = Rectangle(200,100,256,256) #(x0,y0,delta_x(2**n), delta_y(2**n))
ROI = Rectangle(130,74,256,256)
ROI = Rectangle(180,170,256,256)
initial_state = get_focus_scan_pos()
print "Initial state:" , initial_state
set_focus_scan_roi(ROI)
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ,average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG,average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)#
final_state = get_focus_scan_pos()
print "Final state:" , final_state

View File

@@ -0,0 +1,44 @@
#wold be nice to print relative changes of the parameters
RANGE_OBJ = 1.0
STEP_OBJ = 0.1
RANGE_STIG = 10.0
STEP_STIG = 1.0
UPDATE_POSITION = True
AVERAGE = 1
SETTLING_TIME =0.5
width, height = eiger.getImageSize()
#ROI = Rectangle(width/3, height/3, width/3, height/3,)
#ROI = Rectangle(0, 0, width, height,)
ROI = Rectangle(200,100,256,256)#(x0,y0,delta_x(2**n), delta_y(2**n))
ROI = Rectangle(130,74,256,256)
initial_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Initial state:" , initial_state
def apply_pos(pos):
objective.write(pos[0])
obj_stig_a.write(pos[1])
obj_stig_b.write(pos[2])
def show_roi():
global ROI
pn=show_panel(image)
ov=Overlays.Rect(Pen(Color.BLUE), Point(ROI.x,ROI.y),Dimension(ROI.width,ROI.height))
pn.clearOverlays()
ov.setMovable(True)
pn.addOverlay(ov)
show_roi()
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
#r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)#
final_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Final state:" , final_state

65
script/templates/AutoFocus.py Executable file → Normal file
View File

@@ -1,28 +1,49 @@
RANGE_OBJ = 4.0
STEP_OBJ = 0.2
RANGE_STIG = 20.0
STEP_STIG = 2.0
UPDATE_POSITION = True
AVERAGE = 1
width, height = eiger.getImageSize()
ROI = Rectangle(width/3, height/3, width/3, height/3,)
if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "AutoFocus") :
SCAN_TYPE = "all"
RANGE_OBJ = 2.0
STEP_OBJ = 0.2
RANGE_STIG = 20.0
STEP_STIG = 2.0
UPDATE_POSITION = True
AVERAGE = 1
RUNS = 1
width, height = eiger.getImageSize()
RENDERER = None
ROI = Rectangle(width/3, height/3, width/3, height/3,)
EXPOSURE = None
print "Auto Focus: ", SCAN_TYPE, RANGE_OBJ, STEP_OBJ, RANGE_STIG , STEP_STIG, UPDATE_POSITION, AVERAGE, RUNS, ROI, EXPOSURE
initial_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Initial state:" , initial_state
set_focus_scan_roi(ROI, RENDERER)
def apply_pos(pos):
objective.write(pos[0])
obj_stig_a.write(pos[1])
obj_stig_b.write(pos[2])
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, roi = ROI, average = AVERAGE, update_position = UPDATE_POSITION)
former_exposure = None
try:
if EXPOSURE:
former_exposure = eiger.getExposure()
if former_exposure!=EXPOSURE:
set_exposure_time(EXPOSURE)
grab_frame(image, None, True) #Update reference image if changing exposure
for run_no in range(RUNS):
if SCAN_TYPE in ("all", "obj"):
#print "Scan obj"
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)
if SCAN_TYPE in ("all", "stiga"):
#print "Scan stig a"
r=scan_focus(obj_stig_a, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
if SCAN_TYPE in ("all", "stigb"):
#print "Scan stig b"
r=scan_focus(obj_stig_b, RANGE_STIG, STEP_STIG, average = AVERAGE, update_position = UPDATE_POSITION)
if SCAN_TYPE in ("all"):
#print "Scan obj"
r=scan_focus(objective, RANGE_OBJ, STEP_OBJ, average = AVERAGE, update_position = UPDATE_POSITION)
finally:
if EXPOSURE:
if (former_exposure is not None) and (former_exposure!=EXPOSURE):
set_exposure_time(former_exposure)
restore_eiger()
final_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Final state:" , final_state

39
script/templates/Eiger2Img.py Executable file → Normal file
View File

@@ -18,6 +18,7 @@ print "Starting 2Img: ", METHOD, SWITCHING, SEQUENCE , MEASUREMENTS, AUTO_SAVE,
#SEQUENCE = "B": C+,C-,C+,C-,C+,-;C+,C-.
SHOW_IMAGES = True
SAVE_DIAGS = True
CORRECT_DRIFTS = False
ID = get_setting("ID")
@@ -84,8 +85,21 @@ def imageinfo(info):
pass
def save_image_file(frame, cycle=-1, frame_index=0):
if frame is None:
raise Exception("Cannot save frame - None: cycle: " + str(cycle) + " index: " + str(frame_index))
if SHOW_IMAGES:
if SHOW_IMAGES:
plot_name = get_image_file_name(cycle, frame_index, True)
plot_data = frame.matrix if (type(frame) == Data) else get_ip_array(frame)
if plot_data is None:
raise Exception("Cannot save frame - plot_data is None: cycle: " + str(cycle) + " index: " + str(frame_index))
plots=plot(plot_data, name = plot_name)
if (len(plots)==0):
msg = "Error creating plots - cycle: " + str(cycle) + " index: " + str(frame_index)
print msg
log(msg)
else:
p=plots[0]
p.getAxis(p.AxisId.Y).setInverted(True)
if AUTO_SAVE and (frame is not None):
filename = get_image_file_name(cycle, frame_index)
@@ -100,6 +114,12 @@ run_index = get_context().getDaySequentialNumber()
run_index = get_context().getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
if CORRECT_DRIFTS:
roi = get_focus_scan_roi()
calc_roi = None if (roi is None) else Roi(roi.x,roi.y,roi.width, roi.height)
calc_roi=Roi(0,0,512,512)
ref_image = None # grab_frame(image, None, True)
#print "Startup time: " + str(time.time() - start)
try:
@@ -119,10 +139,10 @@ try:
print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i)
#s=time.time()
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
#print "--- Time: " + str(time.time() - s)
#time.sleep(1) #added by Armin
frames.append(av)
frames.append(av)
imageinfo("I")
save_image_file(frames[i], cycle, i)
save_image_file(frames[i], cycle, i)
if METHOD == "Take_Image":
break
@@ -141,7 +161,18 @@ try:
print "Divide second frame by first"
frames.append(frames[1].copy())
frames[2].div(frames[0])
save_image_file(frames[2],cycle, 2)
save_image_file(frames[2],cycle, 2)
if CORRECT_DRIFTS and (calc_roi is not None):
if ref_image is None:
ref_image = frames[0]
print "-> Saved shift ref image"
else:
cur_image = frames[0]
xoff, yoff, error, diffphase = calculate_shift(ref_image,cur_image, calc_roi)
if (0<abs(xoff) < MAX_SHIFT) and (0<abs(yoff) < MAX_SHIFT):
print "-> Calculated shift: ", xoff, yoff, error, diffphase
else:
print "-> Error - shift too big:", xoff, yoff
# objective = getObjective()
# temp = getLEEMtemp()

View File

@@ -0,0 +1,238 @@
#If running from editor
if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "Eiger2Img") :
METHOD = "Two_Pol"
SWITCHING = "Tune_Detune"
SEQUENCE = "A"
MEASUREMENTS = 4
AUTO_SAVE = True
EXPOSURE = 1.0
AVERAGE = 2.0
ENERGY_1 = 850.0
ENERGY_2= 900.0
SWITCH_POL=False
NUMBER_SCANS =1
print "Starting 2Img: ", METHOD, SWITCHING, SEQUENCE , MEASUREMENTS, AUTO_SAVE, EXPOSURE, AVERAGE, ENERGY_1, ENERGY_2, SWITCH_POL,NUMBER_SCANS
#SEQUENCE = "A": C+,C-,C-,C+,C+;C-,C-,C+,
#SEQUENCE = "B": C+,C-,C+,C-,C+,-;C+,C-.
SHOW_IMAGES = True
SAVE_DIAGS = True
CORRECT_DRIFTS = False
ID = get_setting("ID")
ENERGY = [ENERGY_1, ENERGY_2]
#POLARIZATION = [POLARIZATION_1, POLARIZATION_2]
if METHOD == "Two_Energies":
for en in [ENERGY_1, ENERGY_2]:
if en < 89.9 or en > 2000:
raise Exception("Bad energy argument")
start = time.time()
threads = []
#path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#data_path = get_context().setup.expandPath(path)
data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
#data_path = get_exec_pars().path
#get_context().incrementFileSequentialNumber()
def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
global max_index
if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped
frame_index = 0 if frame_index else 1
root = "" if short_name else (data_path + "/")
#prefix = get_context().setup.expandPath("i{seq}%03d" + "_" + ("%d" % frame_index))
abs_index=run_index + frame_index
max_index= max(max_index, frame_index)
#prefix = get_context().setup.expandPath("i{date}%02d_{seq}%03d")
prefix = get_context().setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
if cycle < 0:
ret = root + prefix + ".tif"
else:
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
return get_context().setup.expandPath(ret)
"""
def getLEEM():
global startvoltage,objective, LEEMtemp
startvoltage=getStartvoltage()
objective=getObjective()
LEEMtemp=getLEEMtemp()
"""
#Initialize vartiables
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
open_vg10()
#rbkEnergy=energy_rbk.read()
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
init_pol_switch(SWITCHING)
def imageinfo(info):
pass
def save_image_file(frame, cycle=-1, frame_index=0):
if SHOW_IMAGES:
p=plot(frame.matrix if (type(frame) == Data) else get_ip_array(frame), name = get_image_file_name(cycle, frame_index, True))[0]
p.getAxis(p.AxisId.Y).setInverted(True)
if AUTO_SAVE and (frame is not None):
filename = get_image_file_name(cycle, frame_index)
threads.append(save_as_tiff(frame, filename, check=False, parallel=True, metadata=(get_diags() if SAVE_DIAGS else {})))
log(filename)
print filename
# log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0"))
init_eiger(exposure=EXPOSURE)
run_index = get_context().getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
if CORRECT_DRIFTS:
roi = get_focus_scan_roi()
calc_roi = None if (roi is None) else Roi(roi.x,roi.y,roi.width, roi.height)
calc_roi=Roi(0,0,512,512)
ref_image = None # grab_frame(image, None, True)
#print "Startup time: " + str(time.time() - start)
try:
for scan in range(NUMBER_SCANS):
#Do the measurement loop
for cycle in range(1, MEASUREMENTS + 1):
frames = []
if MEASUREMENTS > 1:
log("nround = " + str(cycle) + " / " + str(MEASUREMENTS))
for i in range(2):
if i > 0:
open_vg10() #added by Hannes
time.sleep(5) #added by Hannes
if (cycle == 1) or (METHOD != "Take_Image"):
assert_status_ok()
if METHOD == "Two_Energies":
change_energy(ENERGY[i])
print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i)
#s=time.time()
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
#print "--- Time: " + str(time.time() - s)
time.sleep(1) #added by Armin
frames.append(av)
imageinfo("I")
time.sleep(1) #added by Armin
save_image_file(frames[i], cycle, i)
close_vg10() #added by Hannes
time.sleep(10) #added by Hannes should take 1 image every 10 minutes with shutter closed in between
if METHOD == "Take_Image":
break
if METHOD == "Two_Pol":
if (i==0) or (SEQUENCE == "B"):
switch_pol()
#time.sleep(1)
if (METHOD == "Two_Pol") or (METHOD == "Two_Energies"):
if (METHOD == "Two_Energies") or (SEQUENCE == "B") or ((cycle%2)==1):
print "Divide first frame by second"
frames.append(frames[0].copy())
frames[2].div(frames[1])
else:
print "Divide second frame by first"
frames.append(frames[1].copy())
frames[2].div(frames[0])
save_image_file(frames[2],cycle, 2)
if CORRECT_DRIFTS and (calc_roi is not None):
if ref_image is None:
ref_image = frames[0]
print "-> Saved shift ref image"
else:
cur_image = frames[0]
xoff, yoff, error, diffphase = calculate_shift(ref_image,cur_image, calc_roi)
if (0<abs(xoff) < MAX_SHIFT) and (0<abs(yoff) < MAX_SHIFT):
print "-> Calculated shift: ", xoff, yoff, error, diffphase
else:
print "-> Error - shift too big:", xoff, yoff
# objective = getObjective()
# temp = getLEEMtemp()
# log(0 , "Temp : " + Format(temp,"0.00") + " OB : " + Format(objective,"0.00") + " StigmaA : " + " StigmaB : " )
# Auto average and save
print "Waiting file writing threads to finish..."
for t in threads:
join(t)
if (MEASUREMENTS > 1) and (AUTO_SAVE == 1):
print "--- Averaging..."
for i in range(len(frames)):
"""
measures = []
for cycle in range(1, MEASUREMENTS + 1):
filename = get_image_file_name(cycle, i)
ip = open_image(filename)
#measures.append(Data(get_ip_array(ip)))
measures.append(ip)
#av = average_frames(measures) #Result is transposed???
av=average_ips (measures, roi=None, as_float=True)
"""
integration = None
for cycle in range(1, MEASUREMENTS + 1):
filename = get_image_file_name(cycle, i)
print "Open " , filename
ip = open_image(filename)
if integration is None:
integration = ip
else:
integration =integrate_ips ([integration, ip], as_float=True)
av=op_const(integration, "divide", float(MEASUREMENTS), in_place=True)
save_image_file(av, -1, i)
if SWITCH_POL and (METHOD == "Take_Image"):
switch_pol()
#SWITCH_POL = False
#set_exec_pars(then_success="run('templates/Eiger2Img')")
"""
get_context().incrementDaySequentialNumber()
set_exec_pars(open=False)
set_exec_pars(open=True)
for cycle in range(1, MEASUREMENTS + 1):
frames = []
if MEASUREMENTS > 1:
log("nround = " + str(cycle) + " / " + str(MEASUREMENTS))
print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i)
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
imageinfo("I")
save_image_file(av, cycle, i)
"""
#TODO: This is a workaround to handle 2-Images, should be removed
run_index = run_index + 1
if scan>0:
max_index=max_index+1
print " ---- New un index : %d" %(run_index,)
finally:
for i in range(max_index):
get_context().incrementDaySequentialNumber()
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
close_vg10()
restore_eiger()

View File

@@ -0,0 +1,232 @@
#If running from editor
if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "Eiger2Img") :
METHOD = "Two_Pol"
SWITCHING = "Tune_Detune"
SEQUENCE = "A"
MEASUREMENTS = 4
AUTO_SAVE = True
EXPOSURE = 1.0
AVERAGE = 2.0
ENERGY_1 = 850.0
ENERGY_2= 900.0
SWITCH_POL=False
NUMBER_SCANS =1
print "Starting 2Img: ", METHOD, SWITCHING, SEQUENCE , MEASUREMENTS, AUTO_SAVE, EXPOSURE, AVERAGE, ENERGY_1, ENERGY_2, SWITCH_POL,NUMBER_SCANS
#SEQUENCE = "A": C+,C-,C-,C+,C+;C-,C-,C+,
#SEQUENCE = "B": C+,C-,C+,C-,C+,-;C+,C-.
SHOW_IMAGES = True
SAVE_DIAGS = True
CORRECT_DRIFTS = False
ID = get_setting("ID")
ENERGY = [ENERGY_1, ENERGY_2]
#POLARIZATION = [POLARIZATION_1, POLARIZATION_2]
if METHOD == "Two_Energies":
for en in [ENERGY_1, ENERGY_2]:
if en < 89.9 or en > 2000:
raise Exception("Bad energy argument")
start = time.time()
threads = []
#path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#data_path = get_context().setup.expandPath(path)
data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
#data_path = get_exec_pars().path
#get_context().incrementFileSequentialNumber()
def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
global max_index
if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped
frame_index = 0 if frame_index else 1
root = "" if short_name else (data_path + "/")
#prefix = get_context().setup.expandPath("i{seq}%03d" + "_" + ("%d" % frame_index))
abs_index=run_index + frame_index
max_index= max(max_index, frame_index)
#prefix = get_context().setup.expandPath("i{date}%02d_{seq}%03d")
prefix = get_context().setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
if cycle < 0:
ret = root + prefix + ".tif"
else:
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
return get_context().setup.expandPath(ret)
"""
def getLEEM():
global startvoltage,objective, LEEMtemp
startvoltage=getStartvoltage()
objective=getObjective()
LEEMtemp=getLEEMtemp()
"""
#Initialize vartiables
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
open_vg10()
#rbkEnergy=energy_rbk.read()
if METHOD == "Two_Pol" or (SWITCH_POL and (METHOD == "Take_Image")):
init_pol_switch(SWITCHING)
def imageinfo(info):
pass
def save_image_file(frame, cycle=-1, frame_index=0):
if SHOW_IMAGES:
p=plot(frame.matrix if (type(frame) == Data) else get_ip_array(frame), name = get_image_file_name(cycle, frame_index, True))[0]
p.getAxis(p.AxisId.Y).setInverted(True)
if AUTO_SAVE and (frame is not None):
filename = get_image_file_name(cycle, frame_index)
threads.append(save_as_tiff(frame, filename, check=False, parallel=True, metadata=(get_diags() if SAVE_DIAGS else {})))
log(filename)
print filename
# log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0"))
init_eiger(exposure=EXPOSURE)
run_index = get_context().getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
if CORRECT_DRIFTS:
roi = get_focus_scan_roi()
calc_roi = None if (roi is None) else Roi(roi.x,roi.y,roi.width, roi.height)
calc_roi=Roi(0,0,512,512)
ref_image = None # grab_frame(image, None, True)
#print "Startup time: " + str(time.time() - start)
try:
for scan in range(NUMBER_SCANS):
#Do the measurement loop
for cycle in range(1, MEASUREMENTS + 1):
frames = []
if MEASUREMENTS > 1:
log("nround = " + str(cycle) + " / " + str(MEASUREMENTS))
for i in range(2):
if (cycle == 1) or (METHOD != "Take_Image"):
assert_status_ok()
if METHOD == "Two_Energies":
change_energy(ENERGY[i])
print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i)
#s=time.time()
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
#print "--- Time: " + str(time.time() - s)
time.sleep(1) #added by Armin
frames.append(av)
imageinfo("I")
time.sleep(1) #added by Armin
save_image_file(frames[i], cycle, i)
if METHOD == "Take_Image":
break
if METHOD == "Two_Pol":
if (i==0) or (SEQUENCE == "B"):
switch_pol()
#time.sleep(1)
if (METHOD == "Two_Pol") or (METHOD == "Two_Energies"):
if (METHOD == "Two_Energies") or (SEQUENCE == "B") or ((cycle%2)==1):
print "Divide first frame by second"
frames.append(frames[0].copy())
frames[2].div(frames[1])
else:
print "Divide second frame by first"
frames.append(frames[1].copy())
frames[2].div(frames[0])
save_image_file(frames[2],cycle, 2)
if CORRECT_DRIFTS and (calc_roi is not None):
if ref_image is None:
ref_image = frames[0]
print "-> Saved shift ref image"
else:
cur_image = frames[0]
xoff, yoff, error, diffphase = calculate_shift(ref_image,cur_image, calc_roi)
if (0<abs(xoff) < MAX_SHIFT) and (0<abs(yoff) < MAX_SHIFT):
print "-> Calculated shift: ", xoff, yoff, error, diffphase
else:
print "-> Error - shift too big:", xoff, yoff
# objective = getObjective()
# temp = getLEEMtemp()
# log(0 , "Temp : " + Format(temp,"0.00") + " OB : " + Format(objective,"0.00") + " StigmaA : " + " StigmaB : " )
# Auto average and save
print "Waiting file writing threads to finish..."
for t in threads:
join(t)
if (MEASUREMENTS > 1) and (AUTO_SAVE == 1):
print "--- Averaging..."
for i in range(len(frames)):
"""
measures = []
for cycle in range(1, MEASUREMENTS + 1):
filename = get_image_file_name(cycle, i)
ip = open_image(filename)
#measures.append(Data(get_ip_array(ip)))
measures.append(ip)
#av = average_frames(measures) #Result is transposed???
av=average_ips (measures, roi=None, as_float=True)
"""
integration = None
for cycle in range(1, MEASUREMENTS + 1):
filename = get_image_file_name(cycle, i)
print "Open " , filename
ip = open_image(filename)
if integration is None:
integration = ip
else:
integration =integrate_ips ([integration, ip], as_float=True)
av=op_const(integration, "divide", float(MEASUREMENTS), in_place=True)
save_image_file(av, -1, i)
if SWITCH_POL and (METHOD == "Take_Image"):
switch_pol()
#SWITCH_POL = False
#set_exec_pars(then_success="run('templates/Eiger2Img')")
"""
get_context().incrementDaySequentialNumber()
set_exec_pars(open=False)
set_exec_pars(open=True)
for cycle in range(1, MEASUREMENTS + 1):
frames = []
if MEASUREMENTS > 1:
log("nround = " + str(cycle) + " / " + str(MEASUREMENTS))
print "--- Grabing " + str(AVERAGE)+ " frames - cycle: " + str(cycle) + " step: " + str(i)
av = average_eiger_frames(AVERAGE, roi=None, wait_next=True)
imageinfo("I")
save_image_file(av, cycle, i)
"""
#TODO: This is a workaround to handle 2-Images, should be removed
run_index = run_index + 1
if scan>0:
max_index=max_index+1
print " ---- New un index : %d" %(run_index,)
finally:
for i in range(max_index):
get_context().incrementDaySequentialNumber()
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
close_vg10()
restore_eiger()

51
script/templates/FocusScan.py Executable file → Normal file
View File

@@ -1,6 +1,6 @@
SETTLING_TIME =0.5
MAX_CONTRAST = 10e14
MAX_SHIFT = 100
MAX_SHIFT = 300
import java.awt.Rectangle as Rectangle
@@ -30,26 +30,36 @@ def apply_focus_scan_pos(pos):
obj_stig_b.write(pos[2])
fucus_scan_roi=None
focus_scan_roi=None
focus_scan_renderer=None
def show_focus_scan_roi():
global fucus_scan_roi
pn=show_panel(image)
ov=Overlays.Rect(Pen(Color.BLUE), Point(fucus_scan_roi.x,fucus_scan_roi.y),Dimension(fucus_scan_roi.width,fucus_scan_roi.height))
pn.clearOverlays()
#ov.setMovable(True)
pn.addOverlay(ov)
global focus_scan_roi, focus_scan_renderer
if focus_scan_renderer is None:
pn=show_panel(image)
ov=Overlays.Rect(Pen(Color.BLUE), Point(focus_scan_roi.x,focus_scan_roi.y),Dimension(focus_scan_roi.width,focus_scan_roi.height))
pn.clearOverlays()
#ov.setMovable(True)
pn.addOverlay(ov)
else:
pn = focus_scan_renderer
if len(pn.overlays)==0:
pn.addOverlay(Overlays.Rect(pn.getPenProfile()))
pn.overlays[0].setMovable(True)
ov=pn.overlays[0]
ov.update(Point(focus_scan_roi.x,focus_scan_roi.y),Dimension(focus_scan_roi.width,focus_scan_roi.height))
pn.refresh()
def set_focus_scan_roi(roi):
global fucus_scan_roi
fucus_scan_roi = roi
def set_focus_scan_roi(roi, renderer=None):
global focus_scan_roi, focus_scan_renderer
focus_scan_renderer = renderer
focus_scan_roi = roi
show_focus_scan_roi()
def get_focus_scan_roi():
return fucus_scan_roi
return focus_scan_roi
"""
def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_position = True, update_roi = True)):
def scan_contrast(positioner, pos_range, pos_step, roi = None, average = 1, update_position = True):
def after_read(rec):
if rec[positioner] > MAX_CONTRAST:
print "Invalid contrast value"
@@ -60,6 +70,9 @@ def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_
print "Waiting to reach scan init pos"
time.sleep(1.0)
cur = positioner.read()
if (cur < positioner.minValue+pos_range) or (cur > positioner.maxValue-pos_range):
raise Exception("Cannot perform contrast scan: " + positioner.name + " too close to limit")
if roi is None:
sensor = image_contrast
@@ -89,7 +102,8 @@ def scan_focus(positioner, pos_range, pos_step, roi = None, average = 1, update_
print "Invalid fit for ", positioner.name, mn, range_scan
time.sleep(1.0) # Wait restoring positions
return r
"""
def update_roi_pos(cur_data, former_data):
roi=get_focus_scan_roi()
calc_roi = Roi(roi.x,roi.y,roi.width, roi.height)
@@ -101,10 +115,10 @@ def update_roi_pos(cur_data, former_data):
print "Updating ROI location to ", x, y
x,y=max(x,0), max(y,0)
x,y=min(x,cur_data.width-roi.width), min(y,cur_data.height-roi.height)
ROI.setLocation(x,y)
roi.setLocation(x,y)
show_focus_scan_roi()
else:
print "Error - sshift too big: xoff, yoff"
print "Error - shift too big: xoff, yoff"
except:
print "Error calculating shift: " + str(sys.exc_info()[1])
@@ -168,9 +182,10 @@ def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = T
#time.sleep(1.0) # Wait restoring positions
#print "Updating position: ", positioner.name, mn
#show_message("Setting mx pos", blocking = True)
#time.sleep(3.0)
former_data = image.data
positioner.write(mn)
time.sleep(eiger.exposure+SETTLING_TIME)
time.sleep(eiger.exposure+SETTLING_TIME)
#show_message("Updating ROI", blocking = True)
update_roi_pos(image.data, former_data)
else:

View File

@@ -1,21 +0,0 @@
#seting parameters
caput('X11MA-KEI10:RANGE', 6) # 6 --> 200 nA
fe_slit_H_size.move(1.0)
fe_slit_V_size.move(1.0)
#scan SizeH
SlitCalib(Slit=fe_slit_H_size, Slit_offset=fe_slit_H_size_offs, detector = keithley_1a, start=1.0, end=-0.5, step_size=0.03, final_pos=1.0)
time.sleep(1)
#scan SizeV
SlitCalib(Slit=fe_slit_V_size, Slit_offset=fe_slit_V_size_offs, detector = keithley_1a, start=1.0, end=-0.5, step_size=0.03, final_pos=1.0)
ctrH=fe_slit_H_ctr.getPosition()
wdthH=2.6
ctrV=fe_slit_V_ctr.getPosition()
wdthV=1.3
#scan CenterH
SlitCalib(Slit=fe_slit_H_ctr, Slit_offset=fe_slit_H_ctr, detector = Keithley_1_raw, start=ctrH - wdthH/2, end=ctrH + wdth/2, step_size=0.1, ctrH - wdth/2)
#resetting parameters
caput ('X11MA-FE-DSAPER', 0) # 0--> closed
caput('X11MA-KEI10:RANGE', 0) # 0--> AUTO

15
script/test/OutlierFix.py Normal file
View File

@@ -0,0 +1,15 @@
def integrate_roi(source, x,y, w, h):
if source.data is None:
source.update()
rect = Rectangle(x,y, w, h)
roi = source.data.getRoi(rect)
outliers_mask = get_outliers_mask()
if outliers_mask is not None:
mask = outliers_mask.getRoi(rect)
roi.mult(mask)
outliers_threshold = get_outliers_threshold()
if outliers_threshold>0:
roi.threshold(outliers_threshold, False, 0.0)

33
script/test/TestFilter.py Normal file
View File

@@ -0,0 +1,33 @@
class PreProcImage(Filter):
def __init__(self):
Filter.__init__(self, "preproc_image")
self.roi=None
self.outliers_threshold=None
self.outliers_mask =None
def processData(self, data):
outliers_threshold = get_outliers_threshold() if (self.outliers_threshold is None) else self.outliers_threshold
outliers_mask = get_outliers_mask() if (self.outliers_mask is None) else self.outliers_mask
roi = self.roi
data=data.copy()
if roi is not None:
data = data.getRoi(Rectangle(roi[0], roi[1], roi[2], roi[3]))
#ret = load_image(img)
if outliers_mask is not None:
data.mult(outliers_mask)
if outliers_threshold>0:
data.threshold(outliers_threshold, False, None)
#chrono_grab = Chrono()
return data
def process(self, image, data):
return None #Does not generate BufferedImage here
image.removeAllListeners()
preproc_image=PreProcImage()
image.addListener(preproc_image)
add_device(preproc_image, True)
image.refresh()

View File

@@ -0,0 +1,4 @@
caput('X11MA-ID2:HARMONIC', 3)
time.sleep(15)
caput('X11MA-ID2:HARMONIC', 1)
#time.sleep(10)

View File

@@ -0,0 +1,20 @@
EXPOSURE=1.0
for i in range(100):
former_exposure = eiger.getExposure()
if former_exposure !=0.2:
raise Exception("Bad exposure")
set_exposure_time(EXPOSURE)
grab_frame(image, None, True) #Update reference image if changing exposure
time.sleep(1.0)
if former_exposure!=EXPOSURE:
set_exposure_time(former_exposure)
restore_eiger()
if (i%3)==0:
eiger.stop()
time.sleep(1.0)
print"Stop"

1
script/test_speed.py Normal file
View File

@@ -0,0 +1 @@
otf2(start=680, end=900, time=1, delay=1, mode='LINEAR', alpha = 0.0, offset=-1.2, name='AS31_Survey')

19
script/unknown Normal file
View File

@@ -0,0 +1,19 @@
source=image
samples=10
roi=None
wait_next=False
sleep=0
outliers_threshold=None
outliers_mask=None
retries=None
timeout=None
frames = []
for i in range(samples):
if (i>0) and (sleep>0):
time.sleep(sleep)
aux = grab_frame(source, roi, wait_next, outliers_threshold, outliers_mask, retries, timeout)
frames.append(aux)
ret=average_frames(frames) if samples > 1 else frames[0]