diff --git a/config/config.properties b/config/config.properties
index 8628c57..19682fa 100644
--- a/config/config.properties
+++ b/config/config.properties
@@ -1,25 +1,18 @@
-#Tue Feb 18 13:59:45 CET 2020
-imageSourcesFile={config}/imaging.properties
-autoSaveScanData=true
-simulation=false
-commandExecutionEvents=false
-logDaysToLive=50
-userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
-logLevelConsole=Off
-scanStreamerPort=-1
-parallelInitialization=false
-scanStreamingPort=-1
-devicePoolFile={config}/devices.properties
-versionTrackingManual=true
+#Tue Aug 11 09:21:15 CEST 2020
hostName=null
userManagement=false
+imageSourcesFile={config}/imaging.properties
instanceName=
+autoSaveScanData=true
+simulation=false
dataServerPort=-1
hideServerMessages=false
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}
serverEnabled=false
+commandExecutionEvents=false
+logDaysToLive=50
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
@@ -30,11 +23,19 @@ dataLayout=fda
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=true
notificationLevel=Error
+userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\://d.psi.ch | d.psi.ch | users.psi
+logLevelConsole=Off
terminalPort=3579
tasksFile={config}/tasks.properties
+scanStreamerPort=-1
+dataScanSaveSetpoints=false
+parallelInitialization=false
+scanStreamingPort=-1
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
+devicePoolFile={config}/devices.properties
scriptType=py
+versionTrackingManual=true
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07ma.git
dataProvider=fda
saveCommandStatistics=false
diff --git a/config/energy_scan.properties b/config/energy_scan.properties
index bf00032..828990d 100644
--- a/config/energy_scan.properties
+++ b/config/energy_scan.properties
@@ -1,5 +1,6 @@
Al=1545.0;1610.0;3.0;5.0;-7.0;-1.5;0.0;0.0
C=250.0;350.0;2.0;5.0;0.0;0.0;0.0;0.0
+Ce=870.0;910.0;2.0;0.0;0.0;0.0;0.0;0.0
Co=760.0;820.0;3.0;10.0;0.0;2.0;0.0;0.0
Cr=565.0;595.0;3.0;5.0;-0.5;1.0;5.6;0.6
Cu=925.0;965.0;2.0;0.0;0.0;0.0;0.0;0.0
@@ -9,6 +10,7 @@ Mn=630.0;685.0;2.0;5.0;0.0;0.0;0.0;0.0
Ni=840.0;885.0;2.0;0.0;0.0;0.0;0.0;0.0
O=530.0;550.0;2.0;0.0;0.0;0.0;0.0;0.0
Ru=440.0;510.0;3.0;0.0;-1.0;0.0;0.0;0.0
+Sm=1070.0;1125.0;3.0;0.0;0.0;0.0;0.0;0.0
Ta=1700.0;1820.0;3.0;10.0;-11.0;-5.5;4.0;4.0
Tb=1215.0;1300.0;3.0;10.0;-7.5;-3.5;0.0;0.0
Ti=450.0;485.0;2.0;10.0;0.0;2.0;2.0;2.0
diff --git a/config/harmonic_scan_energies.properties b/config/harmonic_scan_energies.properties
new file mode 100644
index 0000000..fc237cb
--- /dev/null
+++ b/config/harmonic_scan_energies.properties
@@ -0,0 +1,7 @@
+Ce=890.0
+Cr=580.0
+Dy=1310.0
+Er=1400.0
+Fe=705.0
+Sm=1110.0
+V=520.0
diff --git a/config/harmonic_scan_offsets.properties b/config/harmonic_scan_offsets.properties
new file mode 100644
index 0000000..dd28b29
--- /dev/null
+++ b/config/harmonic_scan_offsets.properties
@@ -0,0 +1,25 @@
+#Fri Jul 10 10:28:13 CEST 2020
+V-C-=1.0 06.07.20 08\:57
+V-LV=2.5 06.07.20 09\:09
+Er-C+=-4.5 04.07.20 17\:02
+Er-C-=-1.5 04.07.20 17\:06
+Er-LV=7.0 04.07.20 17\:12
+Dy-C+=-4.5 05.07.20 22\:04
+Dy-C-=-1.5 05.07.20 22\:05
+Dy-LV=6.0 05.07.20 12\:53
+Dy-LH=6.0 05.07.20 12\:51
+Cr-C+=0.0 06.07.20 16\:36
+Fe-LH=2.5 10.07.20 10\:28
+Ce-LV=4.5 09.07.20 19\:03
+Cr-C-=1.5 06.07.20 16\:42
+Sm-LH=4.5 09.07.20 17\:20
+Fe-C-=2.0 05.07.20 22\:58
+Fe-LV=3.5 10.07.20 10\:25
+V-LH=2.5 06.07.20 09\:07
+V-C+=0.0 06.07.20 08\:56
+Ce-LH=5.0 09.07.20 18\:39
+Er_C+=-4.3 30.06.20 21\:58
+Er-LH=6.5 04.07.20 17\:10
+Sm-C-=-2.0 09.07.20 17\:19
+Sm-LV=5.0 09.07.20 19\:11
+Fe-C+=1.0 04.07.20 10\:01
diff --git a/config/plugins.properties b/config/plugins.properties
index f0b5618..642ca47 100644
--- a/config/plugins.properties
+++ b/config/plugins.properties
@@ -1,3 +1,4 @@
importer.java=enabled
EnergyScan.java=enabled
HystScan.java=enabled
+HarmonicScan.java=enabled
diff --git a/config/settings.properties b/config/settings.properties
new file mode 100644
index 0000000..e8f799d
--- /dev/null
+++ b/config/settings.properties
@@ -0,0 +1,2 @@
+#Tue Aug 11 09:21:16 CEST 2020
+FdaBrowser=true
diff --git a/config/variables.properties b/config/variables.properties
index 69d7cc0..dc9ddcd 100644
--- a/config/variables.properties
+++ b/config/variables.properties
@@ -1,2 +1,2 @@
-#Sun Apr 19 01:15:13 CEST 2020
-FileSequentialNumber=3724
+#Mon Aug 10 00:23:04 CEST 2020
+FileSequentialNumber=5831
diff --git a/devices/m1.properties b/devices/m1.properties
index 7ab77fa..89566f8 100644
--- a/devices/m1.properties
+++ b/devices/m1.properties
@@ -1,15 +1,17 @@
-#Fri Nov 23 10:44:58 CET 2018
-accessType=ReadWrite
-defaultSpeed=1.0
-estbilizationDelay=0
-maxSpeed=10.0
-maxValue=10.0
-minSpeed=0.1
-minValue=-10.0
+#Tue Aug 11 09:23:30 CEST 2020
offset=0.0
+maxValue=10.0
precision=2
-resolution=NaN
rotation=false
scale=1.0
+estbilizationDelay=0
+maxSpeed=10.0
+resolution=NaN
+accessType=ReadWrite
startRetries=1
+minValue=-10.0
unit=mm
+defaultSpeed=1.0
+sign_bit=0
+monitorByPosition=false
+minSpeed=0.1
diff --git a/devices/m2.properties b/devices/m2.properties
index 7ab77fa..89566f8 100644
--- a/devices/m2.properties
+++ b/devices/m2.properties
@@ -1,15 +1,17 @@
-#Fri Nov 23 10:44:58 CET 2018
-accessType=ReadWrite
-defaultSpeed=1.0
-estbilizationDelay=0
-maxSpeed=10.0
-maxValue=10.0
-minSpeed=0.1
-minValue=-10.0
+#Tue Aug 11 09:23:30 CEST 2020
offset=0.0
+maxValue=10.0
precision=2
-resolution=NaN
rotation=false
scale=1.0
+estbilizationDelay=0
+maxSpeed=10.0
+resolution=NaN
+accessType=ReadWrite
startRetries=1
+minValue=-10.0
unit=mm
+defaultSpeed=1.0
+sign_bit=0
+monitorByPosition=false
+minSpeed=0.1
diff --git a/devices/p1.properties b/devices/p1.properties
index 08bab25..ce3ad08 100644
--- a/devices/p1.properties
+++ b/devices/p1.properties
@@ -1,9 +1,10 @@
-#Fri Nov 23 10:44:58 CET 2018
-maxValue=1000.0
+#Tue Aug 11 09:23:30 CEST 2020
minValue=0.0
-offset=0.0
-precision=-1
-resolution=NaN
-rotation=false
-scale=1.0
unit=mm
+offset=0.0
+maxValue=1000.0
+precision=-1
+rotation=false
+sign_bit=0
+scale=1.0
+resolution=NaN
diff --git a/devices/src1.properties b/devices/src1.properties
index d7115f5..1f51a16 100644
--- a/devices/src1.properties
+++ b/devices/src1.properties
@@ -1,28 +1,29 @@
-#Thu Dec 22 16:38:19 CET 2016
-colormap=Temperature
-colormapAutomatic=true
-colormapMax=255.0
-colormapMin=0.0
-dataMonitoring=false
-dataPolling=100
-flipHorizontally=false
-flipVertically=false
-grayscale=false
-invert=false
-pollingBackground=false
-pollingInterval=0
-rescaleFactor=1.0
-rescaleOffset=0.0
-roiHeight=-1
-roiWidth=-1
-roiX=0
-roiY=0
-rotation=0.0
-rotationCrop=false
-scale=1.0
-spatialCalOffsetX=NaN
+#Tue Aug 11 09:23:30 CEST 2020
spatialCalOffsetY=NaN
+spatialCalOffsetX=NaN
+dataPolling=100
+pollingInterval=0
+colormapLogarithmic=false
+scale=1.0
+grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
+colormapMax=255.0
+rescaleOffset=0.0
+roiWidth=-1
+colormap=Temperature
+pollingBackground=false
+invert=false
+colormapMin=0.0
+rotation=0.0
+rotationCrop=false
+rescaleFactor=1.0
spatialCalUnits=mm
+flipVertically=false
+roiHeight=-1
+flipHorizontally=false
+colormapAutomatic=true
+dataMonitoring=false
+roiY=0
+roiX=0
transpose=false
diff --git a/devices/src2.properties b/devices/src2.properties
index b265dda..0c2552b 100644
--- a/devices/src2.properties
+++ b/devices/src2.properties
@@ -1,28 +1,29 @@
-#Thu Dec 22 16:38:19 CET 2016
-colormap=Grayscale
-colormapAutomatic=true
-colormapMax=255.0
-colormapMin=0.0
-dataMonitoring=false
-dataPolling=100
-flipHorizontally=false
-flipVertically=false
-grayscale=false
-invert=false
-pollingBackground=false
-pollingInterval=0
-rescaleFactor=1.0
-rescaleOffset=0.0
-roiHeight=-1
-roiWidth=-1
-roiX=0
-roiY=0
-rotation=0.0
-rotationCrop=false
-scale=1.0
-spatialCalOffsetX=NaN
+#Tue Aug 11 09:23:30 CEST 2020
spatialCalOffsetY=NaN
+spatialCalOffsetX=NaN
+dataPolling=100
+pollingInterval=0
+colormapLogarithmic=false
+scale=1.0
+grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
+colormapMax=255.0
+rescaleOffset=0.0
+roiWidth=-1
+colormap=Grayscale
+pollingBackground=false
+invert=false
+colormapMin=0.0
+rotation=0.0
+rotationCrop=false
+rescaleFactor=1.0
spatialCalUnits=mm
+flipVertically=false
+roiHeight=-1
+flipHorizontally=false
+colormapAutomatic=true
+dataMonitoring=false
+roiY=0
+roiX=0
transpose=false
diff --git a/plugins/HarmonicScan.form b/plugins/HarmonicScan.form
new file mode 100644
index 0000000..8341808
--- /dev/null
+++ b/plugins/HarmonicScan.form
@@ -0,0 +1,399 @@
+
+
+
diff --git a/plugins/HarmonicScan.java b/plugins/HarmonicScan.java
new file mode 100644
index 0000000..148a984
--- /dev/null
+++ b/plugins/HarmonicScan.java
@@ -0,0 +1,587 @@
+/*
+ * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
+ */
+
+import ch.psi.pshell.core.Context.ContextStateException;
+import ch.psi.pshell.epics.Epics;
+import ch.psi.pshell.ui.Panel;
+import ch.psi.utils.Chrono;
+import ch.psi.utils.State;
+import ch.psi.utils.swing.DsvEditor;
+import ch.psi.utils.swing.Editor.EditorDialog;
+import ch.psi.utils.swing.SwingUtils;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Properties;
+import javax.swing.DefaultComboBoxModel;
+
+/**
+ *
+ */
+public class HarmonicScan extends Panel {
+
+ public HarmonicScan() {
+ initComponents();
+ }
+
+ @Override
+ public void onInitialize(int runCount) {
+ super.onInitialize(runCount);
+ try {
+ setElement();
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ loadConfig();
+ }
+
+ @Override
+ public void onStateChange(State state, State former) {
+ setEnabled(state == State.Ready);
+ }
+
+ @Override
+ public void onExecutedFile(String fileName, Object result) {
+ }
+
+ Path getEnergyTableFile() {
+ return Paths.get(getContext().getSetup().getConfigPath(), "harmonic_scan_energies.properties");
+ }
+
+ Path getOffsetTableFile() {
+ return Paths.get(getContext().getSetup().getConfigPath(), "harmonic_scan_offsets.properties");
+ }
+
+ @Override
+ public void setEnabled(boolean value) {
+ buttonExecute.setEnabled(value);
+ comboElement.setEnabled(value);
+ comboPolarizarion.setEnabled(value);
+ buttonConfigure.setEnabled(value);
+ }
+
+ boolean loadingConfig;
+ void loadConfig() {
+ try {
+ loadingConfig = true;
+ DefaultComboBoxModel model = (DefaultComboBoxModel) comboElement.getModel();
+ model.removeAllElements();
+ for (String line : Files.readAllLines(getEnergyTableFile())) {
+ if ((line != null) && (!line.trim().isEmpty())) {
+ String[] tokens = line.split("=");
+ if (tokens.length > 0) {
+ model.addElement(tokens[0].trim());
+ }
+ }
+ }
+ } catch (Exception ex) {
+ } finally{
+ loadingConfig = false;
+ }
+
+ }
+
+ void setElement() throws IOException {
+ Properties prop = new Properties();
+ prop.load(new FileInputStream(getEnergyTableFile().toFile()));
+ String element = comboElement.getSelectedItem().toString();
+ String val = prop.getProperty(element);
+ String[] tokens = val.split(" ");
+ if (tokens.length != 1) {
+ throw new IOException("Invalid file format: " + tokens.length);
+ }
+ spinnerEnergy.setValue(Double.valueOf(tokens[0].trim()));
+
+ getOffsetTable();
+ }
+
+ void setPolarizarion() throws IOException {
+ getOffsetTable();
+ }
+
+ String getOffsetEntry() {
+ String element = comboElement.getSelectedItem().toString().trim();
+ String polarization = comboPolarizarion.getSelectedItem().toString().trim();
+ return element + "-" + polarization;
+ }
+
+ EditorDialog dlgConfig;
+
+ void editEnergyTable() throws IOException {
+ if ((dlgConfig == null) || (!dlgConfig.isShowing())) {
+ String[] columns = new String[]{"Element", "Energy"};
+ Class[] types = new Class[]{String.class, Double.class};
+ DsvEditor editor = new DsvEditor(columns, types, " ");
+ dlgConfig = editor.getDialog(getView(), false);
+ editor.load(getEnergyTableFile().toString());
+ editor.setTitle("Harmonic Scan Energy Table");
+ dlgConfig.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosed(WindowEvent e) {
+ try{
+ Object cur = comboElement.getSelectedItem();
+ loadConfig();
+ try{
+ comboElement.setSelectedItem(cur);
+ } catch(Exception ex){
+ }
+ } catch(Exception ex){
+ SwingUtils.showException(HarmonicScan.this, ex);
+ }
+ }
+ });
+ }
+ dlgConfig.setSize(640, 320);
+ showWindow(dlgConfig);
+ }
+
+ void getOffsetTable() throws IOException {
+ textLastOffset.setText("");
+ textTimestamp.setText("");
+
+ try {
+ Properties prop = new Properties();
+ prop.load(new FileInputStream(getOffsetTableFile().toFile()));
+ String val = prop.getProperty(getOffsetEntry());
+ if ((val != null) && !val.isEmpty()) {
+ String[] tokens = val.split(" ");
+ if (tokens.length != 3) {
+ throw new IOException("Invalid file format: " + tokens.length);
+ }
+ textLastOffset.setText(Double.valueOf(tokens[0].trim()).toString());
+ textTimestamp.setText(tokens[1].trim() + " " + tokens[2].trim());
+ }
+ } catch (FileNotFoundException ex) {
+
+ }
+ }
+
+ void setOffsetTable(double offset) throws IOException {
+ Properties prop = new Properties();
+ prop.load(new FileInputStream(getOffsetTableFile().toFile()));
+ String timestamp = Chrono.getTimeStr(System.currentTimeMillis(), "dd.MM.YY HH:mm");
+ prop.setProperty(getOffsetEntry(), offset + " " + timestamp);
+ try ( FileOutputStream out = new FileOutputStream(getOffsetTableFile().toFile())) {
+ prop.store(out, null);
+ }
+
+ textLastOffset.setText(String.valueOf(offset));
+ textTimestamp.setText(timestamp);
+ }
+
+ void run() throws ContextStateException {
+ textScanReturn.setText("");
+ buttonApply.setEnabled(false);
+
+ HashMap args = new HashMap();
+ args.put("ID_ENERGY", (Double) spinnerEnergy.getValue());
+ args.put("HALFWIDTH", (Double) spinnerHalfwidth.getValue());
+ args.put("STEP", (Double) spinnerStep.getValue());
+ args.put("MODE", comboPolarizarion.getSelectedItem().toString());
+
+ runAsync("HarmonicScan", args).handle((ret, ex) -> {
+ if ((ex == null) && (ret != null)) {
+ textScanReturn.setText(String.valueOf(ret));
+ try {
+ Double val = (Double) ret;
+ buttonApply.setEnabled(true);
+ } catch (Exception e) {
+ }
+ }
+ return ret;
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ buttonGroupPlot = new javax.swing.ButtonGroup();
+ jPanel1 = new javax.swing.JPanel();
+ comboElement = new javax.swing.JComboBox();
+ buttonConfigure = new javax.swing.JButton();
+ jLabel10 = new javax.swing.JLabel();
+ jLabel11 = new javax.swing.JLabel();
+ comboPolarizarion = new javax.swing.JComboBox();
+ jLabel1 = new javax.swing.JLabel();
+ spinnerEnergy = new javax.swing.JSpinner();
+ jLabel2 = new javax.swing.JLabel();
+ spinnerHalfwidth = new javax.swing.JSpinner();
+ jLabel3 = new javax.swing.JLabel();
+ spinnerStep = new javax.swing.JSpinner();
+ jPanel3 = new javax.swing.JPanel();
+ buttonExecute = new javax.swing.JButton();
+ buttonAbort = new javax.swing.JButton();
+ jPanel2 = new javax.swing.JPanel();
+ jLabel5 = new javax.swing.JLabel();
+ textLastOffset = new javax.swing.JTextField();
+ textTimestamp = new javax.swing.JTextField();
+ jLabel4 = new javax.swing.JLabel();
+ buttonSet = new javax.swing.JButton();
+ jLabel6 = new javax.swing.JLabel();
+ valueOffset = new ch.psi.pshell.swing.DeviceValuePanel();
+ jLabel7 = new javax.swing.JLabel();
+ textScanReturn = new javax.swing.JTextField();
+ buttonApply = new javax.swing.JButton();
+
+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Setup"));
+
+ comboElement.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ comboElementActionPerformed(evt);
+ }
+ });
+
+ buttonConfigure.setText("Configure");
+ buttonConfigure.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonConfigureActionPerformed(evt);
+ }
+ });
+
+ jLabel10.setText("Element:");
+
+ jLabel11.setText("Polarization:");
+
+ comboPolarizarion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "C+", "C-", "LH", "LV" }));
+ comboPolarizarion.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ comboPolarizarionActionPerformed(evt);
+ }
+ });
+
+ jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel1.setText("Energy");
+
+ spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(700.0d, 0.0d, 9999.0d, 1.0d));
+
+ jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel2.setText("Halfwidth:");
+
+ spinnerHalfwidth.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 9999.0d, 1.0d));
+
+ jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel3.setText("Step:");
+
+ spinnerStep.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.0d, 9999.0d, 1.0d));
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(comboElement, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(comboPolarizarion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonConfigure)
+ .addGap(18, 18, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(spinnerHalfwidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfigure, comboElement, comboPolarizarion});
+
+ jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerEnergy, spinnerHalfwidth, spinnerStep});
+
+ jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3});
+
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(comboElement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel10)
+ .addComponent(jLabel1)
+ .addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonConfigure))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(spinnerHalfwidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(comboPolarizarion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel11)))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
+
+ buttonExecute.setText("Start");
+ buttonExecute.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonExecuteActionPerformed(evt);
+ }
+ });
+
+ buttonAbort.setText("Abort");
+ buttonAbort.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonAbortActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addContainerGap(22, Short.MAX_VALUE)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonExecute, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(22, Short.MAX_VALUE))
+ );
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonExecute)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonAbort)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Offset"));
+
+ jLabel5.setText("Timestamp:");
+
+ textLastOffset.setEditable(false);
+ textLastOffset.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ textTimestamp.setEditable(false);
+ textTimestamp.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ jLabel4.setText("Saved Value:");
+
+ buttonSet.setText("Set Manually");
+ buttonSet.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonSetActionPerformed(evt);
+ }
+ });
+
+ jLabel6.setText("Current Offset:");
+
+ valueOffset.setDeviceName("pol_offset");
+
+ jLabel7.setText("Scan Return:");
+
+ textScanReturn.setEditable(false);
+ textScanReturn.setHorizontalAlignment(javax.swing.JTextField.CENTER);
+
+ buttonApply.setText("Apply");
+ buttonApply.setEnabled(false);
+ buttonApply.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonApplyActionPerformed(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()
+ .addGap(23, 23, 23)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel5)
+ .addComponent(jLabel6)
+ .addComponent(jLabel4)
+ .addComponent(jLabel7))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(textLastOffset, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
+ .addComponent(textTimestamp))
+ .addGap(18, 18, 18)
+ .addComponent(buttonSet))
+ .addComponent(valueOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(textScanReturn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(buttonApply)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonSet});
+
+ jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textLastOffset, textScanReturn, textTimestamp, valueOffset});
+
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(valueOffset, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, Short.MAX_VALUE)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(textLastOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonSet))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel5)
+ .addComponent(textTimestamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, Short.MAX_VALUE)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(textScanReturn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel7)
+ .addComponent(buttonApply))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(2, 2, 2)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ }// //GEN-END:initComponents
+
+ private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
+ try {
+ run();
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonExecuteActionPerformed
+
+ private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
+ try {
+ abort();
+ } catch (InterruptedException ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonAbortActionPerformed
+
+ private void comboElementActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboElementActionPerformed
+ try {
+ if (!loadingConfig){
+ setElement();
+ }
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_comboElementActionPerformed
+
+ private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed
+ try {
+ editEnergyTable();
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonConfigureActionPerformed
+
+ private void buttonSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetActionPerformed
+
+ try {
+ String ret = SwingUtils.getString(this, "Enter persisted value for " + getOffsetEntry(), textLastOffset.getText());
+ if ((ret != null) && (!ret.trim().isEmpty())) {
+ setOffsetTable(Double.valueOf(ret));
+ }
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonSetActionPerformed
+
+ private void comboPolarizarionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPolarizarionActionPerformed
+ try {
+ setPolarizarion();
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_comboPolarizarionActionPerformed
+
+ private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
+ try {
+ setOffsetTable(Double.valueOf(textScanReturn.getText()));
+ } catch (Exception ex) {
+ SwingUtils.showException(this, ex);
+ }
+ }//GEN-LAST:event_buttonApplyActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton buttonAbort;
+ private javax.swing.JButton buttonApply;
+ private javax.swing.JButton buttonConfigure;
+ private javax.swing.JButton buttonExecute;
+ private javax.swing.ButtonGroup buttonGroupPlot;
+ private javax.swing.JButton buttonSet;
+ private javax.swing.JComboBox comboElement;
+ private javax.swing.JComboBox comboPolarizarion;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JSpinner spinnerEnergy;
+ private javax.swing.JSpinner spinnerHalfwidth;
+ private javax.swing.JSpinner spinnerStep;
+ private javax.swing.JTextField textLastOffset;
+ private javax.swing.JTextField textScanReturn;
+ private javax.swing.JTextField textTimestamp;
+ private ch.psi.pshell.swing.DeviceValuePanel valueOffset;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/script/EnergyScan.py b/script/EnergyScan.py
index 6e49df2..de9127e 100644
--- a/script/EnergyScan.py
+++ b/script/EnergyScan.py
@@ -23,7 +23,7 @@ edata.initialize()
p=None
def start_plot():
global p
- p = plot([None, None, None,None, None], ["TEY", "TFY", "TEYraw", "TFYraw", "I0"])
+ p = plot([None, None, None,None, None], ["TEY_norm", "diode_norm", "TEY_raw", "diode_raw", "I0"])
def _update_plots(p, x, s0, s1, s2, s3, s4):
p[0].getSeries(0).setData(x, s0)
@@ -141,8 +141,7 @@ while True:
print "It is done."
############
"""
-
-
+caput('X07MA-PGM:CERBK.N',10) # set energy readback averaging to 10 pts
caput('E1', E1)
#print "caput E1" #add for debug
diff --git a/script/HarmonicScan.py b/script/HarmonicScan.py
new file mode 100644
index 0000000..13a0abd
--- /dev/null
+++ b/script/HarmonicScan.py
@@ -0,0 +1,50 @@
+import java.awt.Color as Color
+if get_exec_pars().source == CommandSource.ui:
+ ID_ENERGY = 1250
+ HALFWIDTH = 10
+ STEP = 0.5
+ MODE = "Manual"
+
+DRY_MODE = False
+
+
+try:
+ if not DRY_MODE:
+ caput('X07MA-PHS-E:OPT', 'PGM')
+ energy_id.write(ID_ENERGY)
+ wait_device(energy_done, 1 )
+ sensors = [signal_i0, signal_tey, 'ca://X07MA-PC-K428:2:getTotalGain', energy]
+
+ if MODE =="C+":
+ set_pol_cplus()
+ if MODE =="C-":
+ set_pol_cminus()
+ if MODE == "LH":
+ set_pol_lin(0.0)
+ elif MODE == "LV":
+ set_pol_lin(90.0)
+ current_offset = pol_offset.take()
+
+ else:
+ sensors = [sin, energy]
+ current_offset = 0.0
+
+ ret = lscan(energy, sensors, ID_ENERGY-HALFWIDTH, ID_ENERGY+HALFWIDTH, STEP, latency = 0.3)
+
+ xdata = ret.getPositions(0)
+ ydata = ret.getReadable(0)
+ ymin = min(ydata)
+ e0 = xdata[ydata.index(min(ydata))]
+ new_offset =ID_ENERGY - e0 + current_offset
+ print "E0=",e0," ymin=",ymin," Offset=",new_offset
+ p=get_plots()[0]
+ p.addMarker(e0, p.AxisId.X, "%0.2f" % e0, Color.BLUE)
+ set_return(new_offset)
+
+except:
+ print("Aborting...")
+ raise
+finally:
+ if not DRY_MODE:
+ caput('X07MA-PHS-E:OPT', 'PGM+ID')
+
diff --git a/script/HorizontalScan_infocus.py b/script/HorizontalScan_infocus.py
index d1dfff9..f34949e 100644
--- a/script/HorizontalScan_infocus.py
+++ b/script/HorizontalScan_infocus.py
@@ -1,23 +1,24 @@
#####################
## INPUT PARAMETERS##
-#POS_START = 158.4 #Min = 150.0
-#POS_END = 159.9 #Max = 170.0
-POS_START = 157.0 #Min = 150.0
-POS_END = 162.0 #Max = 170.0
+
+POS_START = 156.0 #Minn = 150.0
+POS_END = 162 #Max = 170.0
POS_STEP = 0.25
#ENERGIES = [363.2, 356.0]# Nb
-#ENERGIES = [774.0] # Co
+#ENERGIES = [774. 0] # Co
#ENERGIES = [577.0, 573.0] # Cr
#ENERGIES = [708.3,704.0] # Fe
#ENERGIES = [928.4, 925.0 ] # Cu
#ENERGIES = [700.0]
#ENERGIES = [706.7,708.3,704.0] # Fe
-ENERGIES = [851.3,845]#[851.2,848.0] # Ni
+#ENERGIES = [851.3,845]#[851.2,848.0] # Ni
#ENERGIES = [280,292] #C
-#ENERGIES = [772,776.7] # Co
+#ENERGIES = [776.9,774] # Co
#ENERGIES = [642.0,630.0] # Mn
+ENERGIES = [1067, 1076 ] # Sm
+#ENERGIES = [870, 880.3 ] # Ce
diff --git a/script/HorizontalScan_out_of_focus.py b/script/HorizontalScan_out_of_focus.py
index ffca9a1..5a4ce71 100644
--- a/script/HorizontalScan_out_of_focus.py
+++ b/script/HorizontalScan_out_of_focus.py
@@ -1,27 +1,30 @@
#####################
## INPUT PARAMATERS##
#open_valve()
-POS_START = 104 #Min = 98.0
-POS_END = 114 #Max = 118.0
-POS_STEP = 0.25
+POS_START = 106 #Min = 98.0
+POS_END = 110 #Max = 118.0
+POS_STEP = 0.5
+
+#POS_START = 106
+#POS_END = 116
#"""
-#POS_START =106 #Min = 98.0
-#POS_END = 108.7
+#POS_START =108 #Min = 98.0
+#POS_END = 115
#Max = 118.0
#POS_STEP = 0.1
#"""
#ENERGIES = [1344.5, 1338] # Ho edge, pre-edge
#ENERGIES = [1289.5, 1280] # Dy edge, pre-edge
-#ENERGIES = [459,455] #Ti
+#ENERGIES = [459.5,455] #Ti
#ENERGIES = [363.2, 356.0]# Nb
#ENERGIES = [260.0]# C
-#ENERGIES = [285.0,280]# C
+#ENERGIES = [285.2,280]# C
#ENERGIES = [395,390] #Mo
#ENERGIES = [780.0,777.0]
-#ENERGIES = [396.0] # N
+#ENERGIES = [397.6, 395.0] # N
#ENERGIES = [385.0]# C
-#ENERGIES = [576.3, 560.0] #Cr
+#ENERGIES = [570.0,576.3] #Cr
#ENERGIES = [1850, 1820]# Si
#ENERGIES = [530] #O
#ENERGIES = [397.7,392] # Pc
@@ -30,14 +33,16 @@ POS_STEP = 0.25
#ENERGIES = [642.0,630.0] # Mn
#ENERGIES = [463,457]
#ENERGIES = [637.8,638.9,640.1,636.0] # Mn
-#ENERGIES = [700.0] # Fe
-#ENERGIES = [928.2, 925] #CuO
+#ENERGIES = [700.0,708.5] # Fe
+#ENERGIES = [928.4, 925] #Cu
#ENERGIES = [931.7, 925] #Cu
-#ENERGIES = [929] #Cu
+#ENERGIES = [929.3] #Cu
+#ENERGIES = [927, 929] #Cu
+#ENERGIES = [928.5, 931] #CuGly special
#ENERGIES = [402, 397] # Ta
#ENERGIES = [777.3,774] # Co
#ENERGIES = [778] # Co
-#ENERGIES = [851.3,845.0] # Ni
+#ENERGIES = [848.5, 845] # La
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1234.5, 1225 ] # Tb
#ENERGIES = [976, 970] # Nd
@@ -54,9 +59,9 @@ POS_STEP = 0.25
#ENERGIES = [1456.9, 1450 ] # Tm
#ENERGIES = [931.7, 925.0] # Cu metal
#ENERGIES = [928.4 ] # Cu1
-#ENERGIES = [700.0, 708.0] # Fe
+ENERGIES = [708.3, 700.0] # Fe
#ENERGIES = [696.7, 680.0] # F
-ENERGIES = [692.0] # F
+#ENERGIES = [692.0] # F
#ENERGIES = [782.50, 775.0] # Ba
#ENERGIES = [782.50] # Ba
#ENERGIES = [1289, 1280] # Dy edge
@@ -66,6 +71,9 @@ ENERGIES = [692.0] # F
#ENERGIES = [850.9, 849 ] # Ni
#ENERGIES = [516, 503] # V
#ENERGIES = [1455,1420] # Se
+#ENERGIES = [1181.0,1173.0]
+#ENERGIES = [285.1, 280.0]# C
+#ENERGIES = [1650.0]
#####################
open_valve()
@@ -100,4 +108,8 @@ def before_pass(pass_num):
ret= lscan(sample_hor,sensors, POS_START, POS_END, POS_STEP, latency = 0.0, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
+#if name is None:
+# name=get_scan_filename()
+#print "Created data file: " + str(name)
+
close_valve()
diff --git a/script/HystScan_ESR.py b/script/HystScan_ESR.py
new file mode 100644
index 0000000..15e3ed4
--- /dev/null
+++ b/script/HystScan_ESR.py
@@ -0,0 +1,196 @@
+#Parameters
+"""
+FIELD = "Hx"
+START_FIELD = -0.1
+END_FIELD = 0.1
+ENERGIES = (707.90, 703.90)
+RAMP_RATE = 0.2
+ENERGY_CHANGE_SLEEP = 0.5
+MODE = 'CIRC +'
+OFFSET = -1.0
+"""
+
+
+iPS = False # false for old power supply, True for new (Oxford Instr) supply
+
+#close_shutter_at_zero = False # True to close shutter during B field scan when it is close to 0 T
+#signal_field_analog_x
+
+
+if iPS == True:
+ caput('X07MA-ES1-IPS:RAMP-ENBL', 1) # enable non-overshoot mode
+
+FIELD_PRECISION = 0.01
+if FIELD == field_z: FIELD = "Hz"
+field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
+field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
+ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
+
+#Pre-actions
+#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
+
+if NO_BEAM_CHECK == False:
+ wait_beam()
+if MODE is not None:
+ pol_mode.write(MODE)
+if OFFSET is not None:
+ pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
+caputq('X07MA-PC:CSCALER.INPB', '1')
+
+# open shutter
+caput('X07MA-FE-PH1:CLOSE4BL',1)
+cawait('X07MA-FE-PH1:MS2', 1)
+print "OK"
+
+#if RAMP_RATE is not None:
+# ramp_rate.write(RAMP_RATE)
+# ramp_rate.waitInPosition(RAMP_RATE,10000)
+
+
+
+if len(ENERGIES) ==2:
+ # dif_series = plot([],"Dif", get_context()="Dif")[0].getSeries(0)
+ dif_series = plot([],"Dif")[0].getSeries(0)
+else:
+ dif_series = None
+
+set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
+set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
+
+field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
+scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
+ field_var,'ESR_extrachannel', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
+scan.start()
+
+write_logs()
+
+print "Waiting for start field"
+
+if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
+ ramp_rate.write(2.0)
+ field.write(START_FIELD)
+ if iPS == True:
+ caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
+
+ if field_done is None:
+ #ramp_rate.write(2.0)
+ ramp_rate.waitInPosition(2.0,10000)
+ time.sleep(1.0)
+ caput("X07MA-ES1-IPS:ACTION", 1)
+ time.sleep(3.0)
+ wait_device_in_range(field, START_FIELD, FIELD_PRECISION)
+ print "Waiting field done..."
+ while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
+ time.sleep(0.1)
+ print "Done waiting"
+ else:
+ time.sleep(3.0)
+ wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
+
+
+#open_valve(2.0)
+
+
+
+print "Set energy..."
+setpoint2 = ENERGIES[0]
+print setpoint2
+energy.write(setpoint2)
+sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+wait_device(energy_done, 1 )
+
+wait_device(pol_done, "DONE")
+
+
+#if WAIT_STABLE_TEMPERATURE == True:
+# wait_temp()
+
+
+if RAMP_RATE is not None:
+ ramp_rate.write(RAMP_RATE)
+ ramp_rate.waitInPosition(RAMP_RATE,10000)
+
+print "Set end field"
+field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
+
+if iPS == True:
+ caput("X07MA-PC-MAG:X:DMD",float(END_FIELD))
+
+
+
+index = 0
+while(True):
+ #Dimension 2START_FIELD = -0.2
+ #ArrayPositioner Energy
+ for setpoint2 in ENERGIES:
+ if len (ENERGIES)>1:
+ #Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
+ energy.write(setpoint2)
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+ else:
+ sleep( 0.25 ) # TODO: Check
+
+ #TODO: change to Controlled variable?
+ readback2 = energy_readback.read() #EnergyReadback.get()
+ if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
+# raise Exception('Energy could not be set to the value ' + str(setpoint2))
+ #print 'Energy could not be set to the value, try again. ' + str(setpoint2)
+ energy.write(setpoint2)
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
+ #Detector field readback
+ field_readback = field.readback.read() #fieldReadback.get()
+
+ detector1 = signal_tey.read() #TEY.get()
+ detector2 = signal_i0.read() #I0.get()
+ detector3 = signal_trans.read() #trans.get()
+ detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
+ detector5 = pol_angle.read() #polAngle.get()
+ detector6 = temperature.readback.read() #temperature.get()
+ detector7 = current.read()
+ detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
+ # ESR HACK
+ detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
+
+ _tey_norm = detector1/detector2
+ _trans_norm = detector3/detector2
+
+ if dif_series is not None:
+ if setpoint2 == ENERGIES[0]:
+ first = _tey_norm
+ else:
+ dif = _tey_norm-first
+ dif_series.appendData(field_readback,dif)
+ if after_sample(): #To call check_id_error()
+ break
+ scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, _tey_norm, _trans_norm])
+
+ #if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
+ #if abs(field_readback - END_FIELDafter) < 0.007: REMOVED by Jan
+ if abs(field_readback - END_FIELD) < 0.007:
+ if iPS==True:
+ print "Waiting field done..."
+ while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
+ time.sleep(0.1)
+ print "Done waiting"
+
+ print "Field has reached target, breaking execution."
+ break
+ index = index+1
+
+scan.end()
+
+log_scan_filename()
+
+if RAMP_RATE is not None:
+ if FIELD == "Hz":
+ print "Reset ramp rate-z"
+ ramp_rate.write(0.35)
+ ramp_rate.waitInPosition(0.35,10000)
+ else:
+ print "Reset ramp rate-x"
+ ramp_rate.write(2.0)
+ ramp_rate.waitInPosition(2.0,10000)
+
diff --git a/script/I01_scan.py b/script/I01_scan.py
new file mode 100644
index 0000000..3284354
--- /dev/null
+++ b/script/I01_scan.py
@@ -0,0 +1,50 @@
+#####################
+## INPUT PARAMETERS##
+POS_START = 150
+POS_END = 175
+POS_STEP = 0.5
+
+
+#ENERGIES = [704.0,708.7] # Fe
+ENERGIES = [630] #
+
+#####################
+
+#open_valve()
+#caput("X07MA-OP-VG13:WT_SET",1)
+#time.sleep(0.1)
+
+sensors = [tey_norm, signal_tey, signal_i0, signal_trans, trans_norm, sample_hor, energy_readback]
+#sensors = [ signal_tey, signal_i0, sample_hor, energy_readback]
+#sensors_name = ['tey_norm', 'signal_tey', 'signal_i0', 'trans_norm', 'sample_hor', 'energy_readback']
+#sensors_name = ['signal_tey', 'signal_i0', 'sample_hor', 'energy_readback']
+
+
+#TODO: #Why must set range to "auto"?
+"""
+def before_pass(pass_num, scan):
+ print "Setting energy = " , ENERGIES[pass_num-1]
+ set_energy(ENERGIES[pass_num-1])
+lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency =0.5, passes = len(ENERGIES), before_pass=before_pass, range="auto")
+"""
+
+#Setting a different color for each pass: must manage plots manually
+plots = plot([None]*len(sensors), name = [d.name for d in sensors])
+for p in plots:
+ p.clear()
+ p.legendVisible = True
+
+def after_readout(record, scan):
+ for i in range(len(plots)):
+ plots[i].getSeries(plots[i].numberOfSeries-1).appendData(record.positions[0], record.values[i])
+def before_pass(pass_num):
+ en = ENERGIES[pass_num-1]
+ set_energy(en)
+ open_valve()
+ for p in plots: p.addSeries(LinePlotSeries(str(en)))
+
+ret70= lscan(gold_mesh,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
+
+
+
+close_valve()
diff --git a/script/I02_scan.py b/script/I02_scan.py
index d841c20..4ac93cb 100644
--- a/script/I02_scan.py
+++ b/script/I02_scan.py
@@ -5,7 +5,8 @@ POS_END = -60
POS_STEP = 0.5
-ENERGIES = [704.0,708.7] # Fe
+#ENERGIES = [704.0,708.7] # Fe
+ENERGIES = [630] #
#####################
diff --git a/script/TimeScan_ESR.py b/script/TimeScan_ESR.py
new file mode 100644
index 0000000..8b6b6ea
--- /dev/null
+++ b/script/TimeScan_ESR.py
@@ -0,0 +1,198 @@
+#Parameters
+"""
+FIELD = "Hx"
+START_FIELD = -0.1
+ACQPOINTS = 100
+ENERGIES = (707.90, 703.90)
+ENERGY_CHANGE_SLEEP = 2.0
+MODE = 'CIRC +'
+OFFSET = -1.0
+"""
+
+
+iPS = False # false for old power supply, True for new (Oxford Instr) supply
+
+#close_shutter_at_zero = False # True to close shutter during B field scan when it is close to 0 T
+#signal_field_analog_x
+
+
+if iPS == True:
+ caput('X07MA-ES1-IPS:RAMP-ENBL', 1) # enable non-overshoot mode
+
+FIELD_PRECISION = 0.01
+if FIELD == field_z: FIELD = "Hz"
+field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
+field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
+ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
+
+#Pre-actions
+#cawait('ACOAU-ACCU:OP-MODE', 'Light Available', type = 's')
+
+if NO_BEAM_CHECK == False:
+ wait_beam()
+if MODE is not None:
+ pol_mode.write(MODE)
+if OFFSET is not None:
+ pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
+caputq('X07MA-PC:CSCALER.INPB', '1')
+
+# open shutter
+caput('X07MA-FE-PH1:CLOSE4BL',1)
+cawait('X07MA-FE-PH1:MS2', 1)
+print "OK"
+
+#if RAMP_RATE is not None:
+# ramp_rate.write(RAMP_RATE)
+# ramp_rate.waitInPosition(RAMP_RATE,10000)
+
+
+
+if len(ENERGIES) ==2:
+ # dif_series = plot([],"Dif", get_context()="Dif")[0].getSeries(0)
+ dif_series = plot([],"Dif")[0].getSeries(0)
+else:
+ dif_series = None
+
+set_preference(Preference.ENABLED_PLOTS, ['field', 'TEY', 'trans','ESR_extrachannel'])
+#set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
+
+field_var = 'fieldAnalogZ' if (FIELD == "Hz") else 'fieldAnalogX'
+scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', \
+ field_var,'ESR_extrachannel', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
+scan.start()
+
+write_logs()
+
+print "Waiting for start field"
+
+if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
+ ramp_rate.write(2.0)
+ field.write(START_FIELD)
+ if iPS == True:
+ caput("X07MA-PC-MAG:X:DMD",float(START_FIELD))
+
+ if field_done is None:
+ #ramp_rate.write(2.0)
+ ramp_rate.waitInPosition(2.0,10000)
+ time.sleep(1.0)
+ caput("X07MA-ES1-IPS:ACTION", 1)
+ time.sleep(3.0)
+ wait_device_in_range(field, START_FIELD, FIELD_PRECISION)
+ print "Waiting field done..."
+ while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
+ time.sleep(0.1)
+ print "Done waiting"
+ else:
+ time.sleep(3.0)
+ wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
+
+
+#open_valve(2.0)
+
+
+
+print "Set energy..."
+setpoint2 = ENERGIES[0]
+print setpoint2
+energy.write(setpoint2)
+sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+wait_device(energy_done, 1 )
+
+wait_device(pol_done, "DONE")
+
+
+#if WAIT_STABLE_TEMPERATURE == True:
+# wait_temp()
+
+
+#if RAMP_RATE is not None:
+# ramp_rate.write(RAMP_RATE)
+# ramp_rate.waitInPosition(RAMP_RATE,10000)
+
+#print "Set end field"
+#field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
+
+#if iPS == True:
+ #caput("X07MA-PC-MAG:X:DMD",float(END_FIELD))
+
+
+
+index = 0
+while(True):
+ #Dimension 2START_FIELD = -0.2
+ #ArrayPositioner Energy
+ for setpoint2 in ENERGIES:
+ if len (ENERGIES)>1:
+ #Energy.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
+ energy.write(setpoint2)
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+ else:
+ sleep( 0.25 ) # TODO: Check
+
+ #TODO: change to Controlled variable?
+ readback2 = energy_readback.read() #EnergyReadback.get()
+ if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
+# raise Exception('Energy could not be set to the value ' + str(setpoint2))
+ #print 'Energy could not be set to the value, try again. ' + str(setpoint2)
+ energy.write(setpoint2)
+ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
+
+ while True: # if ABORT_ON_ID_ERROR == False, waits reading with no ID error
+ #Detector field readback
+ field_readback = field.readback.read() #fieldReadback.get()
+
+ detector1 = signal_tey.read() #TEY.get()
+ detector2 = signal_i0.read() #I0.get()
+ detector3 = signal_trans.read() #trans.get()
+ detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
+ detector5 = pol_angle.read() #polAngle.get()
+ detector6 = temperature.readback.read() #temperature.get()
+ detector7 = current.read()
+ detector8 = signal_field_analog_z.read() if FIELD =="Hz" else signal_field_analog_x.read() # fieldAnalogX.get()
+ # ESR HACK
+ detector9 = signal_field_analog_z.read() # USE ADC4 here as additional detector
+
+ _tey_norm = detector1/detector2
+ _trans_norm = detector3/detector2
+
+ if dif_series is not None:
+ if setpoint2 == ENERGIES[0]:
+ first = _tey_norm
+ else:
+ dif = _tey_norm-first
+ dif_series.appendData(field_readback,dif)
+ if after_sample(): #To call check_id_error()
+ break
+ scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, _tey_norm, _trans_norm])
+
+ #if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
+ #if abs(field_readback - END_FIELDafter) < 0.007: REMOVED by Jan
+ #if abs(field_readback - END_FIELD) < 0.007:
+ # if iPS==True:
+ # print "Waiting field done..."
+ # while caget("X07MA-ES1-IPS:OUTPUT_RBV", "i") != 0 :
+ # time.sleep(0.1)
+ # print "Done waiting"
+
+ #print "Field has reached target, breaking execution."
+ #break
+ index = index+1
+
+ if index == ACQPOINTS:
+ break
+
+scan.end()
+
+log_scan_filename()
+
+#if RAMP_RATE is not None:
+# if FIELD == "Hz":
+# print "Reset ramp rate-z"
+# ramp_rate.write(0.35)
+# ramp_rate.waitInPosition(0.35,10000)
+# else:
+# print "Reset ramp rate-x"
+# ramp_rate.write(2.0)
+# ramp_rate.waitInPosition(2.0,10000)
+
diff --git a/script/VerticalScan.py b/script/VerticalScan.py
index bce1f76..6a402fd 100644
--- a/script/VerticalScan.py
+++ b/script/VerticalScan.py
@@ -1,43 +1,52 @@
#####################
## INPUT PARAMETERS##
-#POS_START = 5
-#POS_END = 25
-#POS_STEP = 0.5
-
-POS_START = 9
-POS_END = 18
+POS_START =4
+POS_END = 27
POS_STEP = 0.5
-#ENERGIES = [532, 523]# O
+
+#POS_STEP = 0.1
+#"""
+#POS_START = 7
+#POS_END = 15
+#POS_STEP = 0.25
+#"""
+
+#ENERGIES = [532, 523]#
#ENERGIES = [363.2, 356]# Nb
#ENERGIES = [782.50, 775.0]
-#ENERGIES = [397.6, 396.0] # N
+#ENERGIES = [400.7, 396.0] # N
#ENERGIES = [401.1,403] #Mo285
#ENERGIES = [577.0, 573.0] # Cr
-#ENERGIES = [457,452] #Ti
+#ENERGIES = [459.5,452] #Ti
#ENERGIES = [692.0] # F
#ENERGIES = [696.5, 680.0] # F
#ENERGIES = [1110,1125.5] #STO
#ENERGIES = [397.7,392] # Pc
-ENERGIES = [700.0]#, 708.0] # Fe
+#ENERGIES = [708.3, 700.0] # Fe
#ENERGIES = [530] #O
-#ENERGIES = [700.0] #Fe
-
+ENERGIES = [700.0,708.0] #Fe
#ENERGIES = [931.7, 925] #Cu
-#ENERGIES = [928.2, 925] #CuO
-#ENERGIES = [929] #Cu
+#ENERGIES = [928.4, 925] #CuO
+#ENERGIES = [929.3] #Cu
+#ENERGIES = [927, 929] #Cu
+#ENERGIES = [928.5, 931] #CuGly special
#ENERGIES = [774.0] # Co
-#ENERGIES = [777.3, 774.0] # Co
+#ENERGIES = [776.9, 774.0] # Co
#ENERGIES = [851.3,842.0] # Ni
+#ENERGIES = [848.5, 846] # La
#ENERGIES = [576.4, 560.0] #Cr
+#ENERGIES = [570.0,576.3] #Cr
#ENERGIES = [485.0,490.0] # Ru
-#ENERGIES = [638.5,630.0] # Mn
+#ENERGIES = [642.5,633.0] # Mn
#ENERGIES = [465.0,450.0] # STO
#ENERGIES = [1067, 1076 ] # Sm
+#ENERGIES = [870, 880.3 ] # Ce
#ENERGIES = [1170, 1181 ] # Gd
#ENERGIES = [285] #C
-#ENERGIES = [1370.0,1380.0] #Er
-#ENERGIES = [1390.0,1400.6] #Er2
+#ENERGIES = [1370.0,1380.0] #Er??
+#ENERGIES = [1400.6,1390.0] #Er
+#ENERGIES = [1390.0] #Er
#ENERGIES = [1300, 1312 ] # Mg
#ENERGIES = [1457.8] # Dy
#ENERGIES = [1290.0, 1280.0] # Dy
@@ -59,13 +68,15 @@ ENERGIES = [700.0]#, 708.0] # Fe
#ENERGIES = [1345, 1338] # Ho edge, pre-edge
#ENERGIES = [1290] # Dy
#ENERGIES = [1125.6]# Eu
-#ENERGIES = [850.9, 849 ] # Ni
+#ENERGIES = [774,777.3] # Co
#ENERGIES = [516, 503] # V
#ENERGIES = [1455,1420] # Se
-#ENERGIES = [84.3, 80]# Au4F
+#ENERGIES = [285.1, 280.0]# C
+
+#ENERGIES = [ 1650.0 ]
#####################
-#open_valve()
+open_valve()
#caput("X07MA-OP-VG13:WT_SET",1)
#time.sleep(0.1)
@@ -101,5 +112,8 @@ def before_pass(pass_num):
ret70= lscan(sample_vert,sensors, POS_START, POS_END, POS_STEP, latency = 0.25, passes = len(ENERGIES), before_pass = before_pass, after_read=after_readout, plot_disabled=True, range="auto")
+#if name is None:
+# name=get_scan_filename()
+#print "Created data file: " + str(name)
close_valve()
diff --git a/script/harmonic_v2.py b/script/harmonic_v2.py
index e2e0e92..4c6543f 100644
--- a/script/harmonic_v2.py
+++ b/script/harmonic_v2.py
@@ -1,4 +1,4 @@
-ID_ENERGY = 1234
+ID_ENERGY = 770
diff --git a/script/local.py b/script/local.py
index ee92ce4..7cf99fe 100644
--- a/script/local.py
+++ b/script/local.py
@@ -306,6 +306,8 @@ def set_pol_cplus(offset = None, timeout = -1):
pol_mode.write("CIRC +")
if offset is not None:
pol_offset.write(float(offset))
+ time.sleep(0.5)
+ pol_done.update()
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
@@ -317,6 +319,8 @@ def set_pol_cminus(offset = None, timeout = -1):
pol_mode.write("CIRC -")
if offset is not None:
pol_offset.write(float(offset))
+ time.sleep(0.5)
+ pol_done.update()
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
@@ -329,6 +333,8 @@ def set_pol_lin(angle, offset = None, timeout = -1):
pol_angle.write(float(angle))
if offset is not None:
pol_offset.write(float(offset))
+ time.sleep(0.5)
+ pol_done.update()
pol_done.waitValue("DONE",timeout)
print "Done setting x-ray polarization"
@@ -374,7 +380,7 @@ def set_energy (value, delay=0.5):
tolerance = 0.3
energy.write(float(value))
try:
- energy_done.waitValue(1, timeout_ms) # timeout is now 60, was -1
+ energy_done.waitValue(1, timeout_ms) # timeout is now 90 sec, was -1
except:
if abs(energy.read() - energy_readback.read()) > tolerance:
throw
@@ -552,6 +558,16 @@ def hyst_cont(field, init_field, final_field, ramp_speed, energies):
"""
run("HystScan",{"FIELD":field, "START_FIELD":init_field, "END_FIELD":final_field, "ENERGIES":energies, "RAMP_RATE":ramp_speed, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
+def hyst_cont_ESR(field, init_field, final_field, ramp_speed, energies):
+ """
+ """
+ run("HystScan_ESR",{"FIELD":field, "START_FIELD":init_field, "END_FIELD":final_field, "ENERGIES":energies, "RAMP_RATE":ramp_speed, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
+
+def acq_cont_ESR(field, init_field, datapoints, energies):
+ """
+ """
+ run("TimeScan_ESR",{"FIELD":field, "START_FIELD":init_field, "ACQPOINTS":datapoints, "ENERGIES":energies, "ENERGY_CHANGE_SLEEP":0.5, "MODE":None, "OFFSET":None})
+
def hyst_cont_mult(field, ranges, energies):
"""
"""
diff --git a/script/magnet_x_init_ramp.py b/script/magnet_x_init_ramp.py
new file mode 100644
index 0000000..5ce4cac
--- /dev/null
+++ b/script/magnet_x_init_ramp.py
@@ -0,0 +1,29 @@
+# magnet initial ramping 0 > 6.9 T
+# 0 -> 6.9 T at 0.36 T/min
+# then 6 -> 6.9 T at 0.075 T/min
+
+# list of pairs [ [target field1, ramp rate1] , [target field2, ramp rate2] , [target field3, ramp rate3] ,... ]
+field_rate = [ [6.0,0.36], [6.9, 0.075], [6.0, 0.075], [0.0, 1.0] ]
+#field_rate = [ [0.1,0.25], [0.0, 2.0] ] test
+
+for fr in field_rate:
+ fi = fr[0]
+ rr = fr[1]
+ if abs(fi) > 7.0:
+ sys.exit("Error in target field value. Aborting.")
+ if rr <= 0. or rr > 2.05:
+ sys.exit("Error in ramp rate value. Aborting.")
+ print("Ramping to "+str(fi)+" T at a ramp rate of "+str(rr)+" T/min...")
+ ramp_rate_x.write(rr)
+ time.sleep(4.0)
+ rr_rbv = caget('X07MA-PC-PS2:STS:RAMPRATE:TPM')
+ print("Read back a ramp rate of "+str(rr_rbv)+" T/min.")
+ if (abs(rr-rr_rbv) > rr * 0.1): # stay within 10%
+ sys.exit("Something went wrong when setting the ramp rate. Demand-readback > "+ str(rr*0.05)+" T/min.")
+
+ set_hx(fi)
+ print ("Target field reached. Waiting 10 seconds.")
+ time.sleep(10.0)
+
+ramp_rate_x.write(2.0)
+print ("Done. Everything went well, as far as I know.")
\ No newline at end of file
diff --git a/script/test/Test1.py b/script/test/Test1.py
new file mode 100644
index 0000000..ba30510
--- /dev/null
+++ b/script/test/Test1.py
@@ -0,0 +1,14 @@
+
+def set_file(file_name):
+ """
+ """
+ #set_exec_pars(name = file_name) #Increment index for each scan, and keep timestamp
+ set_exec_pars(name = file_name, reset=True) #Different timestamp for each scan, index set to 0
+
+
+def runpy(fname, run_number):
+ print 'running file: %s - run: %d/%d' % (fname, run_number, RUN_COUNT)
+ run(fname)
+
+for i in range(RUN_COUNT):
+ runpy("test/Test2", i+1)
\ No newline at end of file
diff --git a/script/test/Test2.py b/script/test/Test2.py
new file mode 100644
index 0000000..1e8d868
--- /dev/null
+++ b/script/test/Test2.py
@@ -0,0 +1,24 @@
+
+def test3(samples,interval):
+ """
+ """
+ run("test/Test3",{"interval":interval, "samples":samples})
+
+
+#10 min exec
+
+set_file('Fe_hyst_minus')
+test3(121,1.0)
+
+set_file('Fe_hyst_plus')
+test3(61,2.0)
+
+
+set_file('Fe_hyst_plus')
+test3(31, 4.0)
+
+set_file('Fe_hyst_minus')
+test3(21, 6.0)
+
+set_file('Fe_hyst_minus')
+test3(13, 10.0)
diff --git a/script/test/Test3.py b/script/test/Test3.py
new file mode 100644
index 0000000..14694c6
--- /dev/null
+++ b/script/test/Test3.py
@@ -0,0 +1,4 @@
+log("Run %03d/%05d - Script: %s - samples:%d interval:%f" % (get_exec_pars().seq, get_exec_pars().index , get_exec_pars().script , samples, interval), True)
+write_logs()
+tscan(current, samples, interval)
+log_scan_filename()
diff --git a/script/unknown_2_06_20.py b/script/unknown_2_06_20.py
new file mode 100644
index 0000000..bfa4924
--- /dev/null
+++ b/script/unknown_2_06_20.py
@@ -0,0 +1,26 @@
+
+def set_pol_cplus(offset = None, timeout = -1):
+ """
+ """
+ print "Set x-ray polarization to c+"
+ timeout = int(timeout *1000) if timeout>0 else timeout
+ pol_mode.write("CIRC +")
+ if offset is not None:
+ pol_offset.write(float(offset))
+ time.sleep(0.5)
+ pol_done.update()
+ pol_done.waitValue("DONE",timeout)
+ print "Done setting x-ray polarization"
+
+def set_pol_cminus(offset = None, timeout = -1):
+ """
+ """
+ print "Set x-ray polarizaton to c-"
+ timeout = int(timeout *1000) if timeout>0 else timeout
+ pol_mode.write("CIRC -")
+ if offset is not None:
+ pol_offset.write(float(offset))
+ time.sleep(0.5)
+ pol_done.update()
+ pol_done.waitValue("DONE",timeout)
+ print "Done setting x-ray polarization"
\ No newline at end of file