diff --git a/config/AbsortionSpectrum/Fe_L3_fine_JHI.abs b/config/AbsortionSpectrum/Fe_L3_fine_JHI.abs
new file mode 100644
index 0000000..8174f6a
Binary files /dev/null and b/config/AbsortionSpectrum/Fe_L3_fine_JHI.abs differ
diff --git a/config/AbsortionSpectrum/Fe_L3_fine_JHI_01.abs b/config/AbsortionSpectrum/Fe_L3_fine_JHI_01.abs
new file mode 100644
index 0000000..9694d3d
Binary files /dev/null and b/config/AbsortionSpectrum/Fe_L3_fine_JHI_01.abs differ
diff --git a/config/AbsortionSpectrum/Ru_M23_coarse.abs b/config/AbsortionSpectrum/Ru_M23_coarse.abs
new file mode 100644
index 0000000..960dfd4
Binary files /dev/null and b/config/AbsortionSpectrum/Ru_M23_coarse.abs differ
diff --git a/config/AbsortionSpectrum/Ru_M23_fine.abs b/config/AbsortionSpectrum/Ru_M23_fine.abs
new file mode 100644
index 0000000..d4a4454
Binary files /dev/null and b/config/AbsortionSpectrum/Ru_M23_fine.abs differ
diff --git a/config/AbsortionSpectrum/Ti_L23_edge_finer_peter.abs b/config/AbsortionSpectrum/Ti_L23_edge_finer_peter.abs
new file mode 100644
index 0000000..dea408a
Binary files /dev/null and b/config/AbsortionSpectrum/Ti_L23_edge_finer_peter.abs differ
diff --git a/config/devices.properties b/config/devices.properties
index 20a7a43..6584937 100644
--- a/config/devices.properties
+++ b/config/devices.properties
@@ -1,3 +1,4 @@
+voltage=ch.psi.pshell.epics.ChannelDouble|X11MA-KEI13:SETVOLTAGE|||true
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=ch.psi.pshell.epics.Motor|X11MA-FE-SH:center|||true
@@ -79,11 +80,12 @@ 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
-#CADC4=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC4|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
+temp_readout=ch.psi.pshell.epics.ReadonlyProcessVariable|X11MA-PC-SW:Pt100-K|||true
cam2=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-CAM2|||true
raw=ch.psi.pshell.imaging.CameraSource|eiger|||true
image2=ch.psi.pshell.imaging.CameraSource|cam2|||true
diff --git a/config/plugins.properties b/config/plugins.properties
old mode 100755
new mode 100644
index 3948137..9182de7
--- a/config/plugins.properties
+++ b/config/plugins.properties
@@ -1,3 +1,4 @@
+XPEEM_Settings.java=enabled
Align_ComputeShifts.java=disabled
Imaging.java=disabled
Initialization.java=disabled
diff --git a/config/session_metadata.properties b/config/session_metadata.properties
index 3744647..d6ae05f 100755
--- a/config/session_metadata.properties
+++ b/config/session_metadata.properties
@@ -1,5 +1,5 @@
-#Sat Dec 04 14:45:18 CET 2021
-keywords=List;[]
-ownerEmail=String;arik.beck@psi.ch
+#Sat Apr 30 16:57:19 CEST 2022
+keywords=List;[]ASI
+ownerEmail=String;alan_farhan@baylor.edu
contactEmail=String;armin.kleibert@psi.ch
-owner=String;Federico Stramaglia
+owner=String;Alan Farhan
diff --git a/config/sessions.properties b/config/sessions.properties
old mode 100755
new mode 100644
index b2d0027..3ad7cd9
--- a/config/sessions.properties
+++ b/config/sessions.properties
@@ -1,2 +1,3 @@
-#Mon Nov 29 10:07:24 CET 2021
-SessionCounter=54
+#Mon May 23 22:49:52 CEST 2022
+SessionCounter=73
+CurrentSession=73
diff --git a/config/settings.properties b/config/settings.properties
index d81d029..607a764 100644
--- a/config/settings.properties
+++ b/config/settings.properties
@@ -1,23 +1,23 @@
-#Tue Dec 14 13:48:54 CET 2021
+#Tue May 24 10:06:26 CEST 2022
HARMONIC_ID_1=1
RSYNC_USER=
OUTLIERS_THRESHOLD=1000000000
NORM_FILE=/sls/X11MA/data/e19357/Data1/2021_10
AUTO_SWITCH_VALVE=true
DRY_RUN=false
-POL_ID_2=Lin_Hor
-OFFSET_ID_1=-5.0
+POL_ID_2=Lin_Ver
+OFFSET_ID_1=-1.4
ID=ID2
-OFFSET_ID_2=-2.1
+OFFSET_ID_2=-1.2
proposal=proposal
-ENERGY=800.0
+ENERGY=455.0
proposer=proposer
-POL_ID_1=Lin_Hor
+POL_ID_1=Circ_Plus
RSYNC_HOST=
sample=sample
RSYNC_PATH=
pgroup=pgroup
-ALPHA_ID_2=60.0
+ALPHA_ID_2=45.0
ALPHA_ID_1=0.0
RSYNC_DEL=true
AVERAGING_DETECTOR=true
diff --git a/config/variables.properties b/config/variables.properties
index beb14ca..34467d0 100644
--- a/config/variables.properties
+++ b/config/variables.properties
@@ -1,4 +1,4 @@
-#Sat Dec 11 05:45:56 CET 2021
-LastRunDate=211211
-FileSequentialNumber=11873
-DaySequentialNumber=66
+#Mon May 23 23:22:11 CEST 2022
+LastRunDate=220523
+FileSequentialNumber=13674
+DaySequentialNumber=9
diff --git a/devices/dp.properties b/devices/dp.properties
new file mode 100644
index 0000000..b509325
--- /dev/null
+++ b/devices/dp.properties
@@ -0,0 +1,10 @@
+#Fri Mar 18 13:36:57 CET 2022
+minValue=NaN
+unit=null
+offset=0.0
+maxValue=NaN
+rotation=false
+precision=-1
+sign_bit=0
+scale=1.0
+resolution=NaN
diff --git a/devices/fe_slit_H_ctr.properties b/devices/fe_slit_H_ctr.properties
index 85e7c72..18c8050 100644
--- a/devices/fe_slit_H_ctr.properties
+++ b/devices/fe_slit_H_ctr.properties
@@ -1,13 +1,13 @@
-#Thu Sep 09 15:24:03 CEST 2021
+#Thu Mar 24 11:38:37 CET 2022
precision=5
scale=1.0
estbilizationDelay=0
-resolution=0.01
+resolution=0.1
minValue=-100.0
-defaultSpeed=0.5
+defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
-minSpeed=0.05
+minSpeed=0.1
offset=0.0
maxValue=100.0
rotation=false
diff --git a/devices/fe_slit_V_ctr.properties b/devices/fe_slit_V_ctr.properties
index 7b279a7..5c9222b 100644
--- a/devices/fe_slit_V_ctr.properties
+++ b/devices/fe_slit_V_ctr.properties
@@ -1,13 +1,13 @@
-#Thu Sep 09 15:24:18 CEST 2021
+#Thu Mar 24 11:38:38 CET 2022
precision=5
scale=1.0
estbilizationDelay=0
-resolution=0.01
+resolution=0.1
minValue=-100.0
-defaultSpeed=0.5
+defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
-minSpeed=0.05
+minSpeed=0.1
offset=0.0
maxValue=100.0
rotation=false
diff --git a/devices/temp_readout.properties b/devices/temp_readout.properties
new file mode 100644
index 0000000..887e4ce
--- /dev/null
+++ b/devices/temp_readout.properties
@@ -0,0 +1,6 @@
+#Wed Dec 15 09:36:20 CET 2021
+unit=K
+offset=0.0
+precision=3
+sign_bit=0
+scale=1.0
diff --git a/plugins/Eiger.form b/plugins/Eiger.form
index ae26afe..ecea691 100755
--- a/plugins/Eiger.form
+++ b/plugins/Eiger.form
@@ -53,7 +53,7 @@
-
+
diff --git a/plugins/Eiger.java b/plugins/Eiger.java
index 21d46bf..01fe9d9 100755
--- a/plugins/Eiger.java
+++ b/plugins/Eiger.java
@@ -86,7 +86,7 @@ public class Eiger extends Panel {
new Thread(()->{
String fov="";
try {
- fov = String.valueOf(eval("microscope.get_preset_label()", true));
+ fov = String.valueOf(eval("fov.take()", true));
} catch (Exception ex) {
}
String label =fov;
@@ -286,7 +286,7 @@ public class Eiger extends Panel {
.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(buttonShowDetectorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
.addComponent(textFOV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(86, 86, 86)
diff --git a/plugins/Imaging.form b/plugins/Imaging.form
index 264ed59..ce05c43 100644
--- a/plugins/Imaging.form
+++ b/plugins/Imaging.form
@@ -61,6 +61,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -72,9 +87,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -92,6 +122,13 @@
+
+
+
+
+
+
+
@@ -102,6 +139,10 @@
+
+
+
+
@@ -118,6 +159,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -279,7 +335,7 @@
-
+
@@ -317,7 +373,7 @@
-
+
@@ -500,7 +556,7 @@
-
+
@@ -589,6 +645,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/Imaging.java b/plugins/Imaging.java
index a0c930c..0ed9a59 100644
--- a/plugins/Imaging.java
+++ b/plugins/Imaging.java
@@ -1,3 +1,4 @@
+import ch.psi.pshell.core.Context;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays.Rect;
import ch.psi.pshell.imaging.Renderer;
@@ -115,6 +116,16 @@ public class Imaging extends Panel {
}
};
+ void showArrows(boolean show) throws Exception{
+ if (show){
+ setGlobalVar("IMAGING_RENDERER", renderer);
+ evalAsync("start_arrows(renderer=IMAGING_RENDERER)");
+ } else {
+ setGlobalVar("IMAGING_RENDERER", renderer);
+ evalAsync("stop_arrows(renderer=IMAGING_RENDERER)");
+ }
+ }
+
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
@@ -125,6 +136,8 @@ public class Imaging extends Panel {
jPanel4 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
buttonStartAutoIntensity = new javax.swing.JButton();
+ jLabel12 = new javax.swing.JLabel();
+ spinnerExpositionIntensity = new javax.swing.JSpinner();
buttonAbort = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
buttonRoiSet = new javax.swing.JButton();
@@ -155,6 +168,12 @@ public class Imaging extends Panel {
spinnerStepStig = new javax.swing.JSpinner();
jLabel9 = new javax.swing.JLabel();
spinnerExposition = new javax.swing.JSpinner();
+ deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
+ jLabel10 = new javax.swing.JLabel();
+ checkArrows = new javax.swing.JCheckBox();
+ jLabel11 = new javax.swing.JLabel();
+ jLabel13 = new javax.swing.JLabel();
+ deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
renderer.setMode(ch.psi.pshell.imaging.RendererMode.Fit);
@@ -167,10 +186,25 @@ public class Imaging extends Panel {
}
});
+ jLabel12.setText("Exposure:");
+
+ spinnerExpositionIntensity.setModel(new javax.swing.SpinnerNumberModel(NaNd, 0.01d, NaNd, 1.0d));
+ spinnerExpositionIntensity.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ spinnerExpositionIntensityStateChanged(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(jLabel12)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spinnerExpositionIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoIntensity)
@@ -179,7 +213,10 @@ public class Imaging extends Panel {
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel12)
+ .addComponent(spinnerExpositionIntensity, 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(buttonStartAutoIntensity)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -447,7 +484,7 @@ public class Imaging extends Panel {
.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())
+ .addGap(0, 0, 0))
);
jLabel9.setText("Exposure:");
@@ -476,7 +513,7 @@ public class Imaging extends Panel {
.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)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoFocus)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
@@ -508,11 +545,30 @@ public class Imaging extends Panel {
.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)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStartAutoFocus)
.addContainerGap())
);
+ deviceValuePanel1.setDeviceName("temp_readout");
+
+ jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel10.setText("Temperature (K):");
+
+ checkArrows.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
+ checkArrows.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ checkArrowsActionPerformed(evt);
+ }
+ });
+
+ jLabel11.setText("Reference arrows:");
+
+ jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel13.setText("FOV:");
+
+ deviceValuePanel2.setDeviceName("fov");
+
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
@@ -528,6 +584,18 @@ public class Imaging extends Panel {
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
.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)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(checkArrows)
+ .addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(15, 15, 15))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -538,9 +606,21 @@ public class Imaging extends Panel {
.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.UNRELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(jLabel10)
+ .addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(jLabel13)
+ .addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(checkArrows)
+ .addComponent(jLabel11))
.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))
+ .addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@@ -636,7 +716,8 @@ public class Imaging extends Panel {
", runs=" + runs +
", renderer=IMAGING_RENDERER"+
", roi=IMAGING_ROI"+
- ", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) + ")";
+ ", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
+ ")";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
showException((Exception) t);
@@ -650,8 +731,11 @@ public class Imaging extends Panel {
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)";
+ //String cmd = "scan_contrast(girder_x, 0.05, 0.005, average=3)";
+ Double exposure = (Double) spinnerExpositionIntensity.getValue();
+ String cmd = "auto_intensity(roi=IMAGING_ROI" +
+ ", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
+ ")";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
showException((Exception) t);
@@ -707,6 +791,18 @@ public class Imaging extends Panel {
// TODO add your handling code here:
}//GEN-LAST:event_spinnerExpositionStateChanged
+ private void checkArrowsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkArrowsActionPerformed
+ try{
+ showArrows(checkArrows.isSelected());
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_checkArrowsActionPerformed
+
+ private void spinnerExpositionIntensityStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpositionIntensityStateChanged
+ // TODO add your handling code here:
+ }//GEN-LAST:event_spinnerExpositionIntensityStateChanged
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.ButtonGroup buttonGroup1;
@@ -714,7 +810,14 @@ public class Imaging extends Panel {
private javax.swing.JButton buttonRoiSet;
private javax.swing.JButton buttonStartAutoFocus;
private javax.swing.JButton buttonStartAutoIntensity;
+ private javax.swing.JCheckBox checkArrows;
+ private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
+ private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel2;
private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ private javax.swing.JLabel jLabel12;
+ private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@@ -736,6 +839,7 @@ public class Imaging extends Panel {
private ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spinnerAverage;
private javax.swing.JSpinner spinnerExposition;
+ private javax.swing.JSpinner spinnerExpositionIntensity;
private javax.swing.JSpinner spinnerHeight;
private javax.swing.JSpinner spinnerRangeObj;
private javax.swing.JSpinner spinnerRangeStig;
diff --git a/plugins/XPEEM_Settings.form b/plugins/XPEEM_Settings.form
new file mode 100644
index 0000000..30247a8
--- /dev/null
+++ b/plugins/XPEEM_Settings.form
@@ -0,0 +1,81 @@
+
+
+
diff --git a/plugins/XPEEM_Settings.java b/plugins/XPEEM_Settings.java
new file mode 100644
index 0000000..84ae9f7
--- /dev/null
+++ b/plugins/XPEEM_Settings.java
@@ -0,0 +1,171 @@
+
+import ch.psi.pshell.ui.Panel;
+import ch.psi.utils.State;
+
+/**
+ *
+ */
+public class XPEEM_Settings extends Panel {
+
+ public XPEEM_Settings() {
+ 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) {
+ }
+
+ @Override
+ protected void onTimer() {
+ }
+
+ @Override
+ protected void onLoaded() {
+
+ }
+
+ @Override
+ protected void onUnloaded() {
+
+ }
+
+ //Invoked by 'update()' to update components in the event thread
+ @Override
+ protected void doUpdate() {
+ }
+
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ ButtonDefaultXrays = new javax.swing.JButton();
+ ButtonDefaultOptics15kV = new javax.swing.JButton();
+ ButtonDefaultOptics10kV = new javax.swing.JButton();
+ ButtonNeutralizePosition = new javax.swing.JButton();
+
+ ButtonDefaultXrays.setText("X-rays (Default)");
+ ButtonDefaultXrays.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ButtonDefaultXraysActionPerformed(evt);
+ }
+ });
+
+ ButtonDefaultOptics15kV.setText("PEEM Optics 15 kV (Default)");
+ ButtonDefaultOptics15kV.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ButtonDefaultOptics15kVActionPerformed(evt);
+ }
+ });
+
+ ButtonDefaultOptics10kV.setText("PEEM Optics 10 kV (Default)");
+ ButtonDefaultOptics10kV.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ButtonDefaultOptics10kVActionPerformed(evt);
+ }
+ });
+
+ ButtonNeutralizePosition.setText("Sample Position (Neutralize)");
+ ButtonNeutralizePosition.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ButtonNeutralizePositionActionPerformed(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(79, 79, 79)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(ButtonNeutralizePosition)
+ .addComponent(ButtonDefaultOptics10kV)
+ .addComponent(ButtonDefaultOptics15kV)
+ .addComponent(ButtonDefaultXrays))
+ .addContainerGap(322, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(46, 46, 46)
+ .addComponent(ButtonDefaultOptics15kV)
+ .addGap(36, 36, 36)
+ .addComponent(ButtonDefaultOptics10kV)
+ .addGap(36, 36, 36)
+ .addComponent(ButtonDefaultXrays)
+ .addGap(34, 34, 34)
+ .addComponent(ButtonNeutralizePosition)
+ .addContainerGap(115, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void ButtonDefaultXraysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultXraysActionPerformed
+ try {
+ evalAsync("xrays_default()").handle((ret,ex)->{
+ if (ex!=null){
+ showException((Exception)ex);
+ }
+ return ret;
+ });
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_ButtonDefaultXraysActionPerformed
+
+ private void ButtonDefaultOptics15kVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultOptics15kVActionPerformed
+ try {
+ evalAsync("peem_optics_default_15kV()").handle((ret,ex)->{
+ if (ex!=null){
+ showException((Exception)ex);
+ }
+ return ret;
+ });
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_ButtonDefaultOptics15kVActionPerformed
+
+ private void ButtonDefaultOptics10kVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonDefaultOptics10kVActionPerformed
+ try {
+ evalAsync("peem_optics_default_10kV()").handle((ret,ex)->{
+ if (ex!=null){
+ showException((Exception)ex);
+ }
+ return ret;
+ });
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_ButtonDefaultOptics10kVActionPerformed
+
+ private void ButtonNeutralizePositionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonNeutralizePositionActionPerformed
+ try {
+ evalAsync("neutralize_position()").handle((ret,ex)->{
+ if (ex!=null){
+ showException((Exception)ex);
+ }
+ return ret;
+ });
+ } catch (Exception ex) {
+ showException(ex);
+ }
+ }//GEN-LAST:event_ButtonNeutralizePositionActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton ButtonDefaultOptics10kV;
+ private javax.swing.JButton ButtonDefaultOptics15kV;
+ private javax.swing.JButton ButtonDefaultXrays;
+ private javax.swing.JButton ButtonNeutralizePosition;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/script/Users/Cinthia/Fe_XMCD.py b/script/Users/Cinthia/Fe_XMCD.py
index e8e66e6..e04e88a 100644
--- a/script/Users/Cinthia/Fe_XMCD.py
+++ b/script/Users/Cinthia/Fe_XMCD.py
@@ -4,21 +4,25 @@
open_vg13()
time.sleep(1)
+#v_apply = -40
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+TRZ.write(33.8)
+sample_name='2nm_'
+
+#XMCD
#XMCD
-caput('X11MA-ES3-MAG1:V', 2)
-time.sleep(15)
+#caput('X11MA-ES3-MAG1:V', 5)
-sample_name='M4_150'
-caput('X11MA-KEI10:RANGE', 7)
-caput('X11MA-KEI11:RANGE', 7)
-caput('X11MA-KEI12:RANGE', 9)
-for i in range(2):
+for i in range(1):
#time.sleep(1)
- otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
- otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
- otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
- otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=700, end=715, time=1, delay=1, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+ sample_name + str(v_apply) + '_Cp')
+ #otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ #otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ #otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ #otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
close_vg13()
\ No newline at end of file
diff --git a/script/Users/Cinthia/Fe_XMCD_hyst_samples.py b/script/Users/Cinthia/Fe_XMCD_hyst_samples.py
new file mode 100644
index 0000000..870a4ac
--- /dev/null
+++ b/script/Users/Cinthia/Fe_XMCD_hyst_samples.py
@@ -0,0 +1,274 @@
+
+
+
+open_vg13()
+time.sleep(1)
+'''
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(18.4)
+sample_name='8nm'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(26.4)
+sample_name='3nm'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(33.8)
+sample_name='2nm'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+'''
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+# repeat loops
+
+
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(18.4)
+sample_name='8nm'
+
+
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(26.4)
+sample_name='3nm'
+
+
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(33.8)
+sample_name='2nm'
+
+
+
+# HYST
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 5.0 # starting mag. field in Amps
+ B2 = -5.0 # final mag. field in Amps
+ BSTEP = 0.1 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+close_vg13()
\ No newline at end of file
diff --git a/script/Users/Cinthia/Fe_XMCD_hyst_voltage.py b/script/Users/Cinthia/Fe_XMCD_hyst_voltage.py
new file mode 100644
index 0000000..7506365
--- /dev/null
+++ b/script/Users/Cinthia/Fe_XMCD_hyst_voltage.py
@@ -0,0 +1,283 @@
+
+
+
+open_vg13()
+time.sleep(1)
+
+
+v_apply = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+#v_apply = 0
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+
+
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(18.4)
+sample_name='2nm_150V'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+
+v_apply = -40
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+#v_apply = 0
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='2nm_-40V'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+v_apply = -150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+#v_apply = 0
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+sample_name='2nm_-150V'
+
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+v_apply = 70
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+#v_apply = 0
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+sample_name='2nm_+70V'
+
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+v_apply = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+v_apply = 0
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+TRZ.write(18.4)
+sample_name='2nm_0V'
+
+for i in range(3):
+ #time.sleep(1)
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=760, time=4, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -10.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (700,709) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+close_vg13()
\ No newline at end of file
diff --git a/script/Users/Cinthia/Fe_XMCD_samples.py b/script/Users/Cinthia/Fe_XMCD_samples.py
new file mode 100644
index 0000000..6ebd76e
--- /dev/null
+++ b/script/Users/Cinthia/Fe_XMCD_samples.py
@@ -0,0 +1,24 @@
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 5)
+#time.sleep(15)
+
+sample_name='2nm'
+
+#caput('X11MA-KEI10:RANGE', 7)
+#caput('X11MA-KEI11:RANGE', 7)
+#caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ #time.sleep(1)
+ otf2(start=705, end=713, time=1, delay=1, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+ otf2(start=705, end=713, time=1, delay=1, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-10.0, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
+
+close_vg13()
\ No newline at end of file
diff --git a/script/Users/Cinthia/Fe_scan_quick.py b/script/Users/Cinthia/Fe_scan_quick.py
new file mode 100644
index 0000000..8a5e9b7
--- /dev/null
+++ b/script/Users/Cinthia/Fe_scan_quick.py
@@ -0,0 +1,2 @@
+sample_name='3nm_z26p9'
+otf2(start=705, end=713, time=1, delay=1, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Fe_'+sample_name + '_Cp')
\ No newline at end of file
diff --git a/script/Users/Cinthia/apply_voltage.py b/script/Users/Cinthia/apply_voltage.py
index cdecbbb..1c86fe6 100644
--- a/script/Users/Cinthia/apply_voltage.py
+++ b/script/Users/Cinthia/apply_voltage.py
@@ -1,22 +1,31 @@
-v_start= -20
-v_end = 0
+
+
+
+#v_apply = 0
+close_vg13()
+
+v_start=caget('X11MA-KEI13:SETVOLTAGE')
+
+
+caput('X11MA-KEI13:RANGE',0) # 0= auto range. To protect Keithley
step_size=5
-n=(v_start - v_end)/step_size
+n=(v_start - v_apply)/step_size
for i in range (int(abs(n))+1):
- if v_start > v_end:
+ if v_start > v_apply:
v=v_start - i*step_size
#print "reverse"
print ("Apply", v," volts")
- caput('X11MA-KEI11:SETVOLTAGE',v)
+ caput('X11MA-KEI13:SETVOLTAGE',v)
sleep(0.1)
else:
v= i*step_size+v_start
print "forward"
print ("Apply", v," volts")
- caput('X11MA-KEI11:SETVOLTAGE',v)
+ caput('X11MA-KEI13:SETVOLTAGE',v)
sleep(0.1)
sleep(20)
+open_vg13()
diff --git a/script/Users/Cinthia/field_sweepID2.py b/script/Users/Cinthia/field_sweepID2.py
old mode 100755
new mode 100644
index c3ffef1..3b50418
--- a/script/Users/Cinthia/field_sweepID2.py
+++ b/script/Users/Cinthia/field_sweepID2.py
@@ -1,6 +1,6 @@
#Parameters
-sample_name='M4_120'
+#sample_name='M4_120'
'''
FILENAME='Hyst_'+ sample_name + '_E2_Cm'
B1 = 1.0 # starting mag. field in Amps
@@ -58,8 +58,8 @@ for r in RANGES:
setpoints = setpoints + frange(r[0], r[1], r[2], True)
# plot properties
-set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm'])
-set_preference(Preference.PLOT_TYPES, {'tey_norm':1})
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm'], ['field','tfy_norm'])
+set_preference(Preference.PLOT_TYPES, {'tey_norm':1},{'tfy_norm':1})
#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
@@ -77,8 +77,12 @@ for B in setpoints:
while abs(readback1-B) > FIELD_PRECISION:
#readback1 = caget("X11MA-XMCD:Ireadout")
readback1 = field.read()
+ print "Wait field is set"
time.sleep(0.1)
+ print "field setting done"
+ print "field readback is:", field.read()
+
for E in ENERGIES:
print "Setting energy = ", E
#caput('X11PHS-E:GO.A', E)
diff --git a/script/Users/Cinthia/field_sweepID2_regions.py b/script/Users/Cinthia/field_sweepID2_regions.py
new file mode 100644
index 0000000..b543436
--- /dev/null
+++ b/script/Users/Cinthia/field_sweepID2_regions.py
@@ -0,0 +1,124 @@
+#Parameters
+
+#sample_name='M4_120'
+'''
+FILENAME='Hyst_'+ sample_name + '_E2_Cm'
+B1 = 1.0 # starting mag. field in Amps
+B2 = -1.0 # final mag. field in Amps
+BSTEP = 0.5 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ENERGIES = (707.4) #list of energies in eV
+MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+OFFSET2 = -1.2 #ID2 offset
+FIELD_PRECISION = 0.04 #
+ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ACC_TIME = 0.1 # time in 100ms
+'''
+
+
+# List of scans. Each scan is defined as: (start,stop, step)
+# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
+# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
+RANGES = [(B1, B2, -BSTEP1),(B2, -B2, -BSTEP2),(-B2,-B1,-BSTEP1),(-B1,-B2,BSTEP1),(-B2,B2,BSTEP2),(B2,B1,BSTEP1)]
+set_exec_pars(open=False, tag=FILENAME)
+
+#open_vg13()
+
+#Pre-actions
+# Here polarization and offsets are set
+
+caput ("X11PHS-E:OPT","PGM+ID2")
+print "ID mode set to PGM+ID2"
+#caput(OTF_OFF1,-50) #detune ID1
+caput('X11MA-ID2:ENERGY-OFFS', OFFSET2)
+print "ID offset set to ", OFFSET2
+cawait('X11MA-ID2:DONE',1)
+print "Offset setting done"
+
+
+if MODE is 1 or 2:
+ caput('X11MA-ID2:MODE',MODE)
+ #print "Polarization mode set"
+else:
+ raise Exception("Invalid polarization type: " + MODE)
+
+cawait('X11MA-ID2:DONE',1)
+print "ID mode setting done"
+
+
+
+
+# setting number of samples to be averaged, which depends on the accumulation time
+avg = ACC_TIME * 10
+caput("X11MA-ES1-10ADC:AVG",avg)
+
+# Generating a list of mag. fields (setpoints) needed for the loop
+setpoints = []
+for r in RANGES:
+ setpoints = setpoints + frange(r[0], r[1], r[2], True)
+
+# plot properties
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm'])
+set_preference(Preference.PLOT_TYPES, {'tey_norm':1})
+
+#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan.start()
+
+# Main loop
+for B in setpoints:
+ print "Setting field = ", B
+ caput("X11MA-XMCD:I-SETraw",B)
+ time.sleep( FIELD_CHANGE_SLEEP ) # Settling time
+
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+
+ while abs(readback1-B) > FIELD_PRECISION:
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+ print "difference", abs(readback1-B)
+ time.sleep(0.1)
+
+ time.sleep( FIELD_CHANGE_SLEEP ) # Settling time
+ print "field setting done"
+ print "field readback is:", field.read()
+
+ for E in ENERGIES:
+ print "Setting energy = ", E
+ #caput('X11PHS-E:GO.A', E)
+ energy.write(E)
+ time.sleep (0.1)
+ print "Energy set"
+ cawait('X11PHS:alldone', 1)
+ print "done"
+
+ readback2 = energy.read()
+ if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
+ raise Exception('Energy could not be set to the value ' + str(E))
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ detector1 = keithley_1a.read() #Keithley1
+ detector2 = keithley_2a.read() #Keithley2
+ detector3 = keithley_3a.read() #Keithley3
+ detector4 = caget('X11MA-ID2:MODE') #polarization in ID2
+ #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2
+ detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get()
+ detector7 = caget("ARIDI-PCT:CURRENT")
+ #detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+
+ tey_norm = detector2/detector1
+ tfy_norm = detector3/detector1
+
+ #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2
+ if detector4 == 'CIRC +': detector4 = 1
+ elif detector4 == 'CIRC -': detector4 = 2
+ else: detector4 = 0
+ #print "step 7"
+ #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm])
+ scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm])
+
+scan.end()
+caput("X11MA-ES1-10ADC:AVG",1)
+
+#close_vg13()
diff --git a/script/Users/Cinthia/hyst_ID2_Fe.py b/script/Users/Cinthia/hyst_ID2_Fe.py
old mode 100755
new mode 100644
index 6a48096..4a72e2a
--- a/script/Users/Cinthia/hyst_ID2_Fe.py
+++ b/script/Users/Cinthia/hyst_ID2_Fe.py
@@ -1,24 +1,27 @@
open_vg13()
-
-sample_name='M4_120'
+TRZ.write(18.4)
+sample_name='8nm'
#HYST
-caput('X11MA-KEI10:RANGE', 7)
-caput('X11MA-KEI11:RANGE', 7)
-caput('X11MA-KEI12:RANGE', 9)
+#caput('X11MA-KEI10:RANGE', 7)
+#caput('X11MA-KEI11:RANGE', 7)
+#caput('X11MA-KEI12:RANGE', 9)
+# HYST
+
+caput('X11MA-ES3-MAG1:V', 2.5) # max Kepco current
for i in range(1):
FILENAME='Hyst_'+ sample_name + '_Cm'
- B1 = 2.0 # starting mag. field in Amps
- B2 = -2.0 # final mag. field in Amps
+ B1 = 2.5 # starting mag. field in Amps
+ B2 = -2.5 # final mag. field in Amps
BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
- ENERGIES = (700,707.4) #list of energies in eV
+ ENERGIES = (700,709) #list of energies in eV
MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
- OFFSET2 = -1.2 #ID2 offset
+ OFFSET2 = -10.0 #ID2 offset
FIELD_PRECISION = 0.04 #
ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
@@ -26,17 +29,18 @@ for i in range(1):
run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
FILENAME='Hyst_'+ sample_name + '_Cp'
- B1 = 2.0 # starting mag. field in Amps
- B2 = -2.0 # final mag. field in Amps
+ B1 = 2.5 # starting mag. field in Amps
+ B2 = -2.5 # final mag. field in Amps
BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
- ENERGIES = (700,707.4) #list of energies in eV
+ ENERGIES = (700,709) #list of energies in eV
MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
- OFFSET2 = -1.2 #ID2 offset
+ OFFSET2 = -9.0 #ID2 offset
FIELD_PRECISION = 0.04 #
ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
ACC_TIME = 0.1 #I think this number x 10 is in seconds
run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
close_vg13()
diff --git a/script/Users/Cinthia/hyst_ID2_Fe_regions.py b/script/Users/Cinthia/hyst_ID2_Fe_regions.py
new file mode 100644
index 0000000..8fbc8ef
--- /dev/null
+++ b/script/Users/Cinthia/hyst_ID2_Fe_regions.py
@@ -0,0 +1,486 @@
+
+
+'''
+TRZ.write(33.8)
+
+
+sample_name='2nm_150'
+v_apply = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+#cawait ('ACOAU-ACCU:OP-MODE', "Light-Available") # wait for electron beam to be back
+#sleep(0.5)
+
+
+sample_name='2nm_150_rem'
+v_apply = 0
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+'''
+sample_name='2nm_-40'
+v_apply = -20
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_-60'
+v_apply = -40
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+sample_name='2nm_-80'
+v_apply = -60
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+sample_name='2nm_-100'
+v_apply = -80
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_-150'
+v_apply = -100
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+'''
+sample_name='2nm_-150_rem'
+v_apply = 0
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_40'
+v_apply = 40
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_60'
+v_apply = 60
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_80'
+v_apply = 80
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_100'
+v_apply = 100
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+
+
+sample_name='2nm_150'
+v_apply = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-KEI13:RANGE',7) # 6=200nA 7=20nA. Measurement settings. Apply voltage puts it to auto-range
+
+open_vg13()
+sleep(10)
+
+#HYST
+
+for i in range(1):
+ B1 = 2.5 # max mag. field in Amps
+ B2 = 1.0 # intermediate mag field in Amps
+ BSTEP1 = 0.1 # step size mag. field in Amps. between B1 and B2
+ BSTEP2 = 0.04 # step size mag. field in Amps. between B2 and -B2
+ ENERGIES = (709,709) #list of energies in eV
+ FIELD_PRECISION = 0.035 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+ caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ OFFSET2 = -10.0 #ID2 offset
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -9.0 #ID2 offset
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2_regions.py')
+
+'''
+
+
+
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/Cinthia/voltage_sweep.py b/script/Users/Cinthia/voltage_sweep.py
new file mode 100644
index 0000000..0a38835
--- /dev/null
+++ b/script/Users/Cinthia/voltage_sweep.py
@@ -0,0 +1,123 @@
+#Parameters
+
+#sample_name='M4_120'
+'''
+FILENAME='Hyst_'+ sample_name + '_E2_Cm'
+B1 = 1.0 # starting mag. field in Amps
+B2 = -1.0 # final mag. field in Amps
+BSTEP = 0.5 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ENERGIES = (707.4) #list of energies in eV
+MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+OFFSET2 = -1.2 #ID2 offset
+FIELD_PRECISION = 0.04 #
+ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ACC_TIME = 0.1 # time in 100ms
+'''
+
+
+# List of scans. Each scan is defined as: (start,stop, step)
+# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
+# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
+RANGES = [(B1, B2, -BSTEP),(B2,B1,BSTEP)]
+set_exec_pars(open=False, tag=FILENAME)
+
+#open_vg13()
+
+#Pre-actions
+# Here polarization and offsets are set
+
+caput ("X11PHS-E:OPT","PGM+ID2")
+print "ID mode set to PGM+ID2"
+#caput(OTF_OFF1,-50) #detune ID1
+caput('X11MA-ID2:ENERGY-OFFS', OFFSET2)
+print "ID offset set to ", OFFSET2
+cawait('X11MA-ID2:DONE',1)
+print "Offset setting done"
+
+
+if MODE is 1 or 2:
+ caput('X11MA-ID2:MODE',MODE)
+ #print "Polarization mode set"
+else:
+ raise Exception("Invalid polarization type: " + MODE)
+
+cawait('X11MA-ID2:DONE',1)
+print "ID mode setting done"
+
+
+
+
+# setting number of samples to be averaged, which depends on the accumulation time
+avg = ACC_TIME * 10
+caput("X11MA-ES1-10ADC:AVG",avg)
+
+# Generating a list of mag. fields (setpoints) needed for the loop
+setpoints = []
+for r in RANGES:
+ setpoints = setpoints + frange(r[0], r[1], r[2], True)
+
+# plot properties
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm'])
+set_preference(Preference.PLOT_TYPES, {'tey_norm':1})
+
+#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan.start()
+
+# Main loop
+for B in setpoints:
+ print "Setting field = ", B
+ caput("X11MA-XMCD:I-SETraw",B)
+ time.sleep( FIELD_CHANGE_SLEEP ) # Settling time
+
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+
+ while abs(readback1-B) > FIELD_PRECISION:
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+ print "Wait field is set"
+ time.sleep(0.1)
+
+ print "field setting done"
+ print "field readback is:", field.read()
+
+ for E in ENERGIES:
+ print "Setting energy = ", E
+ #caput('X11PHS-E:GO.A', E)
+ energy.write(E)
+ time.sleep (0.1)
+ print "Energy set"
+ cawait('X11PHS:alldone', 1)
+ print "done"
+
+ readback2 = energy.read()
+ if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
+ raise Exception('Energy could not be set to the value ' + str(E))
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ detector1 = keithley_1a.read() #Keithley1
+ detector2 = keithley_2a.read() #Keithley2
+ detector3 = keithley_3a.read() #Keithley3
+ detector4 = caget('X11MA-ID2:MODE') #polarization in ID2
+ #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2
+ detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get()
+ detector7 = caget("ARIDI-PCT:CURRENT")
+ #detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+
+ tey_norm = detector2/detector1
+ tfy_norm = detector3/detector1
+
+ #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2
+ if detector4 == 'CIRC +': detector4 = 1
+ elif detector4 == 'CIRC -': detector4 = 2
+ else: detector4 = 0
+ #print "step 7"
+ #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm])
+ scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm])
+
+scan.end()
+caput("X11MA-ES1-10ADC:AVG",1)
+
+#close_vg13()
diff --git a/script/Users/Cinthia/voltage_sweepID2_regions.py b/script/Users/Cinthia/voltage_sweepID2_regions.py
new file mode 100644
index 0000000..19611be
--- /dev/null
+++ b/script/Users/Cinthia/voltage_sweepID2_regions.py
@@ -0,0 +1,120 @@
+#Parameters
+
+sample_name='8nm_0p16A'
+
+ENERGIES = (709,709) #list of energies in eV
+#FIELD_PRECISION = 0.035 #
+ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ACC_TIME = 0.1 #I think this number x 10 is in seconds
+
+#caput('X11MA-ES3-MAG1:V', B1) # set Kepco to max current for hyst loop
+
+FILENAME='V_'+ sample_name + '_Cm'
+OFFSET2 = -10.0 #ID2 offset
+MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+
+
+
+
+# List of scans. Each scan is defined as: (start,stop, step)
+# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
+# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
+#RANGES = [(B1, B2, -BSTEP1),(B2, -B2, -BSTEP2),(-B2,-B1,-BSTEP1),(-B1,-B2,BSTEP1),(-B2,B2,BSTEP2),(B2,B1,BSTEP1)]
+RANGES = [(150, 0, -20),(0, -150, -5),(-150,0,20),(0, 150,5)]
+set_exec_pars(open=False, tag=FILENAME)
+
+#open_vg13()
+
+#Pre-actions
+# Here polarization and offsets are set
+
+caput ("X11PHS-E:OPT","PGM+ID2")
+print "ID mode set to PGM+ID2"
+#caput(OTF_OFF1,-50) #detune ID1
+caput('X11MA-ID2:ENERGY-OFFS', OFFSET2)
+print "ID offset set to ", OFFSET2
+cawait('X11MA-ID2:DONE',1)
+print "Offset setting done"
+
+
+if MODE is 1 or 2:
+ caput('X11MA-ID2:MODE',MODE)
+ #print "Polarization mode set"
+else:
+ raise Exception("Invalid polarization type: " + MODE)
+
+cawait('X11MA-ID2:DONE',1)
+print "ID mode setting done"
+
+
+
+
+# setting number of samples to be averaged, which depends on the accumulation time
+avg = ACC_TIME * 10
+caput("X11MA-ES1-10ADC:AVG",avg)
+
+# Generating a list of mag. fields (setpoints) needed for the loop
+setpoints = []
+for r in RANGES:
+ setpoints = setpoints + frange(r[0], r[1], r[2], True)
+
+# plot properties
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tfy_norm'])
+set_preference(Preference.PLOT_TYPES, {'tfy_norm':1})
+
+
+scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+#scan = ManualScan(['field'], ['Energy','I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints)], [max(setpoints)], [len(setpoints)-1])
+scan.start()
+
+# Main loop
+for B in setpoints:
+ print "Setting field = ", B
+ caput("X11MA-KEI13:SETVOLTAGE",B)
+ time.sleep( FIELD_CHANGE_SLEEP ) # Settling time
+ #time.sleep(0.5)
+ readback1 = caget('X11MA-KEI13:SETVOLTAGE')
+
+ #print "field setting done"
+ #print "field readback is:", field.read()
+
+ for E in ENERGIES:
+ print "Setting energy = ", E
+ #caput('X11PHS-E:GO.A', E)
+ energy.write(E)
+ time.sleep (0.1)
+ print "Energy set"
+ cawait('X11PHS:alldone', 1)
+ print "done"
+
+ readback2 = energy.read()
+ if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
+ raise Exception('Energy could not be set to the value ' + str(E))
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ detector1 = energy.read()
+ detector2 = keithley_1a.read() #Keithley1
+ detector3 = keithley_2a.read() #Keithley2
+ detector4 = keithley_3a.read() #Keithley3
+ detector5 = caget('X11MA-ID2:MODE') #polarization in ID2
+ #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2
+ detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get()
+ detector7 = caget("ARIDI-PCT:CURRENT")
+ #detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+
+ tey_norm = detector2/detector1
+ tfy_norm = detector3/detector1
+
+ #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2
+ if detector4 == 'CIRC +': detector4 = 1
+ elif detector4 == 'CIRC -': detector4 = 2
+ else: detector4 = 0
+ #print "step 7"
+ #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm])
+ scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm])
+
+scan.end()
+caput("X11MA-ES1-10ADC:AVG",1)
+
+#close_vg13()
diff --git a/script/Users/Armin/TestUserScript_Armin.py b/script/Users/PEEM/Armin/TestUserScript_Armin.py
similarity index 100%
rename from script/Users/Armin/TestUserScript_Armin.py
rename to script/Users/PEEM/Armin/TestUserScript_Armin.py
diff --git a/script/Users/PEEM/Beck/stack_image_and_spectrum.py b/script/Users/PEEM/Beck/stack_image_and_spectrum.py
new file mode 100644
index 0000000..f8309dd
--- /dev/null
+++ b/script/Users/PEEM/Beck/stack_image_and_spectrum.py
@@ -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)
diff --git a/script/Users/PEEM/Beck/stack_scan.py b/script/Users/PEEM/Beck/stack_scan.py
new file mode 100644
index 0000000..67078de
--- /dev/null
+++ b/script/Users/PEEM/Beck/stack_scan.py
@@ -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)
diff --git a/script/Users/PEEM/filianina/E_scan_XMCD.py b/script/Users/PEEM/filianina/E_scan_XMCD.py
new file mode 100644
index 0000000..3b75db9
--- /dev/null
+++ b/script/Users/PEEM/filianina/E_scan_XMCD.py
@@ -0,0 +1,23 @@
+#Constants
+AVERAGE = 1
+EXPOSURE = 2.0
+MEASUREMENTS = 50
+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(638.2)
+
+#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)
+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)
+ two_pol(switching="Tune_Detune", sequence="A", measurements=MEASUREMENTS, exposure=EXPOSURE, average=AVERAGE)
+ time.sleep(2.0)
diff --git a/script/Users/PEEM/filianina/lupa_scan.py b/script/Users/PEEM/filianina/lupa_scan.py
new file mode 100644
index 0000000..f6ea227
--- /dev/null
+++ b/script/Users/PEEM/filianina/lupa_scan.py
@@ -0,0 +1,49 @@
+#Constants
+AVERAGE = 3
+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.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.5)
+time.sleep(2.0)
+two_pol(switching="Tune_Detune", sequence="A", 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=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)
+
+#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
+#abs_spec(ranges="C_edge", roi="test", switch_pol=False, scans=1, exposure=EXPOSURE, average=AVERAGE)
+
+
+
+#manip_x.write(0.1)
+
+
+#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()
\ No newline at end of file
diff --git a/script/Users/PEEM/filianina/stack_scan.py b/script/Users/PEEM/filianina/stack_scan.py
new file mode 100644
index 0000000..08f4ceb
--- /dev/null
+++ b/script/Users/PEEM/filianina/stack_scan.py
@@ -0,0 +1,29 @@
+#Constants
+AVERAGE = 1
+EXPOSURE = 1.0
+MEASUREMENTS = 50
+positions=[-510, -525, -540, -555, -570, -585]
+for position in positions:
+ manip_x.write(position)
+ time.sleep(60)
+ #auto_intensity()
+ #time_sleep(2)
+#TakeImage at 710 eV at the given polarization
+ change_energy(638.8)
+#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.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(638.0)
+ time.sleep(2.0)
+ two_pol(switching="Tune_Detune", sequence="A", 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=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)
\ No newline at end of file
diff --git a/script/Users/PEEM/filianina/xmld_xmcd_cicle.py b/script/Users/PEEM/filianina/xmld_xmcd_cicle.py
new file mode 100644
index 0000000..e835b41
--- /dev/null
+++ b/script/Users/PEEM/filianina/xmld_xmcd_cicle.py
@@ -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)
+
+
\ No newline at end of file
diff --git a/script/Users/TR-TEY/Cinthia/2021_june_Energy.py b/script/Users/TR-TEY/Cinthia/2021_june_Energy.py
new file mode 100755
index 0000000..63318ee
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/2021_june_Energy.py
@@ -0,0 +1,174 @@
+#otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST')
+
+#Sample M1
+#TRY.write(-1.5)
+#TRZ.write(14)
+
+#time.sleep(30)
+
+#open_vg13()
+#time.sleep(1)
+
+#caput('X11MA-ES3-MAG1:V', 2)
+#time.sleep(15)
+
+#caput('X11MA-KEI10:RANGE', 7)
+#caput('X11MA-KEI11:RANGE', 8)
+#caput('X11MA-KEI12:RANGE', 9)
+#for i in range(2):
+ # time.sleep(1)
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M1_Cp')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M1_Cm')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M1_Cm')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M1_Cp')
+
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M1_LH')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M1_LV')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M1_LV')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M1_LH')
+
+
+#Sample M2
+#TRY.write(-0.9)
+#TRZ.write(22.5)
+
+#time.sleep(30)
+
+#open_vg13()
+#time.sleep(1)
+
+#caput('X11MA-ES3-MAG1:V', 2)
+#time.sleep(15)
+
+#caput('X11MA-KEI10:RANGE', 7)
+#caput('X11MA-KEI11:RANGE', 8)
+#caput('X11MA-KEI12:RANGE', 9)
+#for i in range(2):
+ # time.sleep(1)
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M2_Cp')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M2_Cm')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M2_Cm')
+ # otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M2_Cp')
+
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M2_LH')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M2_LV')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M2_LV')
+#otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M2_LH')
+
+ #Sample M3
+TRY.write(-0.9)
+TRZ.write(30)
+
+time.sleep(30)
+
+open_vg13()
+time.sleep(1)
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)#Changed th gain to 9 due to saturation
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M3_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M3_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M3_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M3_Cp')
+
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M3_LH')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M3_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M3_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M3_LH')
+
+#Sample M6
+TRY.write(2.0)
+TRZ.write(30.0)
+
+time.sleep(30)
+
+open_vg13()
+time.sleep(1)
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M6_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M6_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M6_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M6_Cp')
+
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M6_LH')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M6_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M6_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M6_LH')
+
+#Sample M5
+TRY.write(2.0)
+TRZ.write(24.5)
+
+time.sleep(30)
+
+open_vg13()
+time.sleep(1)
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_Cp')
+
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M5_LH')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M5_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M5_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M5_LH')
+
+#Sample M4
+TRY.write(1.0)
+TRZ.write(18)
+
+time.sleep(30)
+
+open_vg13()
+time.sleep(1)
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M4_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M4_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M4_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M4_Cp')
+
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M4_LH')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M4_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 90.0, offset=-1.2, name='Ti_M4_LV')
+otf2(start=450, end=475, time=3.0, delay=10, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Ti_M4_LH')
+
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/Fe_XMCD.py b/script/Users/TR-TEY/Cinthia/Fe_XMCD.py
new file mode 100644
index 0000000..e8e66e6
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Fe_XMCD.py
@@ -0,0 +1,24 @@
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+sample_name='M4_150'
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ #time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+
+close_vg13()
\ No newline at end of file
diff --git a/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst.py b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst.py
new file mode 100644
index 0000000..3fafe9c
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst.py
@@ -0,0 +1,763 @@
+#otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST')
+
+#Sample M5 30V
+'''
+TRY.write(2.0)
+TRZ.write(24.5)
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+
+caput('X11MA-KEI11:VOLTOUT','ON')
+
+
+caput('X11MA-KEI11:SETVOLTAGE',0)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',30)
+time.sleep(10)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_30_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_30_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_30_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_30_Cp')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_30_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_30_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#Sample M5 -30
+
+
+
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',0)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-5)
+time.sleep(1)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-30)
+
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-30_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-30_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-30_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-30_Cp')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_-30_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_-30_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+
+#Sample M5 -50V
+
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',-35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-50)
+time.sleep(10)
+
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-50_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-50_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-50_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-50_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_-50_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_-50_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#Sample M5 50V
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',-45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',0)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',50)
+time.sleep(10)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_50_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_50_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_50_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_50_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_50_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_50_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#Sample M5 70V
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',70)
+time.sleep(10)
+
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_70_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_70_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_70_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_70_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_70_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_70_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#Sample M5 -70V
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',60)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',50)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',0)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-50)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-60)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-70)
+time.sleep(10)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-70_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-70_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-70_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-70_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_-70_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_-70_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#Sample M5 -100V
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',-75)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-80)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-85)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-90)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-95)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-100)
+time.sleep(10)
+'''
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-100_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_-100_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_-100_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#M5 100V
+
+
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI11:SETVOLTAGE',-95)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-90)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-85)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-80)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-75)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-70)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-60)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-50)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',-5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',0)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',50)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',60)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',70)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',75)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',80)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',85)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',95)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',100)
+time.sleep(10)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_100_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_100_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_100_Cp')
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_100_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_100_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+caput('X11MA-KEI11:SETVOLTAGE',95)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',90)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',85)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',80)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',75)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',70)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',65)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',60)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',55)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',50)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',45)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',40)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',35)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',30)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',25)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',0)
+
+caput('X11MA-KEI11:VOLTOUT','OFF')
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1.py b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1.py
new file mode 100644
index 0000000..14fabba
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1.py
@@ -0,0 +1,67 @@
+#otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST')
+
+#Sample M5
+TRY.write(2.0)
+TRZ.write(24.5)
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+sample_name='M5_100_-20'
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1sample_1voltage.py b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1sample_1voltage.py
new file mode 100644
index 0000000..b85f176
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_1sample_1voltage.py
@@ -0,0 +1,78 @@
+#otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST')
+
+#Sample M5
+TRY.write(2.0)
+TRZ.write(24.5)
+
+open_vg13()
+time.sleep(1)
+
+#XMCD
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+'''
+caput('X11MA-KEI11:VOLTOUT','ON')
+
+#caput('X11MA-KEI11:VOLTOUT',1)
+caput('X11MA-KEI11:SETVOLTAGE',5)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',10)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',15)
+time.sleep(1)
+caput('X11MA-KEI11:SETVOLTAGE',20)
+'''
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(2):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-20_0_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-20_0_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_M5_-20_0_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_M5_-20_0_Cp')
+
+#HYST
+'''
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="Hyst_M5_-20_0_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="Hyst_M5_-20_0_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+'''
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_cofield.py b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_cofield.py
new file mode 100644
index 0000000..47da868
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Fe_XMCD_hyst_cofield.py
@@ -0,0 +1,613 @@
+#otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST')
+
+#Sample M6 150
+
+TRY.write(2.0)
+TRZ.write(30.0)
+
+open_vg13()
+time.sleep(1)
+'''
+#XMCD
+sample_name='M6_150'
+
+v_start =0
+v_end = 150
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#XMCD
+sample_name='M6_150_-20'
+
+v_start =150
+v_end = -20
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 9)
+
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+
+#XMCD
+#sample_name='M6_-150'
+
+v_start =-20
+v_end = -150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='M6_-150'
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#XMCD
+#sample_name='M6_-150_55'
+
+v_start =-150
+v_end = 55
+
+
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='M6_-150_55'
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#XMCD
+#sample_name='M6_150_0'
+
+v_start =55
+v_end = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+v_start =150
+v_end = 0
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='M6_150_0'
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#XMCD
+#sample_name='M6_-150_0'
+
+v_start =0
+v_end = -150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+v_start =-150
+v_end = 0
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='M6_-150_0'
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#XMCD
+#sample_name='M6_150'
+
+v_start =0
+v_end = 150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+'''
+sample_name='M6_150'
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+#XMCD
+sample_name='M6_150_-20'
+
+v_start =150
+v_end = -20
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 8)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+#XMCD
+#sample_name='M6_-150'
+
+v_start =-20
+v_end = -150
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+sample_name='M6_-150'
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+
+
+
+#XMCD
+sample_name='M6_-150_55'
+
+v_start =-150
+v_end = 55
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+caput('X11MA-ES3-MAG1:V', 2)
+time.sleep(15)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+for i in range(1):
+ time.sleep(1)
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC +', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cp')
+ otf2(start=695, end=740, time=3, delay=10, mode='CIRC -', alpha = 0.0, offset=-1.2, name='Fe_'+sample_name + '_Cm')
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+v_start =55
+v_end = 0
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/apply_voltage.py')
+
+
+caput('X11MA-KEI11:VOLTOUT','OFF')
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/Test_alingment.py b/script/Users/TR-TEY/Cinthia/Test_alingment.py
new file mode 100644
index 0000000..4063ef1
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/Test_alingment.py
@@ -0,0 +1,2 @@
+#otf2(start=703, end=715, time=0.2, delay=5, mode='LINEAR', alpha = 0.0, offset=-1.2, name='test')
+otf2(start=450, end=475, time=3.0, delay=5, mode='CIRC -', alpha = 0.0, offset=-1.2, name='test')
\ No newline at end of file
diff --git a/script/Users/TR-TEY/Cinthia/apply_voltage.py b/script/Users/TR-TEY/Cinthia/apply_voltage.py
new file mode 100644
index 0000000..cdecbbb
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/apply_voltage.py
@@ -0,0 +1,22 @@
+v_start= -20
+v_end = 0
+
+step_size=5
+n=(v_start - v_end)/step_size
+
+for i in range (int(abs(n))+1):
+ if v_start > v_end:
+ v=v_start - i*step_size
+ #print "reverse"
+ print ("Apply", v," volts")
+ caput('X11MA-KEI11:SETVOLTAGE',v)
+ sleep(0.1)
+ else:
+ v= i*step_size+v_start
+ print "forward"
+ print ("Apply", v," volts")
+ caput('X11MA-KEI11:SETVOLTAGE',v)
+ sleep(0.1)
+sleep(20)
+
+
diff --git a/script/Users/TR-TEY/Cinthia/field_sweepID2.py b/script/Users/TR-TEY/Cinthia/field_sweepID2.py
new file mode 100755
index 0000000..c3ffef1
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/field_sweepID2.py
@@ -0,0 +1,119 @@
+#Parameters
+
+sample_name='M4_120'
+'''
+FILENAME='Hyst_'+ sample_name + '_E2_Cm'
+B1 = 1.0 # starting mag. field in Amps
+B2 = -1.0 # final mag. field in Amps
+BSTEP = 0.5 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ENERGIES = (707.4) #list of energies in eV
+MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+OFFSET2 = -1.2 #ID2 offset
+FIELD_PRECISION = 0.04 #
+ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ACC_TIME = 0.1 # time in 100ms
+'''
+
+
+# List of scans. Each scan is defined as: (start,stop, step)
+# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
+# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
+RANGES = [(B1, B2, -BSTEP),(B2,B1,BSTEP)]
+set_exec_pars(open=False, tag=FILENAME)
+
+#open_vg13()
+
+#Pre-actions
+# Here polarization and offsets are set
+
+caput ("X11PHS-E:OPT","PGM+ID2")
+print "ID mode set to PGM+ID2"
+#caput(OTF_OFF1,-50) #detune ID1
+caput('X11MA-ID2:ENERGY-OFFS', OFFSET2)
+print "ID offset set to ", OFFSET2
+cawait('X11MA-ID2:DONE',1)
+print "Offset setting done"
+
+
+if MODE is 1 or 2:
+ caput('X11MA-ID2:MODE',MODE)
+ #print "Polarization mode set"
+else:
+ raise Exception("Invalid polarization type: " + MODE)
+
+cawait('X11MA-ID2:DONE',1)
+print "ID mode setting done"
+
+
+
+
+# setting number of samples to be averaged, which depends on the accumulation time
+avg = ACC_TIME * 10
+caput("X11MA-ES1-10ADC:AVG",avg)
+
+# Generating a list of mag. fields (setpoints) needed for the loop
+setpoints = []
+for r in RANGES:
+ setpoints = setpoints + frange(r[0], r[1], r[2], True)
+
+# plot properties
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm'])
+set_preference(Preference.PLOT_TYPES, {'tey_norm':1})
+
+#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
+scan.start()
+
+# Main loop
+for B in setpoints:
+ print "Setting field = ", B
+ caput("X11MA-XMCD:I-SETraw",B)
+ time.sleep( FIELD_CHANGE_SLEEP ) # Settling time
+
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+
+ while abs(readback1-B) > FIELD_PRECISION:
+ #readback1 = caget("X11MA-XMCD:Ireadout")
+ readback1 = field.read()
+ time.sleep(0.1)
+
+ for E in ENERGIES:
+ print "Setting energy = ", E
+ #caput('X11PHS-E:GO.A', E)
+ energy.write(E)
+ time.sleep (0.1)
+ print "Energy set"
+ cawait('X11PHS:alldone', 1)
+ print "done"
+
+ readback2 = energy.read()
+ if abs(readback2 - E) > 0.1 : # TODO: Check accuracy
+ raise Exception('Energy could not be set to the value ' + str(E))
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ detector1 = keithley_1a.read() #Keithley1
+ detector2 = keithley_2a.read() #Keithley2
+ detector3 = keithley_3a.read() #Keithley3
+ detector4 = caget('X11MA-ID2:MODE') #polarization in ID2
+ #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2
+ detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get()
+ detector7 = caget("ARIDI-PCT:CURRENT")
+ #detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+
+ tey_norm = detector2/detector1
+ tfy_norm = detector3/detector1
+
+ #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2
+ if detector4 == 'CIRC +': detector4 = 1
+ elif detector4 == 'CIRC -': detector4 = 2
+ else: detector4 = 0
+ #print "step 7"
+ #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm])
+ scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm])
+
+scan.end()
+caput("X11MA-ES1-10ADC:AVG",1)
+
+#close_vg13()
diff --git a/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe.py b/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe.py
new file mode 100755
index 0000000..6a48096
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe.py
@@ -0,0 +1,48 @@
+
+open_vg13()
+
+
+sample_name='M4_120'
+
+
+#HYST
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+
+for i in range(1):
+ FILENAME='Hyst_'+ sample_name + '_Cm'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME='Hyst_'+ sample_name + '_Cp'
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+close_vg13()
+
+
+
+
+
+
+
diff --git a/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe_all_samples.py b/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe_all_samples.py
new file mode 100644
index 0000000..72f9261
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/hyst_ID2_Fe_all_samples.py
@@ -0,0 +1,238 @@
+
+time.sleep(1)
+open_vg13()
+open_vg13()
+'''
+
+#Sample M1
+TRY.write(-1.5)
+TRZ.write(14)
+
+time.sleep(30)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.04 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.03 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.04 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.03 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+#Sample M2
+TRY.write(-0.9)
+TRZ.write(22.5)
+
+
+
+time.sleep(30)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.04 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.03 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="M2_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.04 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.03 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ #Sample M3
+TRY.write(-0.9)
+TRZ.write(30)
+
+time.sleep(30)
+
+FILENAME="M3"
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 8)
+
+for i in range(1):
+ FILENAME="M3_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="M3_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+'''
+
+ #Sample M4
+TRY.write(1.0)
+TRZ.write(18)
+
+
+
+time.sleep(30)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+
+for i in range(1):
+ FILENAME="M4_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="M4_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ #Sample M5
+TRY.write(2.0)
+TRZ.write(24.5)
+
+time.sleep(30)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+
+
+for i in range(1):
+ FILENAME="M5_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="M5_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ #Sample M6
+TRY.write(2.0)
+TRZ.write(30)
+
+time.sleep(30)
+
+caput('X11MA-KEI10:RANGE', 7)
+caput('X11MA-KEI11:RANGE', 7)
+caput('X11MA-KEI12:RANGE', 9)
+
+
+for i in range(1):
+ FILENAME="M6_Cm"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+ FILENAME="M6_Cp"
+ B1 = 2.0 # starting mag. field in Amps
+ B2 = -2.0 # final mag. field in Amps
+ BSTEP = 0.05 # step size mag. field in Amps. in Amps (1mT ~0.25A)
+ ENERGIES = (700,707.4) #list of energies in eV
+ MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2)
+ OFFSET2 = -1.2 #ID2 offset
+ FIELD_PRECISION = 0.04 #
+ ENERGY_CHANGE_SLEEP = 0.5 # put the Enerrgy settling time if needed
+ FIELD_CHANGE_SLEEP = 0.5 # put the Field settling time if needed
+ ACC_TIME = 0.1 #I think this number x 10 is in seconds
+ run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/field_sweepID2.py')
+
+close_vg13()
\ No newline at end of file
diff --git a/script/Users/TR-TEY/Cinthia/night.py b/script/Users/TR-TEY/Cinthia/night.py
new file mode 100644
index 0000000..95c7f26
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/night.py
@@ -0,0 +1,2 @@
+#run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/2021_june_Energy.py')#there was a timeout in the second script, but this one was complete, so I re start from the second one
+run('/sls/X11MA/data/X11MA/pshell/home/script/Users/Cinthia/hyst_ID2_Fe_all_samples.py')
diff --git a/script/Users/TR-TEY/Cinthia/troubleshooting.py b/script/Users/TR-TEY/Cinthia/troubleshooting.py
new file mode 100644
index 0000000..4ba4064
--- /dev/null
+++ b/script/Users/TR-TEY/Cinthia/troubleshooting.py
@@ -0,0 +1,3 @@
+#energy.write(710)
+#time.sleep (2)
+cawait('X11PHS:alldone', 0, timeout=5)
\ No newline at end of file
diff --git a/script/Users/Fechner/Temperature_sweepID2.py b/script/Users/TR-TEY/Fechner/Temperature_sweepID2.py
similarity index 100%
rename from script/Users/Fechner/Temperature_sweepID2.py
rename to script/Users/TR-TEY/Fechner/Temperature_sweepID2.py
diff --git a/script/Users/Fechner/field_sweepID2.py b/script/Users/TR-TEY/Fechner/field_sweepID2.py
similarity index 100%
rename from script/Users/Fechner/field_sweepID2.py
rename to script/Users/TR-TEY/Fechner/field_sweepID2.py
diff --git a/script/Users/Fechner/hyst_ID2.py b/script/Users/TR-TEY/Fechner/hyst_ID2.py
similarity index 100%
rename from script/Users/Fechner/hyst_ID2.py
rename to script/Users/TR-TEY/Fechner/hyst_ID2.py
diff --git a/script/Users/Fechner/xmcdID2.py b/script/Users/TR-TEY/Fechner/xmcdID2.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2.py
rename to script/Users/TR-TEY/Fechner/xmcdID2.py
diff --git a/script/Users/Fechner/xmcdID2_Al.py b/script/Users/TR-TEY/Fechner/xmcdID2_Al.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_Al.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_Al.py
diff --git a/script/Users/Fechner/xmcdID2_Fe-one-run.py b/script/Users/TR-TEY/Fechner/xmcdID2_Fe-one-run.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_Fe-one-run.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_Fe-one-run.py
diff --git a/script/Users/Fechner/xmcdID2_Fe.py b/script/Users/TR-TEY/Fechner/xmcdID2_Fe.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_Fe.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_Fe.py
diff --git a/script/Users/Fechner/xmcdID2_Mg.py b/script/Users/TR-TEY/Fechner/xmcdID2_Mg.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_Mg.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_Mg.py
diff --git a/script/Users/Fechner/xmcdID2_OCr.py b/script/Users/TR-TEY/Fechner/xmcdID2_OCr.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_OCr.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_OCr.py
diff --git a/script/Users/Fechner/xmcdID2_OCr_fix_drift.py b/script/Users/TR-TEY/Fechner/xmcdID2_OCr_fix_drift.py
similarity index 100%
rename from script/Users/Fechner/xmcdID2_OCr_fix_drift.py
rename to script/Users/TR-TEY/Fechner/xmcdID2_OCr_fix_drift.py
diff --git a/script/Users/Fechner/xmldID2_Fe.py b/script/Users/TR-TEY/Fechner/xmldID2_Fe.py
similarity index 100%
rename from script/Users/Fechner/xmldID2_Fe.py
rename to script/Users/TR-TEY/Fechner/xmldID2_Fe.py
diff --git a/script/Users/Fechner/xmldID2_Mg.py b/script/Users/TR-TEY/Fechner/xmldID2_Mg.py
similarity index 100%
rename from script/Users/Fechner/xmldID2_Mg.py
rename to script/Users/TR-TEY/Fechner/xmldID2_Mg.py
diff --git a/script/Users/Fechner/xmldID2_OCr_fix_drift.py b/script/Users/TR-TEY/Fechner/xmldID2_OCr_fix_drift.py
similarity index 100%
rename from script/Users/Fechner/xmldID2_OCr_fix_drift.py
rename to script/Users/TR-TEY/Fechner/xmldID2_OCr_fix_drift.py
diff --git a/script/Users/Juraj/B_scan.py b/script/Users/TR-TEY/Juraj/B_scan.py
similarity index 100%
rename from script/Users/Juraj/B_scan.py
rename to script/Users/TR-TEY/Juraj/B_scan.py
diff --git a/script/Users/Juraj/E_scan.py b/script/Users/TR-TEY/Juraj/E_scan.py
similarity index 100%
rename from script/Users/Juraj/E_scan.py
rename to script/Users/TR-TEY/Juraj/E_scan.py
diff --git a/script/Users/Juraj/FixedE.py b/script/Users/TR-TEY/Juraj/FixedE.py
similarity index 100%
rename from script/Users/Juraj/FixedE.py
rename to script/Users/TR-TEY/Juraj/FixedE.py
diff --git a/script/Users/Juraj/Main.py b/script/Users/TR-TEY/Juraj/Main.py
similarity index 100%
rename from script/Users/Juraj/Main.py
rename to script/Users/TR-TEY/Juraj/Main.py
diff --git a/script/Users/Mehdi/EnergyScan2.py b/script/Users/TR-TEY/Mehdi/EnergyScan2.py
similarity index 100%
rename from script/Users/Mehdi/EnergyScan2.py
rename to script/Users/TR-TEY/Mehdi/EnergyScan2.py
diff --git a/script/Users/Mehdi/Linear_XAS.py b/script/Users/TR-TEY/Mehdi/Linear_XAS.py
similarity index 100%
rename from script/Users/Mehdi/Linear_XAS.py
rename to script/Users/TR-TEY/Mehdi/Linear_XAS.py
diff --git a/script/Users/Mehdi/OTF_scan.py b/script/Users/TR-TEY/Mehdi/OTF_scan.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan.py
diff --git a/script/Users/Mehdi/OTF_scan2.py b/script/Users/TR-TEY/Mehdi/OTF_scan2.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan2.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan2.py
diff --git a/script/Users/Mehdi/OTF_scan3.py b/script/Users/TR-TEY/Mehdi/OTF_scan3.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan3.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan3.py
diff --git a/script/Users/Mehdi/OTF_scan_Mn.py b/script/Users/TR-TEY/Mehdi/OTF_scan_Mn.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_Mn.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_Mn.py
diff --git a/script/Users/Mehdi/OTF_scan_NEXAFS.py b/script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_NEXAFS.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS.py
diff --git a/script/Users/Mehdi/OTF_scan_NEXAFS_G20.py b/script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G20.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_NEXAFS_G20.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G20.py
diff --git a/script/Users/Mehdi/OTF_scan_NEXAFS_G40.py b/script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G40.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_NEXAFS_G40.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G40.py
diff --git a/script/Users/Mehdi/OTF_scan_NEXAFS_G55.py b/script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G55.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_NEXAFS_G55.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G55.py
diff --git a/script/Users/Mehdi/OTF_scan_NEXAFS_G70.py b/script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G70.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_NEXAFS_G70.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_NEXAFS_G70.py
diff --git a/script/Users/Mehdi/OTF_scan_XACCIRC.py b/script/Users/TR-TEY/Mehdi/OTF_scan_XACCIRC.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_XACCIRC.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_XACCIRC.py
diff --git a/script/Users/Mehdi/OTF_scan_XAS_XMCD.py b/script/Users/TR-TEY/Mehdi/OTF_scan_XAS_XMCD.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_XAS_XMCD.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_XAS_XMCD.py
diff --git a/script/Users/Mehdi/OTF_scan_XMCD.py b/script/Users/TR-TEY/Mehdi/OTF_scan_XMCD.py
similarity index 100%
rename from script/Users/Mehdi/OTF_scan_XMCD.py
rename to script/Users/TR-TEY/Mehdi/OTF_scan_XMCD.py
diff --git a/script/Users/TR-TEY/SaraG/Sara_script1.py b/script/Users/TR-TEY/SaraG/Sara_script1.py
new file mode 100644
index 0000000..5574e71
--- /dev/null
+++ b/script/Users/TR-TEY/SaraG/Sara_script1.py
@@ -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()
\ No newline at end of file
diff --git a/script/Users/TR-TEY/SaraG/Sara_script2.py b/script/Users/TR-TEY/SaraG/Sara_script2.py
new file mode 100644
index 0000000..c4e203e
--- /dev/null
+++ b/script/Users/TR-TEY/SaraG/Sara_script2.py
@@ -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, \
+ })
diff --git a/script/Users/Sridhar/2017/EnergyScanID1only.py b/script/Users/TR-TEY/Sridhar/2017/EnergyScanID1only.py
similarity index 100%
rename from script/Users/Sridhar/2017/EnergyScanID1only.py
rename to script/Users/TR-TEY/Sridhar/2017/EnergyScanID1only.py
diff --git a/script/Users/Sridhar/2017/EnergyScanID2only.py b/script/Users/TR-TEY/Sridhar/2017/EnergyScanID2only.py
similarity index 100%
rename from script/Users/Sridhar/2017/EnergyScanID2only.py
rename to script/Users/TR-TEY/Sridhar/2017/EnergyScanID2only.py
diff --git a/script/Users/Sridhar/2017/field_sweep.py b/script/Users/TR-TEY/Sridhar/2017/field_sweep.py
similarity index 100%
rename from script/Users/Sridhar/2017/field_sweep.py
rename to script/Users/TR-TEY/Sridhar/2017/field_sweep.py
diff --git a/script/Users/Sridhar/2017/field_sweepID1.py b/script/Users/TR-TEY/Sridhar/2017/field_sweepID1.py
similarity index 100%
rename from script/Users/Sridhar/2017/field_sweepID1.py
rename to script/Users/TR-TEY/Sridhar/2017/field_sweepID1.py
diff --git a/script/Users/Sridhar/2017/field_sweepID2.py b/script/Users/TR-TEY/Sridhar/2017/field_sweepID2.py
similarity index 100%
rename from script/Users/Sridhar/2017/field_sweepID2.py
rename to script/Users/TR-TEY/Sridhar/2017/field_sweepID2.py
diff --git a/script/Users/Sridhar/2017/field_sweep_old.py b/script/Users/TR-TEY/Sridhar/2017/field_sweep_old.py
similarity index 100%
rename from script/Users/Sridhar/2017/field_sweep_old.py
rename to script/Users/TR-TEY/Sridhar/2017/field_sweep_old.py
diff --git a/script/Users/Sridhar/2017/harmonic_ID1.xml b/script/Users/TR-TEY/Sridhar/2017/harmonic_ID1.xml
similarity index 100%
rename from script/Users/Sridhar/2017/harmonic_ID1.xml
rename to script/Users/TR-TEY/Sridhar/2017/harmonic_ID1.xml
diff --git a/script/Users/Sridhar/2017/harmonic_ID2.xml b/script/Users/TR-TEY/Sridhar/2017/harmonic_ID2.xml
similarity index 100%
rename from script/Users/Sridhar/2017/harmonic_ID2.xml
rename to script/Users/TR-TEY/Sridhar/2017/harmonic_ID2.xml
diff --git a/script/Users/Sridhar/2017/hyst_ID1.py b/script/Users/TR-TEY/Sridhar/2017/hyst_ID1.py
similarity index 100%
rename from script/Users/Sridhar/2017/hyst_ID1.py
rename to script/Users/TR-TEY/Sridhar/2017/hyst_ID1.py
diff --git a/script/Users/Sridhar/2017/hyst_ID2.py b/script/Users/TR-TEY/Sridhar/2017/hyst_ID2.py
similarity index 100%
rename from script/Users/Sridhar/2017/hyst_ID2.py
rename to script/Users/TR-TEY/Sridhar/2017/hyst_ID2.py
diff --git a/script/Users/Sridhar/2017/hyst_ID2_Co.py b/script/Users/TR-TEY/Sridhar/2017/hyst_ID2_Co.py
similarity index 100%
rename from script/Users/Sridhar/2017/hyst_ID2_Co.py
rename to script/Users/TR-TEY/Sridhar/2017/hyst_ID2_Co.py
diff --git a/script/Users/Sridhar/2017/hyst_ID2_Fe.py b/script/Users/TR-TEY/Sridhar/2017/hyst_ID2_Fe.py
similarity index 100%
rename from script/Users/Sridhar/2017/hyst_ID2_Fe.py
rename to script/Users/TR-TEY/Sridhar/2017/hyst_ID2_Fe.py
diff --git a/script/Users/Sridhar/2017/test.py b/script/Users/TR-TEY/Sridhar/2017/test.py
similarity index 100%
rename from script/Users/Sridhar/2017/test.py
rename to script/Users/TR-TEY/Sridhar/2017/test.py
diff --git a/script/Users/Sridhar/2017/test_field.py b/script/Users/TR-TEY/Sridhar/2017/test_field.py
similarity index 100%
rename from script/Users/Sridhar/2017/test_field.py
rename to script/Users/TR-TEY/Sridhar/2017/test_field.py
diff --git a/script/Users/Sridhar/2017/test_fieldID1.py b/script/Users/TR-TEY/Sridhar/2017/test_fieldID1.py
similarity index 100%
rename from script/Users/Sridhar/2017/test_fieldID1.py
rename to script/Users/TR-TEY/Sridhar/2017/test_fieldID1.py
diff --git a/script/Users/Sridhar/2017/test_fieldID2.py b/script/Users/TR-TEY/Sridhar/2017/test_fieldID2.py
similarity index 100%
rename from script/Users/Sridhar/2017/test_fieldID2.py
rename to script/Users/TR-TEY/Sridhar/2017/test_fieldID2.py
diff --git a/script/Users/Sridhar/2017/xmcdID1&ID2.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID1&ID2.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID1&ID2.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID1&ID2.py
diff --git a/script/Users/Sridhar/2017/xmcdID1.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID1.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID1.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID1.py
diff --git a/script/Users/Sridhar/2017/xmcdID2.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID2.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID2.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID2.py
diff --git a/script/Users/Sridhar/2017/xmcdID2_Co.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID2_Co.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID2_Co.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID2_Co.py
diff --git a/script/Users/Sridhar/2017/xmcdID2_Fe.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID2_Fe.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID2_Fe.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID2_Fe.py
diff --git a/script/Users/Sridhar/2017/xmcdID2_Ru.py b/script/Users/TR-TEY/Sridhar/2017/xmcdID2_Ru.py
similarity index 100%
rename from script/Users/Sridhar/2017/xmcdID2_Ru.py
rename to script/Users/TR-TEY/Sridhar/2017/xmcdID2_Ru.py
diff --git a/script/Users/Sridhar/Test.py b/script/Users/TR-TEY/Sridhar/Test.py
similarity index 100%
rename from script/Users/Sridhar/Test.py
rename to script/Users/TR-TEY/Sridhar/Test.py
diff --git a/script/Users/ales/Holder1.py b/script/Users/TR-TEY/ales/Holder1.py
similarity index 100%
rename from script/Users/ales/Holder1.py
rename to script/Users/TR-TEY/ales/Holder1.py
diff --git a/script/Users/ales/Holder2.py b/script/Users/TR-TEY/ales/Holder2.py
similarity index 100%
rename from script/Users/ales/Holder2.py
rename to script/Users/TR-TEY/ales/Holder2.py
diff --git a/script/Users/ales/Holder3.py b/script/Users/TR-TEY/ales/Holder3.py
similarity index 100%
rename from script/Users/ales/Holder3.py
rename to script/Users/TR-TEY/ales/Holder3.py
diff --git a/script/Users/ales/Holder4.py b/script/Users/TR-TEY/ales/Holder4.py
similarity index 100%
rename from script/Users/ales/Holder4.py
rename to script/Users/TR-TEY/ales/Holder4.py
diff --git a/script/Users/ales/Holder5.py b/script/Users/TR-TEY/ales/Holder5.py
similarity index 100%
rename from script/Users/ales/Holder5.py
rename to script/Users/TR-TEY/ales/Holder5.py
diff --git a/script/Users/ales/Holder6.py b/script/Users/TR-TEY/ales/Holder6.py
similarity index 100%
rename from script/Users/ales/Holder6.py
rename to script/Users/TR-TEY/ales/Holder6.py
diff --git a/script/Users/ales/Holder7.py b/script/Users/TR-TEY/ales/Holder7.py
similarity index 100%
rename from script/Users/ales/Holder7.py
rename to script/Users/TR-TEY/ales/Holder7.py
diff --git a/script/Users/carlos/Bor_test.py b/script/Users/TR-TEY/carlos/Bor_test.py
similarity index 100%
rename from script/Users/carlos/Bor_test.py
rename to script/Users/TR-TEY/carlos/Bor_test.py
diff --git a/script/Users/carlos/Boron.py b/script/Users/TR-TEY/carlos/Boron.py
similarity index 100%
rename from script/Users/carlos/Boron.py
rename to script/Users/TR-TEY/carlos/Boron.py
diff --git a/script/Users/carlos/Boron2.py b/script/Users/TR-TEY/carlos/Boron2.py
similarity index 100%
rename from script/Users/carlos/Boron2.py
rename to script/Users/TR-TEY/carlos/Boron2.py
diff --git a/script/Users/carlos/Boron3.py b/script/Users/TR-TEY/carlos/Boron3.py
similarity index 100%
rename from script/Users/carlos/Boron3.py
rename to script/Users/TR-TEY/carlos/Boron3.py
diff --git a/script/Users/carlos/Boron4.py b/script/Users/TR-TEY/carlos/Boron4.py
similarity index 100%
rename from script/Users/carlos/Boron4.py
rename to script/Users/TR-TEY/carlos/Boron4.py
diff --git a/script/Users/carlos/goetite.py b/script/Users/TR-TEY/carlos/goetite.py
similarity index 100%
rename from script/Users/carlos/goetite.py
rename to script/Users/TR-TEY/carlos/goetite.py
diff --git a/script/Users/carlos/pa2.py b/script/Users/TR-TEY/carlos/pa2.py
similarity index 100%
rename from script/Users/carlos/pa2.py
rename to script/Users/TR-TEY/carlos/pa2.py
diff --git a/script/Users/carlos/test.py b/script/Users/TR-TEY/carlos/test.py
similarity index 100%
rename from script/Users/carlos/test.py
rename to script/Users/TR-TEY/carlos/test.py
diff --git a/script/Users/federico/2021_may_beamtime.py b/script/Users/TR-TEY/federico/2021_may_beamtime.py
similarity index 100%
rename from script/Users/federico/2021_may_beamtime.py
rename to script/Users/TR-TEY/federico/2021_may_beamtime.py
diff --git a/script/Users/federico/test.py b/script/Users/TR-TEY/federico/test.py
similarity index 100%
rename from script/Users/federico/test.py
rename to script/Users/TR-TEY/federico/test.py
diff --git a/script/Users/TR-TEY/federico/test_Dy.py b/script/Users/TR-TEY/federico/test_Dy.py
new file mode 100644
index 0000000..53ab36f
--- /dev/null
+++ b/script/Users/TR-TEY/federico/test_Dy.py
@@ -0,0 +1,10 @@
+#otf2(start=1270, end=1340, time=2, delay=10, mode='CIRC +', alpha = 0.0, offset=-9.0, name='Dy_test')
+#otf2(start=1550, end=1660, time=3, delay=5, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Lu_test')
+#TRY.write(0.5)
+
+#otf2(start=510, end=580, time=3, delay=20, mode='LINEAR', alpha = 0.0, offset=-1.2, name='OK_test')
+#otf2(start=690, end=750, time=3, delay=20, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Fe_test')
+#caput('X11MA-ID2:HARMONIC', 3)
+#caput('X11PHS-E:GO.A', 1270)
+
+otf2(start=1270, end=1360, time=5, delay=20, mode='LINEAR', alpha = 0.0, offset=-1.2, name='Dy_test')
\ No newline at end of file
diff --git a/script/Users/gesara/17apr2020_Circscan.py b/script/Users/TR-TEY/gesara/17apr2020_Circscan.py
similarity index 100%
rename from script/Users/gesara/17apr2020_Circscan.py
rename to script/Users/TR-TEY/gesara/17apr2020_Circscan.py
diff --git a/script/Users/gesara/19okt2020_Circscan.py b/script/Users/TR-TEY/gesara/19okt2020_Circscan.py
similarity index 100%
rename from script/Users/gesara/19okt2020_Circscan.py
rename to script/Users/TR-TEY/gesara/19okt2020_Circscan.py
diff --git a/script/Users/gesara/20feb2020.py b/script/Users/TR-TEY/gesara/20feb2020.py
similarity index 100%
rename from script/Users/gesara/20feb2020.py
rename to script/Users/TR-TEY/gesara/20feb2020.py
diff --git a/script/Users/gesara/20feb2020_Linearscan1.py b/script/Users/TR-TEY/gesara/20feb2020_Linearscan1.py
similarity index 100%
rename from script/Users/gesara/20feb2020_Linearscan1.py
rename to script/Users/TR-TEY/gesara/20feb2020_Linearscan1.py
diff --git a/script/Users/gesara/20okt2020_Circscan_TF.py b/script/Users/TR-TEY/gesara/20okt2020_Circscan_TF.py
similarity index 100%
rename from script/Users/gesara/20okt2020_Circscan_TF.py
rename to script/Users/TR-TEY/gesara/20okt2020_Circscan_TF.py
diff --git a/script/Users/gesara/20okt2020_Powders.py b/script/Users/TR-TEY/gesara/20okt2020_Powders.py
similarity index 100%
rename from script/Users/gesara/20okt2020_Powders.py
rename to script/Users/TR-TEY/gesara/20okt2020_Powders.py
diff --git a/script/Users/gesara/21feb2020_Circscan1.py b/script/Users/TR-TEY/gesara/21feb2020_Circscan1.py
similarity index 100%
rename from script/Users/gesara/21feb2020_Circscan1.py
rename to script/Users/TR-TEY/gesara/21feb2020_Circscan1.py
diff --git a/script/Users/gesara/Circscan.py b/script/Users/TR-TEY/gesara/Circscan.py
similarity index 100%
rename from script/Users/gesara/Circscan.py
rename to script/Users/TR-TEY/gesara/Circscan.py
diff --git a/script/Users/gesara/Dy_circscan.py b/script/Users/TR-TEY/gesara/Dy_circscan.py
similarity index 100%
rename from script/Users/gesara/Dy_circscan.py
rename to script/Users/TR-TEY/gesara/Dy_circscan.py
diff --git a/script/Users/gesara/FeSTO_circscan.py b/script/Users/TR-TEY/gesara/FeSTO_circscan.py
similarity index 100%
rename from script/Users/gesara/FeSTO_circscan.py
rename to script/Users/TR-TEY/gesara/FeSTO_circscan.py
diff --git a/script/Users/gesara/FeSTO_linearscan.py b/script/Users/TR-TEY/gesara/FeSTO_linearscan.py
similarity index 100%
rename from script/Users/gesara/FeSTO_linearscan.py
rename to script/Users/TR-TEY/gesara/FeSTO_linearscan.py
diff --git a/script/Users/gesara/Fe_O_circscan.py b/script/Users/TR-TEY/gesara/Fe_O_circscan.py
similarity index 100%
rename from script/Users/gesara/Fe_O_circscan.py
rename to script/Users/TR-TEY/gesara/Fe_O_circscan.py
diff --git a/script/Users/steven/16july2020_Linearscan.py b/script/Users/TR-TEY/steven/16july2020_Linearscan.py
similarity index 100%
rename from script/Users/steven/16july2020_Linearscan.py
rename to script/Users/TR-TEY/steven/16july2020_Linearscan.py
diff --git a/script/Users/steven/HOLDER1_V2.py b/script/Users/TR-TEY/steven/HOLDER1_V2.py
similarity index 100%
rename from script/Users/steven/HOLDER1_V2.py
rename to script/Users/TR-TEY/steven/HOLDER1_V2.py
diff --git a/script/Users/steven/HOLDER2.py b/script/Users/TR-TEY/steven/HOLDER2.py
similarity index 100%
rename from script/Users/steven/HOLDER2.py
rename to script/Users/TR-TEY/steven/HOLDER2.py
diff --git a/script/Users/steven/HOLDER2_v2.py b/script/Users/TR-TEY/steven/HOLDER2_v2.py
similarity index 100%
rename from script/Users/steven/HOLDER2_v2.py
rename to script/Users/TR-TEY/steven/HOLDER2_v2.py
diff --git a/script/Users/steven/HOLDER3.py b/script/Users/TR-TEY/steven/HOLDER3.py
similarity index 100%
rename from script/Users/steven/HOLDER3.py
rename to script/Users/TR-TEY/steven/HOLDER3.py
diff --git a/script/Users/steven/HOLDER4.py b/script/Users/TR-TEY/steven/HOLDER4.py
similarity index 100%
rename from script/Users/steven/HOLDER4.py
rename to script/Users/TR-TEY/steven/HOLDER4.py
diff --git a/script/Users/steven/HOLDER5.py b/script/Users/TR-TEY/steven/HOLDER5.py
similarity index 100%
rename from script/Users/steven/HOLDER5.py
rename to script/Users/TR-TEY/steven/HOLDER5.py
diff --git a/script/Users/steven/March2021_Holder1-FINAL.py b/script/Users/TR-TEY/steven/March2021_Holder1-FINAL.py
similarity index 100%
rename from script/Users/steven/March2021_Holder1-FINAL.py
rename to script/Users/TR-TEY/steven/March2021_Holder1-FINAL.py
diff --git a/script/Users/steven/March2021_Holder1.py b/script/Users/TR-TEY/steven/March2021_Holder1.py
similarity index 100%
rename from script/Users/steven/March2021_Holder1.py
rename to script/Users/TR-TEY/steven/March2021_Holder1.py
diff --git a/script/Users/steven/March2021_Holder2.py b/script/Users/TR-TEY/steven/March2021_Holder2.py
similarity index 100%
rename from script/Users/steven/March2021_Holder2.py
rename to script/Users/TR-TEY/steven/March2021_Holder2.py
diff --git a/script/Users/steven/March2021_Holder3.py b/script/Users/TR-TEY/steven/March2021_Holder3.py
similarity index 100%
rename from script/Users/steven/March2021_Holder3.py
rename to script/Users/TR-TEY/steven/March2021_Holder3.py
diff --git a/script/Users/steven/March2021_Holder4.py b/script/Users/TR-TEY/steven/March2021_Holder4.py
similarity index 100%
rename from script/Users/steven/March2021_Holder4.py
rename to script/Users/TR-TEY/steven/March2021_Holder4.py
diff --git a/script/Users/steven/March2021_Holder5.py b/script/Users/TR-TEY/steven/March2021_Holder5.py
similarity index 100%
rename from script/Users/steven/March2021_Holder5.py
rename to script/Users/TR-TEY/steven/March2021_Holder5.py
diff --git a/script/Users/steven/March2021_Holder6.py b/script/Users/TR-TEY/steven/March2021_Holder6.py
similarity index 100%
rename from script/Users/steven/March2021_Holder6.py
rename to script/Users/TR-TEY/steven/March2021_Holder6.py
diff --git a/script/Users/steven/March2021_Holder7.py b/script/Users/TR-TEY/steven/March2021_Holder7.py
similarity index 100%
rename from script/Users/steven/March2021_Holder7.py
rename to script/Users/TR-TEY/steven/March2021_Holder7.py
diff --git a/script/Users/steven/March2021_Holder8.py b/script/Users/TR-TEY/steven/March2021_Holder8.py
similarity index 100%
rename from script/Users/steven/March2021_Holder8.py
rename to script/Users/TR-TEY/steven/March2021_Holder8.py
diff --git a/script/Users/steven/SL6-F.py b/script/Users/TR-TEY/steven/SL6-F.py
similarity index 100%
rename from script/Users/steven/SL6-F.py
rename to script/Users/TR-TEY/steven/SL6-F.py
diff --git a/script/Users/steven/September2021_Holder1.py b/script/Users/TR-TEY/steven/September2021_Holder1.py
similarity index 100%
rename from script/Users/steven/September2021_Holder1.py
rename to script/Users/TR-TEY/steven/September2021_Holder1.py
diff --git a/script/Users/steven/test.py b/script/Users/TR-TEY/steven/test.py
similarity index 100%
rename from script/Users/steven/test.py
rename to script/Users/TR-TEY/steven/test.py
diff --git a/script/beamline_init/ESlitCalib.py b/script/beamline_init/ESlitCalib.py
deleted file mode 100644
index 182d800..0000000
--- a/script/beamline_init/ESlitCalib.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#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)
\ No newline at end of file
diff --git a/script/beamline_init/FESlitCalib.py b/script/beamline_init/FESlitCalib.py
deleted file mode 100644
index 4b562f0..0000000
--- a/script/beamline_init/FESlitCalib.py
+++ /dev/null
@@ -1,14 +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
-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
\ No newline at end of file
diff --git a/script/beamline_init/InitCMU.py b/script/beamline_init/init/InitCMU.py
similarity index 100%
rename from script/beamline_init/InitCMU.py
rename to script/beamline_init/init/InitCMU.py
diff --git a/script/beamline_init/InitFE.py b/script/beamline_init/init/InitFE.py
similarity index 100%
rename from script/beamline_init/InitFE.py
rename to script/beamline_init/init/InitFE.py
diff --git a/script/beamline_init/with_x-rays/01_FE_offsets.py b/script/beamline_init/with_x-rays/01_FE_offsets.py
new file mode 100644
index 0000000..6514430
--- /dev/null
+++ b/script/beamline_init/with_x-rays/01_FE_offsets.py
@@ -0,0 +1,27 @@
+import sys
+
+#seting parameters
+sensor = KEI11
+if sensor == KEI10:
+ detector= keithley_1a
+ detector_range='X11MA-KEI10:RANGE'
+elif sensor == KEI11:
+ detector= keithley_2a
+ detector_range='X11MA-KEI11:RANGE'
+else:
+ print "Select a proper detector: KEI10 or KEI11."
+ sys.exit()
+
+caput(detector_range, 6) # 6 --> 200 nA
+fe_slit_H_size.move(1.0)
+fe_slit_V_size.move(1.0)
+
+#scan SizeH
+run('beamline_init/with_x-rays/functions/SlitCalib.py',{"Slit":fe_slit_H_size, "Slit_offset":fe_slit_H_size_offs, "detector":detector, "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(detector_range, 0) # 0--> AUTO
\ No newline at end of file
diff --git a/script/beamline_init/with_x-rays/02_Eslit_offset.py b/script/beamline_init/with_x-rays/02_Eslit_offset.py
new file mode 100644
index 0000000..7ab92d6
--- /dev/null
+++ b/script/beamline_init/with_x-rays/02_Eslit_offset.py
@@ -0,0 +1,27 @@
+import sys
+
+#seting parameters
+sensor = KEI11
+if sensor == KEI10:
+ detector= keithley_1a
+ detector_range='X11MA-KEI10:RANGE'
+elif sensor == KEI11:
+ detector= keithley_2a
+ detector_range='X11MA-KEI11:RANGE'
+else:
+ print "Select a proper detector: KEI10 or KEI11."
+ sys.exit()
+
+caput(detector_range, 5) # 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/with_x-rays/functions/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":detector, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0})
+time.sleep(1)
+
+#resetting parameters
+caput(detector_range, 0) # 0--> AUTO
+exit_slit.setSpeed(speed)
\ No newline at end of file
diff --git a/script/beamline_init/FE_Slit2DScan.py b/script/beamline_init/with_x-rays/04_2D_FE_ID2_scan.py
similarity index 61%
rename from script/beamline_init/FE_Slit2DScan.py
rename to script/beamline_init/with_x-rays/04_2D_FE_ID2_scan.py
index c229fb1..e30635f 100644
--- a/script/beamline_init/FE_Slit2DScan.py
+++ b/script/beamline_init/with_x-rays/04_2D_FE_ID2_scan.py
@@ -1,15 +1,17 @@
+START = -0.5
+END =1.0
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)
+ r1 = cscan(fe_slit_V_ctr, (Keithley_1_raw), START, END , 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)
+ return ArrayCalibration((end-start)/STEPS,-0.5)
line=Line()
set_device_alias(line, "FE scan")
diff --git a/script/beamline_init/FE_ctrSlitCalib.py b/script/beamline_init/with_x-rays/04a_2D_FE_ID2_fast.py
similarity index 51%
rename from script/beamline_init/FE_ctrSlitCalib.py
rename to script/beamline_init/with_x-rays/04a_2D_FE_ID2_fast.py
index 9df1f54..b525826 100644
--- a/script/beamline_init/FE_ctrSlitCalib.py
+++ b/script/beamline_init/with_x-rays/04a_2D_FE_ID2_fast.py
@@ -1,7 +1,19 @@
+import sys
+
+#seting parameters
+sensor = KEI11
+if sensor == KEI10:
+ detector= Keithley_1_raw
+elif sensor == KEI11:
+ detector= Keithley_2_raw
+else:
+ print "Select a proper detector: KEI10 or KEI11."
+ sys.exit()
+
#Hill Climbing Search
-fe_slit_V_ctr.move(0.0);
-fe_slit_H_ctr.move(0.0);
-r = hsearch([fe_slit_V_ctr, fe_slit_H_ctr], Keithley_1_raw,[-0.5,-0.5], [1.0,1.0], [0.1, 0.1], [0.02, 0.02], 1, relative = False, maximum=True, latency = 1.0, title = "Hill Climbing")
+fe_slit_V_ctr.move(0.13);
+fe_slit_H_ctr.move(1.48);
+r = hsearch([fe_slit_V_ctr, fe_slit_H_ctr], detector,[-0.5,-0.5], [1.0,2.0], [0.1, 0.1], [0.02, 0.02], 1, relative = False, maximum=True, latency = 1.0, title = "Hill Climbing")
print "--------------- Hill Climbing Search -----------------"
print r
print r.print()
diff --git a/script/beamline_init/SlitCalib.py b/script/beamline_init/with_x-rays/functions/SlitCalib.py
similarity index 98%
rename from script/beamline_init/SlitCalib.py
rename to script/beamline_init/with_x-rays/functions/SlitCalib.py
index f1e8d72..3d5950f 100644
--- a/script/beamline_init/SlitCalib.py
+++ b/script/beamline_init/with_x-rays/functions/SlitCalib.py
@@ -60,7 +60,7 @@ print k
#change the offset
offset=Slit_offset.read()
-#Slit_offset.write(offset+k)
+Slit_offset.write(offset+k)
Slit.write(final_pos)
diff --git a/script/devices/LEEM2000.py b/script/devices/LEEM2000.py
index 2327d3a..aa9ed8d 100644
--- a/script/devices/LEEM2000.py
+++ b/script/devices/LEEM2000.py
@@ -11,7 +11,8 @@ class LEEM2000(TcpDevice):
self.debug = False
self.retries = 1
self.timeout = 1000
- self.move_timeout = 30000
+ self.move_timeout = 30000 #30s
+ self.homing_timeout = 300000 #5min
def doInitialize(self):
super(LEEM2000, self).doInitialize()
@@ -153,6 +154,15 @@ class LEEM2000(TcpDevice):
if ret != '0':
raise Exception("Error moving tilt %s to %s: %s" % (str(cmd), dist_us, ret))
+ #Direction H or V
+ def home_tilt(self, direction, timeout = None, retries = None):
+ if timeout is None:
+ timeout = self.homing_timeout
+ cmd = "tlt " + str(direction)
+ ret = self.send_receive(cmd, timeout, retries)
+ if ret != '0':
+ raise Exception("Error homing tilt %s: %s" % (str(cmd), ret))
+
#motor_id = 11 (X) or 10(Y)
def move_motor_rel_async(self, motor_id, dist_us, timeout = None, retries = None):
cmd = "mmd " + str(motor_id) + " " + str(dist_us)
@@ -258,6 +268,7 @@ add_device (microscope.get_tilt('D','U', "tilt_v"), 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)
+add_device (microscope.get_child("MDRIVE","azimuth_rot"), True)
microscope.setPolling(5000)
@@ -280,14 +291,29 @@ class TiltMotor(RegisterBase):
self.tilt_motor.write(offset)
self.position = pos
+class Fov(ReadonlyRegisterBase):
+ def __init__(self, name, mic):
+ ReadonlyRegisterBase.__init__(self, name)
+ self.mic=mic
+
+ def doInitialize(self):
+ self.position = 0
+
+ def doRead(self):
+ return self.mic.get_preset_label()
+
+
+
def init_tilt():
tilt_vertical.initialize()
tilt_horizontal.initialize()
add_device(TiltMotor("tilt_vertical", tilt_v), True)
add_device(TiltMotor("tilt_horizontal", tilt_h), True)
+add_device(Fov("fov", microscope), True)
tilt_vertical.polling=500
tilt_horizontal.polling=500
+fov.polling=5000
diff --git a/script/devices/eiger.py b/script/devices/eiger.py
index 85aa9b2..a9d3d61 100644
--- a/script/devices/eiger.py
+++ b/script/devices/eiger.py
@@ -198,7 +198,7 @@ def _save_as_tiff(data, filename, check=False, show = False, metadata={}):
data = get_ip_array(ip)
import java.util.Arrays as Arrays
ip=open_image(filename)
- read = get_ip_array(ip)
+ read = get_ip_array(ip)
#print (" ------> Error reading array: " + str(filename))
#TODO: Original checkcode was deleted!
@@ -393,8 +393,6 @@ def get_outliers_mask(data_type='f'):
pass
return _outliers_mask
-eiger.setDataType(DataType.Float32)
-eiger.getDataArray().monitored=True
class ProcImage(Filter):
def __init__(self):
@@ -427,7 +425,10 @@ raw.addListener(proc_image)
add_device(proc_image, True)
-image.refresh()
+image.refresh()
+
+eiger.setDataType(DataType.Float32)
+eiger.getDataArray().monitored=True
if False:
integrate_roi(image, 10, 5, 20, 10)
diff --git a/script/imaging/FOV_table.py b/script/imaging/FOV_table.py
new file mode 100644
index 0000000..6fc283b
--- /dev/null
+++ b/script/imaging/FOV_table.py
@@ -0,0 +1,17 @@
+FOV_ARROWS = { \
+ "120um[0.0]": [84.0], \
+ "100um[0.0]": [82.0], \
+ "75um[0.0]": [77.0], \
+ "50um[0.0]": [72.0], \
+ "40um[0.0]": [66.0], \
+ "30um[0.0]": [61.0], \
+ "25um[0.0]": [50.0], \
+ "20um[0.0]": [45.0], \
+ "15um[0.0]": [32.0], \
+ "10um[0.0]": [5.0], \
+ "7.5um[0.0]": [15.0], \
+ "5m[0.0]": [10.0], \
+ "2.5m[0.0]": [5.0], \
+ "1.25m[0.0]": [0.0], \
+ "new_entry": [0.0] \
+}
diff --git a/script/imaging/fov_arrows.py b/script/imaging/fov_arrows.py
new file mode 100644
index 0000000..4860cd6
--- /dev/null
+++ b/script/imaging/fov_arrows.py
@@ -0,0 +1,103 @@
+arrows_renderer = arrow_x = arrow_y = arrow_a = label_x = label_y = arrow_y =None
+"""
+FOV_ARROWS = { \
+ "100um[0.0]": [10.0], \
+ "50um[0.0]": [20.0], \
+ "new_entry": [0.0]
+}
+"""
+run("imaging/FOV_table")
+
+FOV_ARROWS_SIZE=80
+FOV_LABEL_POS=FOV_ARROWS_SIZE+15
+#FOV_ARROWS_ORIGIN=Point(image.getData().width/4, image.getData().height*3/4)
+#FOV_ARROWS_ORIGIN=Point(image.getData().width*3/4, image.getData().height/4)
+FOV_ARROWS_ORIGIN=Point(image.getData().width-(FOV_LABEL_POS+5), FOV_LABEL_POS+5)
+FOV_FUTURE=None
+FOV_FUTURE=None
+FOV_LABEL_FONT=java.awt.Font("Verdana", java.awt.Font.PLAIN, 12)
+FOV_OFFSET=0.0
+FOV_COLOR_X = Color.GREEN
+FOV_COLOR_Y = Color(173,216,230) # Light Blue
+FOV_COLOR_A = Color.YELLOW
+
+
+AZIMUTH_ROT=0.0
+def get_azimuth():
+ return AZIMUTH_ROT
+
+def set_fov_offset(value):
+ global FOV_OFFSET
+ FOV_OFFSET = value
+ update_arrows()
+
+def update_arrows():
+ global arrows_renderer, arrow_x, arrow_y, arrow_a, label_x, label_y
+ if arrows_renderer is not None:
+ args = FOV_ARROWS.get(fov.take(), None)
+ if args is not None:
+ azimuth=get_azimuth()
+ angle=args[0] + FOV_OFFSET
+ angle=angle+180
+ x,y = FOV_ARROWS_ORIGIN.x, FOV_ARROWS_ORIGIN.y
+ a=math.radians(angle)
+ xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a))
+ arrow_a.update(FOV_ARROWS_ORIGIN, Point(xa,ya))
+ angle=angle+azimuth
+ a=math.radians(angle)
+ xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a))
+ arrow_x.update(FOV_ARROWS_ORIGIN, Point(xa,ya))
+ xa,ya=int(x+FOV_LABEL_POS*math.cos(a)), int(y-FOV_LABEL_POS*math.sin(a))
+ label_x.update(Point(xa,ya))
+ angle=angle-90
+ a=math.radians(angle)
+ xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a))
+ arrow_y.update(FOV_ARROWS_ORIGIN, Point(xa,ya))
+ xa,ya=int(x+FOV_LABEL_POS*math.cos(a)), int(y-FOV_LABEL_POS*math.sin(a))
+ label_y.update(Point(xa,ya))
+ else:
+ log("Cannot draw reference arrows - Invalid microscope preset label: " + fov, False)
+ arrow_x.update(FOV_ARROWS_ORIGIN, FOV_ARROWS_ORIGIN)
+ arrow_y.update(FOV_ARROWS_ORIGIN, FOV_ARROWS_ORIGIN)
+ arrow_a.update(FOV_ARROWS_ORIGIN, FOV_ARROWS_ORIGIN)
+ label_x.update(label_x.UNDEFINED_POINT)
+ label_y.update(label_y.UNDEFINED_POINT)
+
+def task_update_arrows():
+ global arrows_renderer
+ while arrows_renderer is not None:
+ try:
+ if arrows_renderer.isShowing():
+ update_arrows()
+ time.sleep(5.0)
+ time.sleep(1.0)
+ except:
+ pass
+
+
+def start_arrows(renderer=None):
+ global arrows_renderer, arrow_x, arrow_y, arrow_a, label_x, label_y, FOV_FUTURE
+ if arrows_renderer is None:
+ arrows_renderer = renderer if renderer else show_panel(image)
+ arrow_x = Overlays.Arrow(Pen(FOV_COLOR_X))
+ arrow_y = Overlays.Arrow(Pen(FOV_COLOR_Y))
+ arrow_a = Overlays.Arrow(Pen(FOV_COLOR_A))
+ label_x = Overlays.Text(arrow_x.pen, "X",FOV_LABEL_FONT)
+ label_y = Overlays.Text(arrow_y.pen, "Y",FOV_LABEL_FONT)
+ arrows_renderer.addOverlays([arrow_a, arrow_x,arrow_y,label_x, label_y])
+ #update_arrows()
+ FOV_FUTURE = fork(task_update_arrows,)[0]
+
+
+def stop_arrows(renderer=None):
+ global arrows_renderer, arrow_x, arrow_y, label_x, label_y, FOV_FUTURE
+ if arrows_renderer is not None:
+ arrows_renderer.removeOverlays([arrow_a, arrow_x,arrow_y, label_x, label_y])
+ arrows_renderer=None
+ if FOV_FUTURE is not None:
+ FOV_FUTURE.cancel(True)
+ try:
+ join(FOV_FUTURE)
+ except:
+ pass
+
diff --git a/script/local.py b/script/local.py
index 3ea4e03..d7dbe82 100644
--- a/script/local.py
+++ b/script/local.py
@@ -1,17 +1,17 @@
###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
-import ntpath
-import traceback
-from rsync import *
-from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian
-from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks
-from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator
-from collections import OrderedDict
-run ("imaging/shifts")
-
-ProviderCSV.setDefaultItemSeparator(", ")
-get_context().dataManager.createLogs=False
+import ntpath
+import traceback
+from rsync import *
+from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian
+from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks
+from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator
+from collections import OrderedDict
+run ("imaging/shifts")
+
+ProviderCSV.setDefaultItemSeparator(", ")
+get_context().dataManager.createLogs=False
"""
OTF_START = "X11MA-OTF:GO"
OTF_E1 = "X11MA-OTF:E1"
@@ -23,844 +23,899 @@ OTF_FILE = "X11MA-OTF:FNAME"
ID1_MODE = "X11MA-ID1:MODE"
ID2_MODE = "X11MA-ID2:MODE"
ID1_ALPHA = "X11MA-ID1:ALPHA"
-ID2_ALPHA = "X11MA-ID2:ALPHA"
-ID1_OFF = "X11MA-ID1:ENERGY-OFFS"
-ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
-ENERGY_SP = "X11MA-PHS:E_SP"f
+ID2_ALPHA = "X11MA-ID2:ALPHA"
+ID1_OFF = "X11MA-ID1:ENERGY-OFFS"
+ID2_OFF = "X11MA-ID2:ENERGY-OFFS"
+ENERGY_SP = "X11MA-PHS:E_SP"f
"""
-ALL_DONE = "X11PHS:alldone"
+ALL_DONE = "X11PHS:alldone"
VG10_SET = "X11MA-EPS-VG10:SET"
-VG10_GET = "X11MA-OP-VG10:OPEN"
-VG11_SET = "X11MA-EPS-VG11:SET"
-VG11_GET = "X11MA-OP-VG11:OPEN"
-VG12_SET = "X11MA-EPS-VG12:SET"
-VG12_GET = "X11MA-OP-VG12:OPEN"
-VG13_SET = "X11MA-EPS-VG13:SET"
-VG13_GET = "X11MA-OP-VG13:OPEN"
-
-"""
-
-LPP_DELAY = "X11MA-ES2-4CHT:SET2-DELAY"
-LPP_FINE_DELAY = "X11MA-ES2-4CHT:SET2-FINE"
-TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
-TIME_DELAY_VAL = "X11MA-ES2:Theta-Cur.VAL"
-TIME_DELAY_START = "X11MA-ES2:SCAN-START"
-TIME_DELAY_COMPLETE = "X11MA-ES2-scan1.SMSG"
-TBT_MAG = "X11MA-LSCI632:MFIELD"
-"
-"""
-
-
-#Device initialization
-keithley_1a.setForcedRead(False)
-keithley_2a.setForcedRead(False)
-keithley_3a.setForcedRead(False)
-
-
-def get_next_fid(folder, prefix):
- try:
- import glob
- files = glob.glob(folder + prefix + '*_*.dat')
- last = max(files)
- index = int (last[last.rfind('_')+1 : last.rfind('.')]) + 1
- return index
- except:
- return 0
-
-def wait_channel(name, value, timeout =None, type='s'):
- print "Waiting " + str(name) + " = " + str(value)
- cawait(name, value, timeout = timeout, type=type)
- print "Done"
-
-def wait_device(dev, value, timeout=-1):
- timeout = int(timeout *1000) if timeout>0 else timeout
- dev.waitValue(value,timeout)
-
-def open_vg10():
- if caget (VG10_GET,'i') != 1:
- caput(VG10_SET, 0)
- time.sleep(0.1)
- caput(VG10_SET, 1)
-
-def close_vg10():
- if caget (VG10_GET,'i') == 1:
- caput(VG10_SET, 0)
- time.sleep(0.1)
- caput(VG10_SET, 1)
-
-def open_vg11():
- if caget (VG11_GET,'i') != 1:
- caput(VG11_SET, 0)
- time.sleep(0.1)
- caput(VG11_SET, 1)
-
-def close_vg11():
- if caget (VG11_GET,'i') == 1:
- caput(VG11_SET, 0)
- time.sleep(0.1)
- caput(VG11_SET, 1)
-
-def open_vg12():
- if caget (VG12_GET,'i') != 1:
- caput(VG12_SET, 0)
- time.sleep(0.1)
- caput(VG12_SET, 1)
-
-def close_vg12():
- if caget (VG12_GET,'i') == 1:
- caput(VG12_SET, 0)
- time.sleep(0.1)
- caput(VG12_SET, 1)
-
-def open_vg13():
- if caget (VG13_GET,'i') != 1:
- caput(VG13_SET, 0)
- time.sleep(0.1)
- caput(VG13_SET, 1)
-
-def close_vg13():
- if caget (VG13_GET,'i') == 1:
- caput(VG13_SET, 0)
- time.sleep(0.1)
- caput(VG13_SET, 1)
-
-def plot_file(file_name, ctxt = None):
- """
- """
- sep = "\t"
- with open(file_name) as f:
- header = f.readline()[1:].split(sep)
- table = Table.loadRaw(file_name, sep, '#',header)
- plots = plot(table, title = ctxt)
-
-def has_beam():
- """
- """
- return beam_status.readback.read() == "Light Available"
-
-def is_id_error():
- return (id_error.read()==0)
-
-def check_id_error():
- if is_id_error():
- raise Exception ("ID error: check ID status")
-
-###################################################################################################
-#Default scan callbacks
-###################################################################################################
-
-def before_sample():
- pass
-
-def after_sample():
- check_id_error()
-
-##################### Convert_File function #############################
-"""
-def convert_file(input_file_name, output_file_name):
- sep = "\t"
- line_sep = "\r\n"
- field = caget('X11MA-XMCD:Ireadout')
- with open(input_file_name) as inp:
- lines = inp.readlines()
- with open(output_file_name, "wb") as out:
- out.write("Energy" + sep + "Io" + sep + "CADC2" + sep + "CADC3" + sep + "Mag" + line_sep)
- s = sep + " " #File format has a space before numeric values
- for line in lines[1:]:
- line = line.strip()
- if line=="": break
- try:
- (Ecrbk,CADC1, CADC2, NORM, CADC3, CADC4, MCurr, cffrbk, ID1Erbk, ID2Erbk, vTime) = line.split(" ")
- out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + str(field) +line_sep)
- except:
- traceback.print_exc()
-"""
-def convert_file(input_file_name, output_file_name, pol = None):
- print "Converting data file: " + input_file_name + " to " + output_file_name
- #print "File converted to: ",output_file_name
- sep = "\t"
- line_sep = "\n"
- MODE = pol_mode.read()
- if pol is None:
- pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
- with open(input_file_name) as inp:
- lines = inp.readlines()
- with open(output_file_name, "wb") as out:
- (db, st) = ("java.lang.Double", "java.lang.String")
- out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
- out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + line_sep)
- s = sep
- for line in lines[1:]:
- line = line.strip()
- if line=="": break
- try:
- (Ecrbk, CADC1, CADC2, CADC3, CADC4, MCurr, cffrbk, IDErbk, time) = line.split(" ")
- normtey=repr( float(CADC2)/float(CADC1))
- normdiode=repr(float(CADC3)/float(CADC1))
- #field=caget(MAG)
- out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + normdiode + line_sep)
- except:
- traceback.print_exc()
- #os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
-
-def convert_file_full(input_file_name, output_file_name, pol = None):
- print "Converting data file: " + input_file_name + " to " + output_file_name
- #print "File converted to: ",output_file_name
- sep = "\t"
- line_sep = "\n"
- MODE = pol_mode.read()
- if pol is None:
- pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
- with open(input_file_name) as inp:
- lines = inp.readlines()
- with open(output_file_name, "wb") as out:
- (db, st) = ("java.lang.Double", "java.lang.String")
- out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
- out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + sep + db + sep + db + sep + db + line_sep)
- s = sep
- for line in lines[1:]:
- line = line.strip()
- if line=="": break
- try:
- (Ecrbk, CADC1, CADC2, CADC3, CADC4, MCurr, cffrbk, IDErbk, time) = line.split(" ")
- normtey=repr( float(CADC2)/float(CADC1))
- normdiode=repr(float(CADC3)/float(CADC1))
- CADC5=repr(0.0)
- mcurr=repr(machine_cur.read())
- fieldx=repr(field.read())
- fieldz=repr(0.0)
- temp=repr(Temp.read())
- out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + mcurr + s + time + s + fieldx + s + fieldz + s + str(pol) + s + temp + s + normtey + s + normdiode + line_sep)
- except:
- traceback.print_exc()
- #os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
-
-###################################################################################################
-#Scan commands
-###################################################################################################
-def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
- """
- """
- if name is None:
- name = get_exec_pars().name
- #folder = get_context().setup.expandPath("{year}_{month}/{date}");
- run("templates/EnergyScan", {"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 otf2(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
- """
- """
- #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):
- 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=1, exposure=1.0, average=1, 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=1, exposure=1.0, average=1, 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=1, name = None):
- set_exec_pars(open=False)
-
- if is_string(ranges):
- with open(expand_path("{config}/AbsortionSpectrum/" + ranges + ".abs"), 'r') as f:
- ranges = Serializer.decode(f.read(), Serializer.EncoderType.bin)[0]
- ranges = to_array(ranges,'d')
-
- 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])]
-
- 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), \
- })
-
-
-###################################################################################################
-#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
-###################################################################################################
-
-for dev in ["eiger", "id", "chopper", "LEEM2000", "diag"]:
- try:
- run("devices/" + dev)
- except:
- log(sys.exc_info()[1], False)
-
-
-###################################################################################################
-#Beamline and Machine status
-###################################################################################################
-
-
-
-def assert_machine_ok(wait = True):
- print "Checking machine..."
- if get_dry_run():
- return
-
- ring_status=get_ring_status()
- old_ring_status=ring_status
- checkRing=0
-
- if ring_status==5:
- log ("FB off")
- #checkRing=1
- if ring_status==0:
- log ("Machine down")
- checkRing=2
-
- if checkRing>0:
- status=False
-
- while not status:
- id1_status=get_id_control(1)
- id2_status=get_id_control(2)
- ring_status=get_ring_status()
- if old_ring_status != ring_status:
- if ring_status == 0:
- log("Machine down")
- checkRing=2
- elif ring_status == 1:
- log("Inj. Stopped")
- checkRing=2
- elif ring_status == 2:
- log("Accumulating.")
- checkRing=2
- elif ring_status == 3:
- log("Accumulating")
- checkRing=2
- elif ring_status == 4:
- log("Top-up ready, Gap still open")
- checkRing=2
- elif ring_status == 5:
- log("Light-Available, no OFB")
- checkRing=2
- elif ring_status == 6:
- log("Light Available")
- checkRing=2
- old_ring_status=ring_status
- status= (ring_status ==6) and (id1_status==1) and (id2_status==1)
- if not wait:
- raise Exception ("Ring error: " + str(ring_status))
- time.sleep(1)
- print "Machine ok"
-
-
-def assert_beamline_ok():
- print "Checking beamline..."
- if get_dry_run():
- return
-
- checkbeamline=0
- message=[ "PLC error","Encoder error", "Feedforward error","Operator control", "Moving timeout", "Interlock"]
- ID = get_setting("ID")
- if ID == "ID1":
- id1_status=get_id_status(1)
- id2_status=0
- elif ID == "ID2":
- id1_status=0
- id2_status=get_id_status(2)
- if ID == "ID1_ID2":
- id1_status=get_id_status(1)
- id2_status=get_id_status(2)
- if id1_status >= 1:
- id1_error=get_id_error(1)
- for bit in range (5,-1, -1):
- if id1_error & (2**bit):
- log ("ID1 "+ str(message[bit]))
- id1_error=id1_error-(2**bit)
- if id2_status >= 1:
- id2_error=get_id_error(2)
- for bit in range (5,-1, -1):
- if id2_error & (2**bit):
- log ("ID2 "+ str(message[bit]))
- id2_error=id2_error-(2**bit)
- if id1_status >= 1:
- raise Exception("ID1 error: " + str(id1_status))
- if id2_status >= 1:
- raise Exception("ID2 error: "+ str(id2_status))
-
-def assert_status_ok(wait = True):
- assert_machine_ok(wait)
- assert_beamline_ok()
-
-###################################################################################################
-#Manual log file
-###################################################################################################
-
-"""
-def get_log_file():
- return data_path + "/logs.txt"
-
-def write_logfile(msg):
- log(msg, True)
- if not os.path.exists(os.path.dirname(get_log_file())):
- os.makedirs(os.path.dirname(get_log_file()))
- with open( get_log_file(), "a") as myfile:
- myfile.write(msgv + "\n")
-"""
-
-###################################################################################################
-#Energy
-###################################################################################################
-
-"""
-def put_energy(v):
- if get_dry_run(): return
- if v>91 and v<2500:
- caput("X11PHS:alldone",0)
- caput("X11PHS-E:GO.A",v)
- else:
- log("Energy out of range (91-2500) :" + str(v))
-
-
-def is_done():
- #1: done move
- #0: moving
- return True if caget("X11PHS:alldone") else False
-
-def wait_done():
- if get_dry_run(): return
- time.sleep(1.0) #in order to reduce trafic on the IOC
- wait_channel("X11PHS:alldone", 1)
-"""
-
-def put_energy(v):
- energy.write(float(v))
- time.sleep(0.5)
- wait_channel(ALL_DONE, 1, type = 'i')
-
-
-def change_energy(v):
- if v<91 or v>2500:
- raise Exception ("Invalid energy: " + str(v))
- print "Setting energy: " + str(v)
- if get_dry_run():
- return
- put_energy(v)
-
-###################################################################################################
-#Image measurements
-###################################################################################################
-
-from ijutils import get_measurement, load_array
-import ch.psi.pshell.imaging.Filter as Filter
-from ch.psi.pshell.imaging.Overlays import Text
-import ch.psi.pshell.imaging.Pen as Pen
-
-class MeasurementsFilter(Filter):
- def __init__(self, measurements):
- self.overlay = Text(Pen(java.awt.Color.GREEN.darker()), "", \
- java.awt.Font("Verdana", java.awt.Font.PLAIN, 12), java.awt.Point(20,20))
- self.measurements = measurements
- self.source = None
- self.renderer = None
-
- def process(self, image, data):
- try:
- ip = load_array(data.array, data.width, data.height)
- msg = ""
- if self.measurements is not None:
- for measurement in self.measurements:
- val = get_measurement(ip,measurement)
- msg = msg + "%s = %1.4f\n" % (measurement,val)
- self.overlay.update(msg)
- except:
- self.overlay.update(str(sys.exc_info()[1]))
- return image
-
- def start(self, source, renderer=None):
- self.stop()
- self.source = source
- self.renderer = renderer if (renderer is not None) else show_panel(source)
- self.source.setFilter(self)
- self.renderer.addOverlay(self.overlay)
-
- def stop(self):
- if self.renderer is not None:
- self.renderer.removeOverlay(self.overlay)
- if self.source is not None:
- self.source.setFilter(None)
- self.source = None
- self.renderer = None
-
-filter_measurements = 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))
-
-def stop_measurements():
- global filter_measurements
- if filter_measurements is not None:
- filter_measurements.stop()
- filter_measurements = None
-
-###################################################################################################
-#Rsync
-###################################################################################################
-
-def _check_sync_user_data(path):
- rsync_user = get_setting("RSYNC_USER");
- rsync_path = get_setting("RSYNC_PATH");
- rsync_host = get_setting("RSYNC_HOST");
- rsync_del = str(get_setting("RSYNC_DEL")).lower() == "true"
- if rsync_user:
- if not rsync_path:
- rsync_path = "~/Data1"
- else:
- rsync_path = "~/Data1/" + rsync_path
- if not rsync_host:
- rsync_host = "localhost"
- if path is not None:
- sync_user_data(rsync_user, path, rsync_path, host=rsync_host, remove_local_folder=rsync_del, remove_local_files=False)
- time.sleep(5.0)
-
-_FORK_SYNC_USER = True
-def check_sync_user_data(path, do_fork=_FORK_SYNC_USER):
- if (do_fork):
- fork((_check_sync_user_data, (path,)), )
- else:
- _check_sync_user_data(path)
-
-_CURRENT_DATA_PATH = None
-def on_change_data_path(path):
- #print "on_change_data_path: " + str(path)
- global _CURRENT_DATA_PATH
- if path is None:
- #print "Close data path"
- if _CURRENT_DATA_PATH is not None:
- check_sync_user_data(_CURRENT_DATA_PATH)
- else:
- #print "Open data path: " + str(path)
- _CURRENT_DATA_PATH = path
- fork(write_metadata)
-
-
-###################################################################################################
-#Sounds
-###################################################################################################
-def on_command_started(info):
- if not get_context().isLocalMode():
- if info.script and not info.background:
- play_sound("start")
-
-def on_command_finished(info):
- if not get_context().isLocalMode():
- if info.script and not info.background:
- if (info.isError()):
- if not info.isAborted():
- play_sound("error")
- else:
- play_sound("success")
-
-
-import ch.psi.utils.Audio as Audio
-import java.io.File as File
-
-def play_sound(name):
- try:
- Audio.playFile(File(get_context().setup.expandPath("{home}/sounds/" + name + ".wav")), False)
- except:
- #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)
-
-
-###################################################################################################
-#Beamline setup
-###################################################################################################
-
-def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
- print "Seting Beamline: ", en,pol1,alp1,har1,off1,pol2,alp2,har2,off2
- if get_dry_run():
- return
-
- if id=='ID1':
- caput('X11PHS-E:OPT',1)
- elif id=='ID2':
- caput('X11PHS-E:OPT',2)
- elif id =='ID1_ID2':
- caput('X11PHS-E:OPT',3)
-
- if id == "ID1":
- #current_pol=POL_IDS[pol1] #get_id_pol(1)
- if pol1 is not None:
- put_id_pol(1,pol1, alp1 if (pol1=="Lin") else None )
- caput('X11MA-ID2-GAP:SET',100) #open Gap ID2
- if har1 is not None:
- id1_harmonic.write(int(har1))
- if off1 is not None:
- put_id_offset(1, float(off1)) #offset on ID1
-
- elif id == "ID2":
- #current_pol=POL_IDS[pol2]#get_id_pol(2)
- if pol2 is not None:
- put_id_pol(2,pol2, alp2 if (pol2=="Lin") else None )
- caput('X11MA-ID1-GAP:SET',100) #open Gap ID1
- if har2 is not None:
- id2_harmonic.write(int(har2))
- if off2 is not None:
- put_id_offset(2, float(off2)) #offset on ID2
-
- elif id == "ID1_ID2":
- #polID1=POL_IDS[pol1]
- #polID2=POL_IDS[pol2]
- if pol1 is not None:
- put_id_pol(1,pol1, alp1 if (pol1=="Lin") else None )
- if pol2 is not None:
- put_id_pol(2,pol2, alp2 if (pol2=="Lin") else None )
- #current_pol=polID1
- if har1 is not None:
- id1_harmonic.write(int(har1))
- if har2 is not None:
- id2_harmonic.write(int(har2))
- if off1 is not None:
- put_id_offset(1, float(off1)) #offset on ID1
- if off2 is not None:
- put_id_offset(2, float(off2)) #offset on ID2
-
- #wait_channel("X11PHS:alldone", 1)
- if en is not None:
- energy.write(en)
- time.sleep(0.5)
- wait_channel("X11PHS:alldone", 1)
-
-
-def change_pol(id, pol, alpha=None):
- print "Changing polarization on id " + str(id), ": " + str(pol) , " - alpha=" + str(alpha)
- if get_dry_run():
- return
- put_id_pol(id, pol, alpha)
- time.sleep(0.5)
- wait_channel("X11PHS:alldone", 1)
-
-def change_offset(id, offset):
- print "Changing offset on id " + str(id), ": " + str(offset)
- if get_dry_run():
- return
- put_id_offset(id, float(offset))
- time.sleep(0.5)
- wait_channel("X11PHS:alldone", 1)
-
-
-def set_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
- set_setting("ID", id)
- set_setting("ENERGY", en)
- set_setting("POL_ID_1", pol1)
- set_setting("ALPHA_ID_1", alp1)
- set_setting("HARMONIC_ID_1", har1)
- set_setting("OFFSET_ID_1", off1)
- set_setting("POL_ID_2", pol2)
- set_setting("ALPHA_ID_2", alp2)
- set_setting("HARMONIC_ID_2", har2)
- set_setting("OFFSET_ID_2", off2)
- apply_beamline_setup(id,en,pol1,alp1,har1,off1,pol2,alp2,har2,off2)
-
-#Restore beamline initial config
-def restore_beamline_setup():
- ID = get_setting("ID")
- ENERGY = float(get_setting("ENERGY"))
- POL_ID_1 = get_setting("POL_ID_1")
- ALPHA_ID_1 = float(get_setting("ALPHA_ID_1"))
- HARMONIC_ID_1 = get_setting("HARMONIC_ID_1")
- OFFSET_ID_1 = float(get_setting("OFFSET_ID_1"))
- POL_ID_2 = get_setting("POL_ID_2")
- ALPHA_ID_2 = float(get_setting("ALPHA_ID_2"))
- HARMONIC_ID_2 = get_setting("HARMONIC_ID_2")
- OFFSET_ID_2 = float(get_setting("OFFSET_ID_2"))
- apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2)
-
-
-###################################################################################################
-#Maths
-###################################################################################################
-
-
-def fit(ydata, xdata = None, limit_to_range=False):
- """
- Gaussian fit
- """
- if xdata is None:
- xdata = frange(0, len(ydata), 1)
- #ydata = to_list(ydata)
- #xdata = to_list(xdata)
- max_y= max(ydata)
- index_max = ydata.index(max_y)
- max_x= xdata[index_max]
- print "Max index:" + str(index_max),
- print " x:" + str(max_x),
- print " y:" + str(max_y)
- 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)
- else:
- print "Fit error"
- return (None, None, 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)
- resolution = (scale_x[1]-scale_x[0]) / points
- fit_y = []
- fit_x = frange(scale_x[0],scale_x[1],resolution, True)
- for x in fit_x:
- 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]) < 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:
- 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(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(roi=None):
- return scan_contrast(girder_x, 0.05, 0.005, roi, average=3)
-
+VG10_GET = "X11MA-OP-VG10:OPEN"
+VG11_SET = "X11MA-EPS-VG11:SET"
+VG11_GET = "X11MA-OP-VG11:OPEN"
+VG12_SET = "X11MA-EPS-VG12:SET"
+VG12_GET = "X11MA-OP-VG12:OPEN"
+VG13_SET = "X11MA-EPS-VG13:SET"
+VG13_GET = "X11MA-OP-VG13:OPEN"
+
+"""
+
+LPP_DELAY = "X11MA-ES2-4CHT:SET2-DELAY"
+LPP_FINE_DELAY = "X11MA-ES2-4CHT:SET2-FINE"
+TIME_DELAY_SET = "X11MA-ES2:Theta-New.A"
+TIME_DELAY_VAL = "X11MA-ES2:Theta-Cur.VAL"
+TIME_DELAY_START = "X11MA-ES2:SCAN-START"
+TIME_DELAY_COMPLETE = "X11MA-ES2-scan1.SMSG"
+TBT_MAG = "X11MA-LSCI632:MFIELD"
+"
+"""
+
+
+#Device initialization
+keithley_1a.setForcedRead(False)
+keithley_2a.setForcedRead(False)
+keithley_3a.setForcedRead(False)
+
+
+def get_next_fid(folder, prefix):
+ try:
+ import glob
+ files = glob.glob(folder + prefix + '*_*.dat')
+ last = max(files)
+ index = int (last[last.rfind('_')+1 : last.rfind('.')]) + 1
+ return index
+ except:
+ return 0
+
+def wait_channel(name, value, timeout =None, type='s'):
+ print "Waiting " + str(name) + " = " + str(value)
+ cawait(name, value, timeout = timeout, type=type)
+ print "Done"
+
+def wait_device(dev, value, timeout=-1):
+ timeout = int(timeout *1000) if timeout>0 else timeout
+ dev.waitValue(value,timeout)
+
+def open_vg10():
+ if caget (VG10_GET,'i') != 1:
+ caput(VG10_SET, 0)
+ time.sleep(0.1)
+ caput(VG10_SET, 1)
+
+def close_vg10():
+ if caget (VG10_GET,'i') == 1:
+ caput(VG10_SET, 0)
+ time.sleep(0.1)
+ caput(VG10_SET, 1)
+
+def open_vg11():
+ if caget (VG11_GET,'i') != 1:
+ caput(VG11_SET, 0)
+ time.sleep(0.1)
+ caput(VG11_SET, 1)
+
+def close_vg11():
+ if caget (VG11_GET,'i') == 1:
+ caput(VG11_SET, 0)
+ time.sleep(0.1)
+ caput(VG11_SET, 1)
+
+def open_vg12():
+ if caget (VG12_GET,'i') != 1:
+ caput(VG12_SET, 0)
+ time.sleep(0.1)
+ caput(VG12_SET, 1)
+
+def close_vg12():
+ if caget (VG12_GET,'i') == 1:
+ caput(VG12_SET, 0)
+ time.sleep(0.1)
+ caput(VG12_SET, 1)
+
+def open_vg13():
+ if caget (VG13_GET,'i') != 1:
+ caput(VG13_SET, 0)
+ time.sleep(0.1)
+ caput(VG13_SET, 1)
+
+def close_vg13():
+ if caget (VG13_GET,'i') == 1:
+ caput(VG13_SET, 0)
+ time.sleep(0.1)
+ caput(VG13_SET, 1)
+
+def plot_file(file_name, ctxt = None):
+ """
+ """
+ sep = "\t"
+ with open(file_name) as f:
+ header = f.readline()[1:].split(sep)
+ table = Table.loadRaw(file_name, sep, '#',header)
+ plots = plot(table, title = ctxt)
+
+def has_beam():
+ """
+ """
+ return beam_status.readback.read() == "Light Available"
+
+def is_id_error():
+ return (id_error.read()==0)
+
+def check_id_error():
+ if is_id_error():
+ raise Exception ("ID error: check ID status")
+
+###################################################################################################
+#Default scan callbacks
+###################################################################################################
+
+def before_sample():
+ pass
+
+def after_sample():
+ check_id_error()
+
+##################### Convert_File function #############################
+"""
+def convert_file(input_file_name, output_file_name):
+ sep = "\t"
+ line_sep = "\r\n"
+ field = caget('X11MA-XMCD:Ireadout')
+ with open(input_file_name) as inp:
+ lines = inp.readlines()
+ with open(output_file_name, "wb") as out:
+ out.write("Energy" + sep + "Io" + sep + "CADC2" + sep + "CADC3" + sep + "Mag" + line_sep)
+ s = sep + " " #File format has a space before numeric values
+ for line in lines[1:]:
+ line = line.strip()
+ if line=="": break
+ try:
+ (Ecrbk,CADC1, CADC2, NORM, CADC3, CADC4, MCurr, cffrbk, ID1Erbk, ID2Erbk, vTime) = line.split(" ")
+ out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + str(field) +line_sep)
+ except:
+ traceback.print_exc()
+"""
+def convert_file(input_file_name, output_file_name, pol = None):
+ print "Converting data file: " + input_file_name + " to " + output_file_name
+ #print "File converted to: ",output_file_name
+ sep = "\t"
+ line_sep = "\n"
+ MODE = pol_mode.read()
+ if pol is None:
+ pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
+ with open(input_file_name) as inp:
+ lines = inp.readlines()
+ with open(output_file_name, "wb") as out:
+ (db, st) = ("java.lang.Double", "java.lang.String")
+ out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
+ out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + line_sep)
+ s = sep
+ for line in lines[1:]:
+ line = line.strip()
+ if line=="": break
+ try:
+ (Ecrbk, CADC1, CADC2, CADC3, CADC4, MCurr, cffrbk, IDErbk, time) = line.split(" ")
+ normtey=repr( float(CADC2)/float(CADC1))
+ normdiode=repr(float(CADC3)/float(CADC1))
+ #field=caget(MAG)
+ out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + normdiode + line_sep)
+ except:
+ traceback.print_exc()
+ #os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
+
+def convert_file_full(input_file_name, output_file_name, pol = None):
+ print "Converting data file: " + input_file_name + " to " + output_file_name
+ #print "File converted to: ",output_file_name
+ sep = "\t"
+ line_sep = "\n"
+ MODE = pol_mode.read()
+ if pol is None:
+ pol = pol_angle.read() if (MODE == "LINEAR") else pol_mode.readback.read()
+ with open(input_file_name) as inp:
+ lines = inp.readlines()
+ with open(output_file_name, "wb") as out:
+ (db, st) = ("java.lang.Double", "java.lang.String")
+ out.write("#Energy" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
+ out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + sep + db + sep + db + sep + db + line_sep)
+ s = sep
+ for line in lines[1:]:
+ line = line.strip()
+ if line=="": break
+ try:
+ (Ecrbk, CADC1, CADC2, CADC3, CADC4, MCurr, cffrbk, IDErbk, time) = line.split(" ")
+ normtey=repr( float(CADC2)/float(CADC1))
+ normdiode=repr(float(CADC3)/float(CADC1))
+ CADC5=repr(0.0)
+ mcurr=repr(machine_cur.read())
+ fieldx=repr(field.read())
+ fieldz=repr(0.0)
+ temp=repr(Temp.read())
+ out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + mcurr + s + time + s + fieldx + s + fieldz + s + str(pol) + s + temp + s + normtey + s + normdiode + line_sep)
+ except:
+ traceback.print_exc()
+ #os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
+
+###################################################################################################
+#Scan commands
+###################################################################################################
+def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
+ """
+ """
+ if name is None:
+ name = get_exec_pars().name
+ #folder = get_context().setup.expandPath("{year}_{month}/{date}");
+ run("templates/EnergyScan", {"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 otf2(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
+ """
+ """
+ #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})
+ run("templates/EnergyScan_v3", {"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})
+ # EnergySCan_v3 was created by CP. Apr/22
+
+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 wait_pol_done(delay=1.0):
+ #taken from the X-Treme beamline. Used in EnergyScan_v3.py. CP. Apr/22
+ print "Waiting for pol done"
+ time.sleep(delay) #Make sure value changed
+ while True:
+ try:
+ if caget("X11MA-ID2:DONE") == "DONE":
+ break
+ except:
+ print "Error reading pol done"
+ time.sleep(0.5)
+ print "Done"
+
+
+def two_pol(switching="Tune_Detune", sequence="A", measurements=1, exposure=1.0, average=1, 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=1, exposure=1.0, average=1, 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=1, exposure=1.0, average=1, 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=1, name = None):
+ set_exec_pars(open=False)
+
+ if is_string(ranges):
+ with open(expand_path("{config}/AbsortionSpectrum/" + ranges + ".abs"), 'r') as f:
+ ranges = Serializer.decode(f.read(), Serializer.EncoderType.bin)[0]
+ ranges = to_array(ranges,'d')
+
+ 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])]
+
+ 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), \
+ })
+
+
+###################################################################################################
+#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
+###################################################################################################
+
+for dev in ["eiger", "id", "chopper", "LEEM2000", "diag"]:
+ try:
+ run("devices/" + dev)
+ except:
+ log(sys.exc_info()[1], False)
+
+
+###################################################################################################
+#Beamline and Machine status
+###################################################################################################
+
+
+
+def assert_machine_ok(wait = True):
+ print "Checking machine..."
+ if get_dry_run():
+ return
+
+ ring_status=get_ring_status()
+ old_ring_status=ring_status
+ checkRing=0
+
+ if ring_status==5:
+ log ("FB off")
+ #checkRing=1
+ if ring_status==0:
+ log ("Machine down")
+ checkRing=2
+
+ if checkRing>0:
+ status=False
+
+ while not status:
+ id1_status=get_id_control(1)
+ id2_status=get_id_control(2)
+ ring_status=get_ring_status()
+ if old_ring_status != ring_status:
+ if ring_status == 0:
+ log("Machine down")
+ checkRing=2
+ elif ring_status == 1:
+ log("Inj. Stopped")
+ checkRing=2
+ elif ring_status == 2:
+ log("Accumulating.")
+ checkRing=2
+ elif ring_status == 3:
+ log("Accumulating")
+ checkRing=2
+ elif ring_status == 4:
+ log("Top-up ready, Gap still open")
+ checkRing=2
+ elif ring_status == 5:
+ log("Light-Available, no OFB")
+ checkRing=2
+ elif ring_status == 6:
+ log("Light Available")
+ checkRing=2
+ old_ring_status=ring_status
+ status= (ring_status ==6) and (id1_status==1) and (id2_status==1)
+ if not wait:
+ raise Exception ("Ring error: " + str(ring_status))
+ time.sleep(1)
+ print "Machine ok"
+
+
+def assert_beamline_ok():
+ print "Checking beamline..."
+ if get_dry_run():
+ return
+
+ checkbeamline=0
+ message=[ "PLC error","Encoder error", "Feedforward error","Operator control", "Moving timeout", "Interlock"]
+ ID = get_setting("ID")
+ if ID == "ID1":
+ id1_status=get_id_status(1)
+ id2_status=0
+ elif ID == "ID2":
+ id1_status=0
+ id2_status=get_id_status(2)
+ if ID == "ID1_ID2":
+ id1_status=get_id_status(1)
+ id2_status=get_id_status(2)
+ if id1_status >= 1:
+ id1_error=get_id_error(1)
+ for bit in range (5,-1, -1):
+ if id1_error & (2**bit):
+ log ("ID1 "+ str(message[bit]))
+ id1_error=id1_error-(2**bit)
+ if id2_status >= 1:
+ id2_error=get_id_error(2)
+ for bit in range (5,-1, -1):
+ if id2_error & (2**bit):
+ log ("ID2 "+ str(message[bit]))
+ id2_error=id2_error-(2**bit)
+ if id1_status >= 1:
+ raise Exception("ID1 error: " + str(id1_status))
+ if id2_status >= 1:
+ raise Exception("ID2 error: "+ str(id2_status))
+
+def assert_status_ok(wait = True):
+ assert_machine_ok(wait)
+ assert_beamline_ok()
+
+###################################################################################################
+#Manual log file
+###################################################################################################
+
+"""
+def get_log_file():
+ return data_path + "/logs.txt"
+
+def write_logfile(msg):
+ log(msg, True)
+ if not os.path.exists(os.path.dirname(get_log_file())):
+ os.makedirs(os.path.dirname(get_log_file()))
+ with open( get_log_file(), "a") as myfile:
+ myfile.write(msgv + "\n")
+"""
+
+###################################################################################################
+#Energy
+###################################################################################################
+
+"""
+def put_energy(v):
+ if get_dry_run(): return
+ if v>91 and v<2500:
+ caput("X11PHS:alldone",0)
+ caput("X11PHS-E:GO.A",v)
+ else:
+ log("Energy out of range (91-2500) :" + str(v))
+
+
+def is_done():
+ #1: done move
+ #0: moving
+ return True if caget("X11PHS:alldone") else False
+
+def wait_done():
+ if get_dry_run(): return
+ time.sleep(1.0) #in order to reduce trafic on the IOC
+ wait_channel("X11PHS:alldone", 1)
+"""
+
+def put_energy(v):
+ energy.write(float(v))
+ time.sleep(0.5)
+ wait_channel(ALL_DONE, 1, type = 'i')
+
+
+def change_energy(v):
+ if v<91 or v>2500:
+ raise Exception ("Invalid energy: " + str(v))
+ print "Setting energy: " + str(v)
+ if get_dry_run():
+ return
+ put_energy(v)
+
+###################################################################################################
+#Image measurements
+###################################################################################################
+
+from ijutils import get_measurement, load_array
+import ch.psi.pshell.imaging.Filter as Filter
+from ch.psi.pshell.imaging.Overlays import Text
+import ch.psi.pshell.imaging.Pen as Pen
+
+class MeasurementsFilter(Filter):
+ def __init__(self, measurements):
+ self.overlay = Text(Pen(java.awt.Color.GREEN.darker()), "", \
+ java.awt.Font("Verdana", java.awt.Font.PLAIN, 12), java.awt.Point(20,20))
+ self.measurements = measurements
+ self.source = None
+ self.renderer = None
+
+ def process(self, image, data):
+ try:
+ ip = load_array(data.array, data.width, data.height)
+ msg = ""
+ if self.measurements is not None:
+ for measurement in self.measurements:
+ val = get_measurement(ip,measurement)
+ msg = msg + "%s = %1.4f\n" % (measurement,val)
+ self.overlay.update(msg)
+ except:
+ self.overlay.update(str(sys.exc_info()[1]))
+ return image
+
+ def start(self, source, renderer=None):
+ self.stop()
+ self.source = source
+ self.renderer = renderer if (renderer is not None) else show_panel(source)
+ self.source.setFilter(self)
+ self.renderer.addOverlay(self.overlay)
+
+ def stop(self):
+ if self.renderer is not None:
+ self.renderer.removeOverlay(self.overlay)
+ if self.source is not None:
+ self.source.setFilter(None)
+ self.source = None
+ self.renderer = None
+
+filter_measurements = 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))
+
+def stop_measurements():
+ global filter_measurements
+ if filter_measurements is not None:
+ filter_measurements.stop()
+ filter_measurements = None
+
+
+###################################################################################################
+#Image arrows
+###################################################################################################
+
+if eiger.initialized:
+ run("imaging/fov_arrows")
+else:
+ msg="Cannot initialize arrows: eiger not initialized"
+ log(msg)
+ print msg
+
+###################################################################################################
+#Rsync
+###################################################################################################
+
+def _check_sync_user_data(path):
+ rsync_user = get_setting("RSYNC_USER");
+ rsync_path = get_setting("RSYNC_PATH");
+ rsync_host = get_setting("RSYNC_HOST");
+ rsync_del = str(get_setting("RSYNC_DEL")).lower() == "true"
+ if rsync_user:
+ if not rsync_path:
+ rsync_path = "~/Data1"
+ else:
+ rsync_path = "~/Data1/" + rsync_path
+ if not rsync_host:
+ rsync_host = "localhost"
+ if path is not None:
+ sync_user_data(rsync_user, path, rsync_path, host=rsync_host, remove_local_folder=rsync_del, remove_local_files=False)
+ time.sleep(5.0)
+
+_FORK_SYNC_USER = True
+def check_sync_user_data(path, do_fork=_FORK_SYNC_USER):
+ if (do_fork):
+ fork((_check_sync_user_data, (path,)), )
+ else:
+ _check_sync_user_data(path)
+
+_CURRENT_DATA_PATH = None
+def on_change_data_path(path):
+ #print "on_change_data_path: " + str(path)
+ global _CURRENT_DATA_PATH
+ if path is None:
+ #print "Close data path"
+ if _CURRENT_DATA_PATH is not None:
+ check_sync_user_data(_CURRENT_DATA_PATH)
+ else:
+ #print "Open data path: " + str(path)
+ _CURRENT_DATA_PATH = path
+ fork(write_metadata)
+
+
+###################################################################################################
+#Sounds
+###################################################################################################
+def on_command_started(info):
+ if not get_context().isLocalMode():
+ if info.script and not info.background:
+ play_sound("start")
+
+def on_command_finished(info):
+ if not get_context().isLocalMode():
+ if info.script and not info.background:
+ if (info.isError()):
+ if not info.isAborted():
+ play_sound("error")
+ else:
+ play_sound("success")
+
+
+import ch.psi.utils.Audio as Audio
+import java.io.File as File
+
+def play_sound(name):
+ try:
+ Audio.playFile(File(get_context().setup.expandPath("{home}/sounds/" + name + ".wav")), False)
+ except:
+ #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)
+
+
+###################################################################################################
+#Beamline setup
+###################################################################################################
+
+def apply_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
+ print "Seting Beamline: ", en,pol1,alp1,har1,off1,pol2,alp2,har2,off2
+ if get_dry_run():
+ return
+
+ if id=='ID1':
+ caput('X11PHS-E:OPT',1)
+ elif id=='ID2':
+ caput('X11PHS-E:OPT',2)
+ elif id =='ID1_ID2':
+ caput('X11PHS-E:OPT',3)
+
+ if id == "ID1":
+ #current_pol=POL_IDS[pol1] #get_id_pol(1)
+ if pol1 is not None:
+ put_id_pol(1,pol1, alp1 if (pol1=="Lin") else None )
+ caput('X11MA-ID2-GAP:SET',100) #open Gap ID2
+ if har1 is not None:
+ id1_harmonic.write(int(har1))
+ if off1 is not None:
+ put_id_offset(1, float(off1)) #offset on ID1
+
+ elif id == "ID2":
+ #current_pol=POL_IDS[pol2]#get_id_pol(2)
+ if pol2 is not None:
+ put_id_pol(2,pol2, alp2 if (pol2=="Lin") else None )
+ caput('X11MA-ID1-GAP:SET',100) #open Gap ID1
+ if har2 is not None:
+ id2_harmonic.write(int(har2))
+ if off2 is not None:
+ put_id_offset(2, float(off2)) #offset on ID2
+
+ elif id == "ID1_ID2":
+ #polID1=POL_IDS[pol1]
+ #polID2=POL_IDS[pol2]
+ if pol1 is not None:
+ put_id_pol(1,pol1, alp1 if (pol1=="Lin") else None )
+ if pol2 is not None:
+ put_id_pol(2,pol2, alp2 if (pol2=="Lin") else None )
+ #current_pol=polID1
+ if har1 is not None:
+ id1_harmonic.write(int(har1))
+ if har2 is not None:
+ id2_harmonic.write(int(har2))
+ if off1 is not None:
+ put_id_offset(1, float(off1)) #offset on ID1
+ if off2 is not None:
+ put_id_offset(2, float(off2)) #offset on ID2
+
+ #wait_channel("X11PHS:alldone", 1)
+ if en is not None:
+ energy.write(en)
+ time.sleep(0.5)
+ wait_channel("X11PHS:alldone", 1)
+
+
+def change_pol(id, pol, alpha=None):
+ print "Changing polarization on id " + str(id), ": " + str(pol) , " - alpha=" + str(alpha)
+ if get_dry_run():
+ return
+ put_id_pol(id, pol, alpha)
+ time.sleep(0.5)
+ wait_channel("X11PHS:alldone", 1)
+
+def change_offset(id, offset):
+ print "Changing offset on id " + str(id), ": " + str(offset)
+ if get_dry_run():
+ return
+ put_id_offset(id, float(offset))
+ time.sleep(0.5)
+ wait_channel("X11PHS:alldone", 1)
+
+
+def set_beamline_setup(id,en=None,pol1=None,alp1=None,har1=None,off1=None,pol2=None,alp2=None,har2=None,off2=None):
+ set_setting("ID", id)
+ set_setting("ENERGY", en)
+ set_setting("POL_ID_1", pol1)
+ set_setting("ALPHA_ID_1", alp1)
+ set_setting("HARMONIC_ID_1", har1)
+ set_setting("OFFSET_ID_1", off1)
+ set_setting("POL_ID_2", pol2)
+ set_setting("ALPHA_ID_2", alp2)
+ set_setting("HARMONIC_ID_2", har2)
+ set_setting("OFFSET_ID_2", off2)
+ apply_beamline_setup(id,en,pol1,alp1,har1,off1,pol2,alp2,har2,off2)
+
+#Restore beamline initial config
+def restore_beamline_setup():
+ ID = get_setting("ID")
+ ENERGY = float(get_setting("ENERGY"))
+ POL_ID_1 = get_setting("POL_ID_1")
+ ALPHA_ID_1 = float(get_setting("ALPHA_ID_1"))
+ HARMONIC_ID_1 = get_setting("HARMONIC_ID_1")
+ OFFSET_ID_1 = float(get_setting("OFFSET_ID_1"))
+ POL_ID_2 = get_setting("POL_ID_2")
+ ALPHA_ID_2 = float(get_setting("ALPHA_ID_2"))
+ HARMONIC_ID_2 = get_setting("HARMONIC_ID_2")
+ OFFSET_ID_2 = float(get_setting("OFFSET_ID_2"))
+ apply_beamline_setup(ID,ENERGY,POL_ID_1,ALPHA_ID_1,HARMONIC_ID_1,OFFSET_ID_1,POL_ID_2,ALPHA_ID_2,HARMONIC_ID_2,OFFSET_ID_2)
+
+# peem default setups
+def peem_optics_default_15kV():
+ objective.write(1475)
+ obj_stig_a.write(0)
+ obj_stig_b.write(0)
+
+def peem_optics_default_10kV():
+ objective.write(1220)
+ obj_stig_a.write(0)
+ obj_stig_b.write(0)
+
+# x-rays default setup
+def xrays_default():
+ exit_slit.write(0)
+ caput ('X11MA-FE-DSAPER', 0) # close FE-slits
+
+def neutralize_position():
+ manip_x.write(0)
+ manip_y.write(0)
+ #microscope.move_tilt('U', val)
+ tilt_h.write(val)
+ tilt_v.write(val)
+###################################################################################################
+#Maths
+###################################################################################################
+
+
+def fit(ydata, xdata = None, limit_to_range=False):
+ """
+ Gaussian fit
+ """
+ if xdata is None:
+ xdata = frange(0, len(ydata), 1)
+ #ydata = to_list(ydata)
+ #xdata = to_list(xdata)
+ max_y= max(ydata)
+ index_max = ydata.index(max_y)
+ max_x= xdata[index_max]
+ print "Max index:" + str(index_max),
+ print " x:" + str(max_x),
+ print " y:" + str(max_y)
+ 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)
+ else:
+ print "Fit error"
+ return (None, None, 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)
+ resolution = (scale_x[1]-scale_x[0]) / points
+ fit_y = []
+ fit_x = frange(scale_x[0],scale_x[1],resolution, True)
+ for x in fit_x:
+ 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]) < 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:
+ 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(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 scan_intensity(roi=None):
+ return scan_contrast(girder_x, 0.05, 0.005, roi, average=3)
+
+def auto_intensity(roi=None, exposure=None):
+ init_eiger(exposure=exposure)
+ try:
+ return scan_intensity(roi)
+ finally:
+ restore_eiger()
diff --git a/script/templates/AutoFocus.py b/script/templates/AutoFocus.py
index 8f2ee72..706b81c 100644
--- a/script/templates/AutoFocus.py
+++ b/script/templates/AutoFocus.py
@@ -18,13 +18,17 @@ initial_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
print "Initial state:" , initial_state
set_focus_scan_roi(ROI, RENDERER)
+if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
+ open_vg10()
+
former_exposure = None
try:
+ init_eiger(exposure=EXPOSURE)
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
+ #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"):
@@ -40,9 +44,11 @@ try:
#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)
+ #if EXPOSURE:
+ # if (former_exposure is not None) and (former_exposure!=EXPOSURE):
+ # set_exposure_time(former_exposure)
+ if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
+ close_vg10()
restore_eiger()
final_state = objective.read(),obj_stig_a.read(),obj_stig_b.read()
diff --git a/script/templates/EnergyScan_img.py b/script/templates/EnergyScan_img.py
old mode 100755
new mode 100644
index 64a8608..0ad13d0
--- a/script/templates/EnergyScan_img.py
+++ b/script/templates/EnergyScan_img.py
@@ -76,6 +76,10 @@ class Time(Readable):
return time.time()-self.start
scan_completed = False
+
+if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
+ open_vg10()
+
try:
if EXPOSURE != eiger.getExposure():
restore_eiger(exposure_time = EXPOSURE)
@@ -120,6 +124,8 @@ except:
time.sleep(0.1)
raise
finally:
+ if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
+ close_vg10()
restore_eiger()
after_sample() #To call check_id_error()
\ No newline at end of file
diff --git a/script/templates/EnergyScan_v3.py b/script/templates/EnergyScan_v3.py
new file mode 100644
index 0000000..79e7b77
--- /dev/null
+++ b/script/templates/EnergyScan_v3.py
@@ -0,0 +1,115 @@
+#Parameters
+"""
+E1 = 800
+E2 = 820
+TIME = 1 #min
+DELAY = 0.1 #s
+MODE = 'LINEAR'
+OFFSET = 0.0
+FOLDER = 'XAS/2020/11/SL-IN/'
+FILE = 'test'
+ALPHA=0.0
+TAG=None
+"""
+
+print "\nStart energy scan..."
+#print E1,E2,TIME,DELAY,str(MODE) ,str(OFFSET) ,str(FOLDER) ,str(FILE) ,str(ALPHA)
+if MODE == "LINEAR":
+ print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE),str(ALPHA),"deg"
+else:
+ print E1,"eV ->",E2,"eV,",TIME,"min duration,",DELAY,"sec delay,",str(MODE)
+
+folder = os.path.expanduser("~/Data1/") + FOLDER + "/";
+
+if TAG is not None:
+ TAG = ("%03d" % (get_exec_pars().index,)) + "_" + TAG
+#set_exec_pars(name= FILE)
+
+
+#Pre-actions
+#if NO_BEAM_CHECK == False:
+# print "Wait beam"
+# wait_beam()
+
+if MODE is not None:
+ print "Set polarization"
+ pol_mode.write(MODE)
+ if MODE == 'LINEAR':
+ if ALPHA is not None:
+ pol_angle.write(ALPHA)
+ time.sleep(0.5)
+wait_pol_done(1.0) # new script to wait for polarization. Wait_device does not work for this channel. CP. Apr/22
+
+print "Set offset"
+if OFFSET is not None:
+ pol_offset.write(OFFSET)
+#wait_device(pol_done, "DONE")
+
+print "Set energy"
+energy.write(float(E1))
+sleep(0.1)
+wait_channel(ALL_DONE, 1, type = 'i')
+
+caput('E1', E1)
+caput('E2', E2)
+caput('TIME', TIME)
+caput('FOLDER', FOLDER)
+caput('FILE', FILE)
+time.sleep(DELAY)
+caput('START', '1')
+
+
+#Pseudo-devices
+class Time(Readable):
+ def __init__(self):
+ self.start = time.time()
+ def read(self):
+ return time.time()-self.start
+
+class NORMtey(Readable):
+ def read(self):
+ return float(CADC2.take())/float(CADC1.take())
+
+class NORMdiode(Readable):
+ def read(self):
+ return float(CADC3.take())/float(CADC1.take())
+
+pol = pol_angle if (pol_mode.readback.read() == "LINEAR") else pol_mode #take pol angle or mode to save in the file. CP. Apr/22
+
+scan_completed = False
+try:
+ caput('START', '1')
+ #sensors = [Ecrbk, CADC1, CADC2, CADC3, NORMtey(), NORMdiode()]
+ sensors = [Ecrbk, CADC1, CADC2, CADC3, field, pol, NORMtey(), NORMdiode()] # add polarization and mag. field in file. CP. Apr/22
+
+ def monitoring_task():
+ global scan_completed
+ time.sleep(1.0)
+ try:
+ plot_titles = [ "I0", "TEYraw", "TFYraw", "TEY", "TFY"]
+ for index, title in enumerate(plot_titles, start=0): get_plots()[index].title = title
+ except:
+ pass
+ wait_channel('START', 'STOP', type = 's')
+ scan_completed = True
+ get_exec_pars().currentScan.abort()
+
+ ret = fork(monitoring_task)
+
+ print "Scanning...",
+ try:
+ mscan(Ecrbk, sensors, -1, None, range="auto", domain_axis="Ecrbk", enabled_plots = ["NORMtey", "NORMdiode", CADC1,CADC3, CADC2], tag=TAG)
+ finally:
+ ret[0].cancel(True)
+ print "Finished Energy scan."
+
+except:
+ if not scan_completed:
+ print sys.exc_info()
+ print("Aborting...")
+ while caget('START') == 'START':
+ caput('START', '0')
+ time.sleep(0.1)
+ raise
+
+after_sample() #To call check_id_error()
\ No newline at end of file
diff --git a/script/templates/FocusScan.py b/script/templates/FocusScan.py
index e244092..e674e39 100644
--- a/script/templates/FocusScan.py
+++ b/script/templates/FocusScan.py
@@ -60,8 +60,17 @@ def get_focus_scan_roi():
def scan_contrast(positioner, pos_range, pos_step, roi = None, average = 1, update_position = True):
+ 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)
+
+
def after_read(rec):
- if rec[positioner] > MAX_CONTRAST:
+ if rec[sensor] > MAX_CONTRAST:
print "Invalid contrast value"
time.sleep(eiger.exposure)
rec.invalidate()
@@ -74,14 +83,7 @@ def scan_contrast(positioner, pos_range, pos_step, roi = None, average = 1, upda
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
- 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)
@@ -124,18 +126,31 @@ def update_roi_pos(cur_data, former_data):
former_data=None
-def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = True):
+def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = True, save_images=True):
global former_data
roi=get_focus_scan_roi()
former_data = image.data
initial_state = get_focus_scan_pos()
initial_roi_location = roi.location if roi is not None else None
+ 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)
+
+
def before_read(pos,scan):
global former_data
+ if str(eiger.grabMode)=="Single":
+ eiger.start()
+ image.waitNext(20000)
+
cur_data = image.data
try:
- print "----- Pos: ", pos
+ print "----- Pos: ", pos
update_roi_pos(cur_data, former_data)
finally:
former_data = cur_data
@@ -143,28 +158,24 @@ def scan_focus(positioner, pos_range, pos_step, average = 1, update_position = T
print "New ROI pos: " , roi_contrast.roi.location
- def after_read(rec, scam):
+ def after_read(rec, scan):
global former_data
- if rec[positioner] > MAX_CONTRAST:
+ if rec[sensor] > MAX_CONTRAST:
print "Invalid contrast value"
time.sleep(eiger.exposure)
rec.invalidate()
+ else:
+ if (save_images):
+ filename = get_exec_pars().path + "/images/" + str(rec.index) + ".tif"
+ meta={positioner.name:rec[positioner], "contrast": rec[sensor]}
+ save_as_tiff(former_data, filename, check=True, parallel=True, metadata=meta)
def before_pass(scan, num_pass):
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, initial_move=False, restore_position=False, \
diff --git a/script/test/FOV_table.py b/script/test/FOV_table.py
new file mode 100644
index 0000000..6fc283b
--- /dev/null
+++ b/script/test/FOV_table.py
@@ -0,0 +1,17 @@
+FOV_ARROWS = { \
+ "120um[0.0]": [84.0], \
+ "100um[0.0]": [82.0], \
+ "75um[0.0]": [77.0], \
+ "50um[0.0]": [72.0], \
+ "40um[0.0]": [66.0], \
+ "30um[0.0]": [61.0], \
+ "25um[0.0]": [50.0], \
+ "20um[0.0]": [45.0], \
+ "15um[0.0]": [32.0], \
+ "10um[0.0]": [5.0], \
+ "7.5um[0.0]": [15.0], \
+ "5m[0.0]": [10.0], \
+ "2.5m[0.0]": [5.0], \
+ "1.25m[0.0]": [0.0], \
+ "new_entry": [0.0] \
+}
diff --git a/script/test/image_arrows.py b/script/test/image_arrows.py
new file mode 100644
index 0000000..4cec576
--- /dev/null
+++ b/script/test/image_arrows.py
@@ -0,0 +1,64 @@
+arrows_renderer = arrow_x = arrow_y = None
+
+FOV_ARROWS = { \
+ "50um[0.0]": [20.0] \
+}
+
+
+FOV_ARROWS_SIZE=100
+FOV_ARROWS_ORIGIN=Point(image.getData().width/4, image.getData().height*3/4)
+FOV_FUTURE=None
+
+def update_arrows():
+ global arrows_renderer, arrow_x, arrow_y
+ if arrows_renderer is not None:
+ fov = microscope.get_preset_label()
+ args = FOV_ARROWS.get(fov, None)
+ if args is not None:
+ angle=args[0]
+ x,y = FOV_ARROWS_ORIGIN.x, FOV_ARROWS_ORIGIN.y
+ a=math.radians(angle)
+ xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a))
+ arrow_x.update(FOV_ARROWS_ORIGIN, Point(xa,ya))
+ angle=angle+90
+ a=math.radians(angle)
+ xa,ya=int(x+FOV_ARROWS_SIZE*math.cos(a)), int(y-FOV_ARROWS_SIZE*math.sin(a))
+ arrow_y.update(FOV_ARROWS_ORIGIN, Point(xa,ya))
+ else:
+ arrow_x.update(FOV_ARROWS_ORIGIN, FOV_ARROWS_ORIGIN)
+ arrow_y.update(FOV_ARROWS_ORIGIN, FOV_ARROWS_ORIGIN)
+
+def task_update_arrows():
+ global arrows_renderer
+ while arrows_renderer is not None:
+ try:
+ if arrows_renderer.isShowing():
+ update_arrows()
+ time.sleep(5.0)
+ time.sleep(1.0)
+ except:
+ pass
+
+
+def start_arrows(renderer=None):
+ global arrows_renderer, arrow_x, arrow_y, FOV_FUTURE
+ if arrows_renderer is None:
+ arrows_renderer = renderer if renderer else show_panel(image)
+ arrow_x = Overlays.Arrow(Pen(Color.GREEN))
+ arrow_y = Overlays.Arrow(Pen(Color.GREEN.darker().darker()))
+ arrows_renderer.addOverlays([arrow_x,arrow_y])
+ #update_arrows()
+ FOV_FUTURE = fork(task_update_arrows,)[0]
+
+
+def stop_arrows(renderer=None):
+ global arrows_renderer, arrow_x, arrow_y, FOV_FUTURE
+ if arrows_renderer is not None:
+ arrows_renderer.removeOverlays([arrow_x,arrow_y])
+ arrows_renderer=None
+ FOV_FUTURE.cancel(True)
+ try:
+ join(FOV_FUTURE)
+ except:
+ pass
+
diff --git a/script/test/test.py b/script/test/test.py
index 19aa11a..e2771e8 100755
--- a/script/test/test.py
+++ b/script/test/test.py
@@ -1,25 +1 @@
-set_exec_pars(path="/sls/X11MA/data/X11MA/Data1/XAS/25Feb2020/test/")
-
-open_vg13()
-time.sleep(1)
-
-#caput('X11MA-KEI10:RANGE', 7)
-#caput('X11MA-KEI11:RANGE', 8)
-#caput('X11MA-KEI12:RANGE', 9)
-#otf(start=440, end=480, time=2, delay=10, mode='CIRC +', alpha = 0.0, offset=-2.5, name='FeSTOUV_Ti_cp_range', folder='./')
-#otf(start=440, end=480, time=2, delay=10, mode='CIRC -', alpha = 0.0, offset=-2.5, name='FeSTOUV_Ti_cm_range', folder='./')
-
-
-#caput('X11MA-KEI10:RANGE', 7)
-#caput('X11MA-KEI11:RANGE', 7)
-#caput('X11MA-KEI12:RANGE', 8)
-#otf(start=520, end=590, time=2, delay=10, mode='CIRC +', alpha = 0.0, offset=-2.5, name='FeSTOUV_O_cp_range', folder='./')
-#otf(start=520, end=590, time=2, delay=10, mode='CIRC -', alpha = 0.0, offset=-2.5, name='FeSTOUV_O_cm_range', folder='./')
-
-
-caput('X11MA-KEI10:RANGE', 7)
-caput('X11MA-KEI11:RANGE', 8)
-caput('X11MA-KEI12:RANGE', 8)
-otf(start=690, end=750, time=2, delay=10, mode='CIRC +', alpha = 0.0, offset=-2.5, name='FeSTOUV_Fe_cp_range', folder='./')
-otf(start=690, end=750, time=2, delay=10, mode='CIRC -', alpha = 0.0, offset=-2.5, name='FeSTOUV_Fe_cm_range', folder='./')
-
\ No newline at end of file
+otf2(start=520, end=570, time=5, delay=10, mode='LINEAR', alpha=0.0, offset=-1.0, name='test')
\ No newline at end of file
diff --git a/script/test_TFY.py b/script/test_TFY.py
new file mode 100644
index 0000000..0199d71
--- /dev/null
+++ b/script/test_TFY.py
@@ -0,0 +1 @@
+otf2(start=705, end=715, time=2, delay=10, mode='LINEAR', alpha=0.0, offset=-1.0, name='TFY_test2')
\ No newline at end of file
diff --git a/script/test_highE.py b/script/test_highE.py
new file mode 100644
index 0000000..1ae67b2
--- /dev/null
+++ b/script/test_highE.py
@@ -0,0 +1 @@
+otf2(start=1067, end=1070, time=1, delay=2, mode='LINEAR', alpha=0.0, offset=-1.0, name='test_highE')
\ No newline at end of file