AutoFocus

This commit is contained in:
gac-x11ma
2021-05-05 17:06:31 +02:00
parent 5225f36124
commit 3c1cfd301b
25 changed files with 468 additions and 162 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -75,5 +75,6 @@ CADC3=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|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
image=ch.psi.pshell.imaging.CameraSource|eiger|||true
axis=ch.psi.pshell.imaging.MjpegSource|http://axis-x11ma.psi.ch/axis-cgi/mjpg/video.cgi?id=176 true||-200|false
+3 -3
View File
@@ -1,5 +1,5 @@
#Mon Apr 26 10:07:44 CEST 2021
#Fri Apr 30 17:00:58 CEST 2021
keywords=List;[]
ownerEmail=String;moritz.bigalke@giub.unibe.ch
contactEmail=String;carlos.vaz@psi.ch
ownerEmail=String;jgpark10@snu.ac.kr
contactEmail=String;armin.kleibert@psi.ch
owner=String;Erik Folven
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Apr 27 09:06:10 CEST 2021
SessionCounter=19
#Tue May 04 08:05:11 CEST 2021
SessionCounter=20
+6 -6
View File
@@ -1,23 +1,23 @@
#Tue Apr 27 09:07:34 CEST 2021
#Tue May 04 16:48:06 CEST 2021
HARMONIC_ID_1=1
RSYNC_USER=
OUTLIERS_THRESHOLD=1000000000
NORM_FILE=/sls/X11MA/data/X11MA/Data1/2021/Yona250121/s250121
AUTO_SWITCH_VALVE=false
AUTO_SWITCH_VALVE=true
DRY_RUN=false
POL_ID_2=Lin_Hor
POL_ID_2=Lin_Ver
OFFSET_ID_1=0.0
ID=ID2
ID=ID1_ID2
OFFSET_ID_2=-1.1
proposal=proposal
ENERGY=800.0
ENERGY=852.5
proposer=proposer
POL_ID_1=Lin_Hor
RSYNC_HOST=
sample=sample
RSYNC_PATH=
pgroup=pgroup
ALPHA_ID_2=45.0
ALPHA_ID_2=0.0
ALPHA_ID_1=15.0
RSYNC_DEL=true
AVERAGING_DETECTOR=true
+4 -4
View File
@@ -1,4 +1,4 @@
#Tue Apr 27 10:43:38 CEST 2021
LastRunDate=210427
FileSequentialNumber=7047
DaySequentialNumber=5
#Wed May 05 17:03:21 CEST 2021
LastRunDate=210505
FileSequentialNumber=7364
DaySequentialNumber=76
+10
View File
@@ -0,0 +1,10 @@
#Wed May 05 15:14:33 CEST 2021
offset=0.0
maxValue=3.0
rotation=false
precision=3
scale=1.0
resolution=0.005
minValue=2.0
unit=mm
sign_bit=0
+2 -2
View File
@@ -1,4 +1,4 @@
#Mon Apr 26 13:48:18 CEST 2021
#Wed May 05 09:55:16 CEST 2021
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
@@ -6,7 +6,7 @@ scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=900.0
colormapMax=81.992
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
+10
View File
@@ -0,0 +1,10 @@
#Wed May 05 11:46:59 CEST 2021
offset=0.0
maxValue=100.0
rotation=false
precision=3
scale=1.0
resolution=0.5
minValue=-100.0
unit=mA
sign_bit=0
+10
View File
@@ -0,0 +1,10 @@
#Wed May 05 11:47:00 CEST 2021
offset=0.0
maxValue=100.0
rotation=false
precision=3
scale=1.0
resolution=0.5
minValue=-100.0
unit=mA
sign_bit=0
+10
View File
@@ -0,0 +1,10 @@
#Wed May 05 11:45:21 CEST 2021
offset=0.0
maxValue=1570.0
rotation=false
precision=2
scale=1.0
resolution=0.05
minValue=1350.0
unit=mA
sign_bit=0
+56 -26
View File
@@ -1503,18 +1503,20 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="panelParameters" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelParameters" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonImgOTFStart" linkSize="36" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
<Component id="buttonImgOTFAbort" linkSize="36" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonImgOTFStart" linkSize="36" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="64" max="-2" attributes="0"/>
<Component id="buttonImgOTFAbort" linkSize="36" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@@ -1544,32 +1546,42 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="checkImgOTFSaveImages" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel27" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerImgOTFExp" linkSize="35" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="checkImgOTFSaveImages" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE1" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" linkSize="35" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="175" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE1" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerTime" linkSize="35" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerE2" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="175" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerE2" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" linkSize="35" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="151" max="32767" attributes="0"/>
</Group>
</Group>
@@ -1590,7 +1602,12 @@
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDelay" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="119" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel27" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerImgOTFExp" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="87" max="32767" attributes="0"/>
<Component id="checkImgOTFSaveImages" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -1657,6 +1674,19 @@
<Property name="text" type="java.lang.String" value="Save images"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel27">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Exposure(s):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerImgOTFExp">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.2" maximum="3600.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonImgOTFStart">
+47 -23
View File
@@ -261,6 +261,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);
}
void addRoi(Rect roi) {
@@ -438,6 +440,7 @@ public class DataAcquisition extends Panel {
String folder = getContext().getSetup().expandPath("{year}_{month}/{date}");
args.put("FOLDER", folder);
args.put("ROI", getRois());
args.put("EXPOSURE", spinnerImgOTFExp.getValue());
args.put("SAVE_IMAGES", checkImgOTFSaveImages.isSelected());
buttonImgOTFAbort.setEnabled(true);
@@ -582,6 +585,8 @@ public class DataAcquisition extends Panel {
jLabel5 = new javax.swing.JLabel();
spinnerDelay = new javax.swing.JSpinner();
checkImgOTFSaveImages = new javax.swing.JCheckBox();
jLabel27 = new javax.swing.JLabel();
spinnerImgOTFExp = new javax.swing.JSpinner();
buttonImgOTFStart = new javax.swing.JButton();
buttonImgOTFAbort = new javax.swing.JButton();
@@ -1575,6 +1580,11 @@ public class DataAcquisition extends Panel {
checkImgOTFSaveImages.setText("Save images");
jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel27.setText("Exposure(s):");
spinnerImgOTFExp.setModel(new javax.swing.SpinnerNumberModel(0.2d, 0.0d, 3600.0d, 1.0d));
javax.swing.GroupLayout panelParametersLayout = new javax.swing.GroupLayout(panelParameters);
panelParameters.setLayout(panelParametersLayout);
panelParametersLayout.setHorizontalGroup(
@@ -1582,27 +1592,34 @@ public class DataAcquisition extends Panel {
.addGroup(panelParametersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(checkImgOTFSaveImages)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel27)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerImgOTFExp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel1))
.addComponent(checkImgOTFSaveImages)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 175, Short.MAX_VALUE)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 175, Short.MAX_VALUE)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerE2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(spinnerE2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(151, Short.MAX_VALUE))
);
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerDelay, spinnerE1, spinnerE2, spinnerTime});
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerDelay, spinnerE1, spinnerE2, spinnerImgOTFExp, spinnerTime});
panelParametersLayout.setVerticalGroup(
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1618,7 +1635,11 @@ public class DataAcquisition extends Panel {
.addComponent(spinnerTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(spinnerDelay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(spinnerImgOTFExp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addComponent(checkImgOTFSaveImages)
.addContainerGap())
);
@@ -1642,16 +1663,17 @@ public class DataAcquisition extends Panel {
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelParameters, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonImgOTFStart)
.addGap(64, 64, 64)
.addComponent(buttonImgOTFAbort)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonImgOTFStart)
.addGap(64, 64, 64)
.addComponent(buttonImgOTFAbort)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonImgOTFAbort, buttonImgOTFStart});
@@ -2007,6 +2029,7 @@ public class DataAcquisition extends Panel {
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
@@ -2066,6 +2089,7 @@ public class DataAcquisition extends Panel {
private javax.swing.JSpinner spinnerImgEng2;
private javax.swing.JSpinner spinnerImgExp;
private javax.swing.JSpinner spinnerImgMeasurements;
private javax.swing.JSpinner spinnerImgOTFExp;
private javax.swing.JSpinner spinnerOutliersThreshold;
private javax.swing.JSpinner spinnerScans;
private javax.swing.JSpinner spinnerSpecAvg;
+29 -35
View File
@@ -34,43 +34,38 @@
<Component id="buttonCloseVG10" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonStopDetector" linkSize="1" max="32767" attributes="0"/>
<EmptySpace pref="68" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<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"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="spinnerExpusure" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="comboMode" 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="deviceValuePanel1" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" 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"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel1" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="comboDepth" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel2" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="comboDepth" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonAquire" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonOpenVG10" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonStartDetector" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="deviceValuePanel2" linkSize="1" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonAquire" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonOpenVG10" min="-2" pref="127" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonStartDetector" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="renderer" max="32767" attributes="0"/>
@@ -120,7 +115,7 @@
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel3" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExpusure" linkSize="2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerExposure" linkSize="2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="deviceValuePanel3" linkSize="2" alignment="2" min="-2" max="-2" attributes="0"/>
<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"/>
@@ -169,12 +164,11 @@
<Component class="javax.swing.JComboBox" name="comboDepth">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="5">
<StringArray count="4">
<StringItem index="0" value="4"/>
<StringItem index="1" value="8"/>
<StringItem index="2" value="16"/>
<StringItem index="3" value="32"/>
<StringItem index="4" value="Unknown"/>
</StringArray>
</Property>
<Property name="enabled" type="boolean" value="false"/>
@@ -188,7 +182,7 @@
</Component>
<Component class="javax.swing.JButton" name="buttonStartDetector">
<Properties>
<Property name="text" type="java.lang.String" value="Start Eiger"/>
<Property name="text" type="java.lang.String" value="Start EIGER"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartDetectorActionPerformed"/>
@@ -221,7 +215,7 @@
<Property name="text" type="java.lang.String" value="Exposure [s]:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerExpusure">
<Component class="javax.swing.JSpinner" name="spinnerExposure">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="300.0" minimum="0.001" numberType="java.lang.Double" stepSize="1.0" type="number"/>
@@ -229,7 +223,7 @@
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerExpusureStateChanged"/>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerExposureStateChanged"/>
</Events>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
@@ -249,7 +243,7 @@
</Component>
<Component class="javax.swing.JButton" name="buttonStopDetector">
<Properties>
<Property name="text" type="java.lang.String" value="Stop Eiger"/>
<Property name="text" type="java.lang.String" value="Stop EIGER"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStopDetectorActionPerformed"/>
@@ -278,7 +272,7 @@
</Component>
<Component class="javax.swing.JButton" name="buttonAquire">
<Properties>
<Property name="text" type="java.lang.String" value="Aquire"/>
<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="buttonAquireActionPerformed"/>
@@ -286,7 +280,7 @@
</Component>
<Component class="javax.swing.JButton" name="buttonDone">
<Properties>
<Property name="text" type="java.lang.String" value="Done"/>
<Property name="text" type="java.lang.String" value="Stop"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDoneActionPerformed"/>
+50 -46
View File
@@ -5,6 +5,7 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.io.IOException;
import java.util.logging.Level;
import java.util.concurrent.TimeUnit;
/**
*
@@ -66,12 +67,12 @@ public class Eiger extends Panel {
} catch (Exception ex){
}
try{
spinnerExpusure.setValue(exposure.take());
spinnerExposure.setValue(exposure.take());
} catch (Exception ex){
}
comboDepth.setEnabled(bitDepth.isInitialized());
comboMode.setEnabled(mode.isInitialized());
spinnerExpusure.setEnabled(exposure.isInitialized());
spinnerExposure.setEnabled(exposure.isInitialized());
} finally{
updatingControls=false;
@@ -95,7 +96,7 @@ public class Eiger extends Panel {
jLabel2 = new javax.swing.JLabel();
comboMode = new javax.swing.JComboBox<>();
jLabel3 = new javax.swing.JLabel();
spinnerExpusure = new javax.swing.JSpinner();
spinnerExposure = new javax.swing.JSpinner();
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceValuePanel3 = new ch.psi.pshell.swing.DeviceValuePanel();
@@ -119,7 +120,7 @@ public class Eiger extends Panel {
jLabel1.setText("Bit Depth:");
comboDepth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "4", "8", "16", "32", "Unknown" }));
comboDepth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "4", "8", "16", "32" }));
comboDepth.setEnabled(false);
comboDepth.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -127,7 +128,7 @@ public class Eiger extends Panel {
}
});
buttonStartDetector.setText("Start Eiger");
buttonStartDetector.setText("Start EIGER");
buttonStartDetector.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartDetectorActionPerformed(evt);
@@ -146,11 +147,11 @@ public class Eiger extends Panel {
jLabel3.setText("Exposure [s]:");
spinnerExpusure.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 300.0d, 1.0d));
spinnerExpusure.setEnabled(false);
spinnerExpusure.addChangeListener(new javax.swing.event.ChangeListener() {
spinnerExposure.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 300.0d, 1.0d));
spinnerExposure.setEnabled(false);
spinnerExposure.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerExpusureStateChanged(evt);
spinnerExposureStateChanged(evt);
}
});
@@ -160,7 +161,7 @@ public class Eiger extends Panel {
deviceValuePanel3.setDeviceName("eiger_exposure_rbv");
buttonStopDetector.setText("Stop Eiger");
buttonStopDetector.setText("Stop EIGER");
buttonStopDetector.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStopDetectorActionPerformed(evt);
@@ -183,14 +184,14 @@ public class Eiger extends Panel {
}
});
buttonAquire.setText("Aquire");
buttonAquire.setText("Start");
buttonAquire.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAquireActionPerformed(evt);
}
});
buttonDone.setText("Done");
buttonDone.setText("Stop");
buttonDone.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDoneActionPerformed(evt);
@@ -259,35 +260,32 @@ public class Eiger extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonStopDetector, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap(68, Short.MAX_VALUE))
.addComponent(buttonStopDetector, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.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(spinnerExpusure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboMode, 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(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, 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)))
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonStartDetector)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonStartDetector)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 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)
@@ -303,7 +301,7 @@ public class Eiger extends Panel {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExpusure});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -329,7 +327,7 @@ public class Eiger extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel3)
.addComponent(spinnerExpusure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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))
@@ -355,14 +353,16 @@ public class Eiger extends Panel {
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExpusure});
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExposure});
}// </editor-fold>//GEN-END:initComponents
private void comboDepthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboDepthActionPerformed
try{
if (!updatingControls){
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()-1) {
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
TimeUnit.SECONDS.sleep(1);
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()) {
Integer value = Integer.valueOf((String)comboDepth.getSelectedItem());
bitDepth.write(value);
}
@@ -392,6 +392,8 @@ public class Eiger extends Panel {
if (value==1){
value++;
}
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
TimeUnit.SECONDS.sleep(1);
mode.write(value);
}
} catch (Exception ex){
@@ -399,15 +401,17 @@ public class Eiger extends Panel {
}
}//GEN-LAST:event_comboModeActionPerformed
private void spinnerExpusureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpusureStateChanged
private void spinnerExposureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExposureStateChanged
try{
if (!updatingControls){
exposure.write((Double)spinnerExpusure.getValue());
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
TimeUnit.SECONDS.sleep(1);
exposure.write((Double)spinnerExposure.getValue());
}
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_spinnerExpusureStateChanged
}//GEN-LAST:event_spinnerExposureStateChanged
private void buttonStopDetectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopDetectorActionPerformed
try {
@@ -506,9 +510,9 @@ public class Eiger extends Panel {
private void spinnerMaxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMaxStateChanged
ColormapSource source = (ColormapSource) renderer.getOrigin();
source.getConfig().colormapMax = (Double)spinnerMax.getValue();
try {
source.getConfig().colormapMax = ((Integer)spinnerMax.getValue());
source.getConfig().save();
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
@@ -518,9 +522,9 @@ public class Eiger extends Panel {
private void spinnerMinStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMinStateChanged
ColormapSource source = (ColormapSource) renderer.getOrigin();
source.getConfig().colormapMax = (Double)spinnerMin.getValue();
try {
source.getConfig().colormapMin = ((Integer)spinnerMin.getValue());
source.getConfig().save();
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
@@ -551,7 +555,7 @@ public class Eiger extends Panel {
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spinnerExpusure;
private javax.swing.JSpinner spinnerExposure;
private javax.swing.JSpinner spinnerMax;
private javax.swing.JSpinner spinnerMin;
// End of variables declaration//GEN-END:variables
+29
View File
@@ -123,6 +123,13 @@ class LEEM2000(TcpDevice):
ret.initialize()
return ret
def get_positioner(self, var, name=None):
if name is None:
name=var
ret = LEEM2000Positioner(name, var, self)
ret.initialize()
return ret
def get_motor(self, motor_id, name=None):
if name is None:
name=str(motor_id)
@@ -186,6 +193,24 @@ class LEEM2000Child(RegisterBase):
def doWrite(self, val):
self.microscope.set_value(self.var, val)
class LEEM2000Positioner (PositionerBase):
def __init__(self, name, var, microscope):
PositionerBase.__init__(self, name, PositionerConfig())
self.var = var
self.microscope = microscope
self.setpoint = None
def doRead(self):
if self.setpoint is None:
self.setpoint = self.doReadReadback()
return self.setpoint
def doWrite(self, val):
self.microscope.set_value(self.var, val)
self.setpoint = val
def doReadReadback(self):
return self.microscope.get_value(self.var)
class LEEM2000Motor(RegisterBase):
def __init__(self,name, motor_id, microscope):
@@ -227,9 +252,13 @@ add_device (microscope.get_motor(11,"manip_x"), True)
add_device (microscope.get_motor(10,"manip_y"), True)
add_device (microscope.get_tilt('L','R', "tilt_h"), True)
add_device (microscope.get_tilt('D','U', "tilt_v"), True)
#add_device (microscope.get_positioner("MOBJ","objective"), True)
#add_device (microscope.get_positioner("OSTIGA","obj_stig_a"), True)
#add_device (microscope.get_positioner("OSTIGB","obj_stig_b"), True)
add_device (microscope.get_child("MOBJ","objective"), True)
add_device (microscope.get_child("OSTIGA","obj_stig_a"), True)
add_device (microscope.get_child("OSTIGB","obj_stig_b"), True)
microscope.setPolling(5000)
class TiltMotor(RegisterBase):
+2 -2
View File
@@ -280,7 +280,7 @@ def init_eiger(exposure=None, check=True, retries=2):
else:
print "Error initializing Eiger, retrying: " + str(sys.exc_info()[1])
def restore_eiger(check=True, retries=2):
def restore_eiger(check=True, retries=2, exposure_time = 0.2):
"""
Set Eiger default mode
"""
@@ -290,7 +290,7 @@ def restore_eiger(check=True, retries=2):
stop_eiger()
eiger.setNumImages(1)# Is it relevant?
set_eiger_number_of_frames(1, check)
set_exposure_time(0.2, check)
set_exposure_time(exposure_time, check)
apply_averaging_detector(False)
eiger.grabMode=eiger.GrabMode.Continuous
eiger.start()
+96 -9
View File
@@ -227,7 +227,7 @@ def convert_file_full(input_file_name, output_file_name, pol = None):
#os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
###################################################################################################
#OTF function
#Scan commands
###################################################################################################
def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
"""
@@ -245,6 +245,65 @@ 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, "ALPHA":float(alpha) if alpha is not None else None})
def two_pol(switching="Tune_Detune", sequence="A", measurements=4, exposure=1.0, average=2, name = None):
set_exec_pars(open=False)
if name:
set_exec_pars(name=name)
run("templates/Eiger2Img", { \
"METHOD": "Two_Pol", "AUTO_SAVE": True, \
"MEASUREMENTS": int(measurements), "EXPOSURE": float(exposure), "AVERAGE": int(average), \
"SWITCHING": switching, "SEQUENCE": sequence, \
"ENERGY_1":None, "ENERGY_2":None, \
"NUMBER_SCANS":1, "SWITCH_POL": False, \
})
def two_energies(energy_1, energy_2, measurements=4, exposure=1.0, average=2, name = None):
set_exec_pars(open=False)
if name:
set_exec_pars(name=name)
run("templates/Eiger2Img", { \
"METHOD": "Two_Energies", "AUTO_SAVE": True, \
"MEASUREMENTS": int(measurements), "EXPOSURE": float(exposure), "AVERAGE": int(average), \
"SWITCHING": None, "SEQUENCE": None, \
"ENERGY_1":energy_1, "ENERGY_2":energy_2, \
"NUMBER_SCANS":1, "SWITCH_POL": False, \
})
def take_image(scans=1, switch_pol=False, measurements=4, exposure=1.0, average=2, name = None):
set_exec_pars(open=False)
if name:
set_exec_pars(name=name)
run("templates/Eiger2Img", { \
"METHOD": "Take_Image", "AUTO_SAVE": True, \
"MEASUREMENTS": int(measurements), "EXPOSURE": float(exposure), "AVERAGE": int(average), \
"SWITCHING": None, "SEQUENCE": None, \
"ENERGY_1":None, "ENERGY_2":None, \
"NUMBER_SCANS":scans, "SWITCH_POL": switch_pol, \
})
def abs_spec(ranges, roi=None, switch_pol=False, scans=1, exposure=1.0, average=2, name = None):
set_exec_pars(open=False)
if name:
set_exec_pars(name=name)
if ROI is None:
if ("DAQ_PANEL_ROIS" in globals()) and (len(DAQ_PANEL_ROIS) > 0):
ROI = DAQ_PANEL_ROIS
else:
width, height = eiger.getImageSize()
ROI = {"Region1": [0, 0, width, height]}
run("templates/EigerAbsSpec", { \
"ROI": roi, "SAVE_SPECTRUM": True, "SAVE_IMAGES":True, "WITH_I0": True, \
"RANGES": ranges, "SWITCH_POL": switch_pol, \
"NUMBER_SCANS": int(scans), "EXPOSURE": float(exposure), "AVERAGE": int(average), \
})
###################################################################################################
#Devices
###################################################################################################
@@ -613,7 +672,7 @@ def restore_beamline_setup():
###################################################################################################
def fit(ydata, xdata = None):
def fit(ydata, xdata = None, limit_to_range=False):
"""
Gaussian fit
"""
@@ -627,9 +686,15 @@ def fit(ydata, xdata = None):
print "Max index:" + str(index_max),
print " x:" + str(max_x),
print " y:" + str(max_y)
gaussians = fit_gaussians(ydata, xdata, [index_max,])
(norm, mean, sigma) = gaussians[0]
p = plot([ydata],["data"],[xdata], title="Fit" )[0]
gaussians = fit_gaussians(ydata, xdata, [index_max,])
if gaussians[0] is None:
if limit_to_range:
print "Max -> " + str(max_x)
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.MAGENTA.darker())
return (None , max_x, None)
(norm, mean, sigma) = gaussians[0]
print " mean:" + str(mean)
fitted_gaussian_function = Gaussian(norm, mean, sigma)
scale_x = [float(min(xdata)), float(max(xdata)) ]
points = max((len(xdata)+1), 100)
@@ -640,15 +705,37 @@ def fit(ydata, xdata = None):
fit_y.append(fitted_gaussian_function.value(x))
p.addSeries(LinePlotSeries("fit"))
p.getSeries(1).setData(fit_x, fit_y)
if abs(mean - xdata[index_max]) < ((scale_x[0] + scale_x[1])/2):
if abs(mean - xdata[index_max]) < abs((scale_x[0] + scale_x[1])/2):
if limit_to_range and not (scale_x[0] <= mean <= scale_x[1]):
print "Limiting to range ", scale_x, " max=", str(max_x)
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.MAGENTA.darker())
return (None , max_x, None)
print "Mean -> " + str(mean)
p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker())
return (norm, mean, sigma)
else:
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY)
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
if limit_to_range:
print "Max -> " + str(max_x)
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.MAGENTA.darker())
return (None , max_x, None)
else:
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY)
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
###################################################################################################
#Additional initialization
###################################################################################################
run("templates/FocusScan")
def auto_focus():
run("templates/AutoFocus")
def auto_intensity():
return scan_focus(girder_x, 0.05, 0.005, average=3)
###################################################################################################
#Settings
###################################################################################################
+28
View File
@@ -0,0 +1,28 @@
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,)
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])
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
+6
View File
@@ -8,6 +8,7 @@ if get_exec_pars().source == CommandSource.ui:
FILE = 'ImageOTF'
ROI = {"Region1": [286, 86, 79, 70], "Region2": [153, 279, 95, 82]}
SAVE_IMAGES=True
EXPOSURE = 0.2
SAVE_DIAGS = True
@@ -76,6 +77,9 @@ class Time(Readable):
scan_completed = False
try:
if EXPOSURE != eiger.getExposure():
restore_eiger(exposure_time = EXPOSURE)
caput('START', '1')
#av = create_averager(CADC1, -1, -1)
@@ -115,5 +119,7 @@ except:
caput('START', '0')
time.sleep(0.1)
raise
finally:
restore_eiger()
after_sample() #To call check_id_error()
+63
View File
@@ -0,0 +1,63 @@
SETTLING_TIME =0.5
MAX_CONTRAST = 10e14
import java.awt.Rectangle as Rectangle
class RoiContrast(ReadonlyRegisterBase):
def doRead(self):
if hasattr(self, "roi"):
return image.getData().getGradientVariance(False, self.roi)
return 0.0
def getName(self):
return "roi_contrast"
def set_roi(self, roi):
self.roi=roi
if get_device("image_contrast") is None:
add_device(image.getContrast(), False)
if get_device("roi_contrast") is None:
add_device(RoiContrast(), False)
def scan_focus(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"
time.sleep(eiger.exposure)
rec.invalidate()
def before_pass(scan, num_pass):
print "Waiting to reach scan init pos"
time.sleep(1.0)
if roi is None:
sensor = image_contrast
else:
sensor = roi_contrast
roi_contrast.set_roi(roi)
if average > 1:
sensor = create_averager(sensor, average, interval = eiger.exposure, name = image_contrast.name, monitored = False)
r = lscan( positioner, [sensor,], -pos_range, pos_range, pos_step, \
latency=eiger.exposure+SETTLING_TIME, relative=True, after_read=after_read, before_pass=before_pass)
ydata, xdata = r[sensor], r[positioner]
if average > 1:
ydata = [v.doubleValue() for v in ydata]
(norm, mn, std ) = fit (ydata, xdata, limit_to_range=True)
range_scan = (min(r[positioner]), max(r[positioner]))
if (mn is not None) and (range_scan[0] <= mn <= range_scan[1]):
print "Valid fit for ", positioner.name, mn
if update_position:
time.sleep(0.5) # Wait restoring positions
print "Updating position: ", positioner.name, mn
positioner.write(mn)
else:
print "Invalid fit for ", positioner.name, mn, range_scan
time.sleep(1.0) # Wait restoring positions
return r
+4 -4
View File
@@ -1,6 +1,6 @@
CENTER = [400.0, 600.0]
RANGE = 400
STEP = 200.0
CENTER = [0.0, 0.0]
RANGE = 2000
STEP = 1000.0
SETTLING_TIME = 1.0
RANGE_H = [CENTER[0]-RANGE, CENTER[0]+RANGE]
@@ -8,7 +8,7 @@ RANGE_V = [CENTER[1]-RANGE, CENTER[1]+RANGE]
STEP_H = STEP
STEP_V = STEP
INIT_TILT = True # True - tilt must be manually set to 0,0 before the scan
# False - tilt set 0.0 al leasts once at PShell startut
# False - tilt set 0.0 at least once at PShell start up
if INIT_TILT:
init_tilt()