diff --git a/config/config.properties b/config/config.properties
index 571be98..46786c7 100644
--- a/config/config.properties
+++ b/config/config.properties
@@ -1,4 +1,4 @@
-#Tue Aug 09 08:58:31 CEST 2022
+#Tue Jan 17 11:35:04 CET 2023
autoSaveScanData=true
simulation=false
commandExecutionEvents=false
@@ -48,4 +48,5 @@ versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07db.git
dataProvider=h5
+dataScanLazyTableCreation=false
saveCommandStatistics=false
diff --git a/config/variables.properties b/config/variables.properties
index fc21a38..0c37e80 100644
--- a/config/variables.properties
+++ b/config/variables.properties
@@ -1,4 +1,4 @@
-#Wed Jan 11 10:54:13 CET 2023
-LastRunDate=230111
-FileSequentialNumber=100
-DaySequentialNumber=7
+#Tue Jan 17 17:14:23 CET 2023
+LastRunDate=230117
+FileSequentialNumber=136
+DaySequentialNumber=16
diff --git a/plugins/EnergyScan.java b/plugins/EnergyScan.java
index c7efc7d..4231624 100644
--- a/plugins/EnergyScan.java
+++ b/plugins/EnergyScan.java
@@ -133,7 +133,7 @@ public class EnergyScan extends ScriptProcessor {
ArrayList data = new ArrayList();
data.add(new Object[][]{new Object[]{textName.getText()}});
data.add(model.getDataVector());
- data.add(spinnerPasses.getValue());
+ data.add(new Object[][]{new Object[]{spinnerPasses.getValue()}});
String json = EncoderJson.encode(data, true);
Files.write(currentFile.toPath(), json.getBytes());
updateButtons();
diff --git a/plugins/XPS.form b/plugins/XPS.form
index a20e4d9..4c5198e 100644
--- a/plugins/XPS.form
+++ b/plugins/XPS.form
@@ -52,8 +52,6 @@
-
-
@@ -70,13 +68,12 @@
-
+
-
@@ -133,7 +130,6 @@
-
@@ -146,14 +142,13 @@
-
+
-
+
-
-
-
+
+
@@ -170,16 +165,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -211,47 +204,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -260,22 +212,133 @@
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -308,13 +371,5 @@
-
-
-
-
-
-
-
-
diff --git a/plugins/XPS.java b/plugins/XPS.java
index 2ae20e9..a5d9a8c 100644
--- a/plugins/XPS.java
+++ b/plugins/XPS.java
@@ -134,7 +134,7 @@ public class XPS extends ScriptProcessor {
try{
textCurScan.setText(getGlobalVar("CURRENT_REGION").toString());
} catch(Exception ex){
- getLogger().log(Level.WARNING, null, ex);
+ getLogger().log(Level.FINER, null, ex);
textCurScan.setText("");
}
try{
@@ -150,7 +150,7 @@ public class XPS extends ScriptProcessor {
}
}
} catch(Exception ex){
- getLogger().log(Level.WARNING, null, ex);
+ getLogger().log(Level.FINER, null, ex);
table.clearSelection();
}
} else {
@@ -202,6 +202,7 @@ public class XPS extends ScriptProcessor {
args.put("FILE", null);
args.put("NAME", getScanName());
+ args.put("PASSES", spinnerPasses.getValue());
args.put("REGIONS", regions);
return args;
}
@@ -221,6 +222,7 @@ public class XPS extends ScriptProcessor {
ArrayList data = new ArrayList();
data.add(new Object[][]{new Object[]{textName.getText()}});
data.add(model.getDataVector());
+ data.add(new Object[][]{new Object[]{spinnerPasses.getValue()}});
String json = EncoderJson.encode(data, true);
Files.write(currentFile.toPath(), json.getBytes());
updateButtons();
@@ -232,6 +234,7 @@ public class XPS extends ScriptProcessor {
currentFile = null;
textName.setText("");
model.setRowCount(0);
+ spinnerPasses.setValue(1);
} else {
Path path = Paths.get(fileName);
String json = new String(Files.readAllBytes(path));
@@ -239,6 +242,7 @@ public class XPS extends ScriptProcessor {
Object[][][] vector = (Object[][][]) EncoderJson.decode(json, Object[][][].class);
textName.setText(String.valueOf(vector[0][0][0]));
model.setDataVector(vector[1], SwingUtils.getTableColumnNames(table));
+ spinnerPasses.setValue((vector.length>2) ? (Integer)vector[2][0][0] : 1);
}
updateButtons();
}
@@ -284,19 +288,22 @@ public class XPS extends ScriptProcessor {
textName = new javax.swing.JTextField();
buttonOpen = new javax.swing.JButton();
buttonSave = new javax.swing.JButton();
+ buttonClear = new javax.swing.JButton();
+ buttonAddToQueue = new javax.swing.JButton();
+ jLabel3 = new javax.swing.JLabel();
+ spinnerPasses = new javax.swing.JSpinner();
+ jPanel1 = new javax.swing.JPanel();
+ buttonUp = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
+ buttonDown = new javax.swing.JButton();
buttonInsert = new javax.swing.JButton();
buttonDelete = new javax.swing.JButton();
- buttonClear = new javax.swing.JButton();
- buttonUp = new javax.swing.JButton();
- buttonDown = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
textFileId = new javax.swing.JTextField();
buttonResetId = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
textCurScan = new javax.swing.JTextField();
- buttonAddToQueue = new javax.swing.JButton();
jScrollPane2.setViewportView(jEditorPane1);
@@ -345,6 +352,33 @@ public class XPS extends ScriptProcessor {
}
});
+ buttonClear.setText("Clear");
+ buttonClear.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonClearActionPerformed(evt);
+ }
+ });
+
+ buttonAddToQueue.setText("Add To Queue");
+ buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonAddToQueueActionPerformed(evt);
+ }
+ });
+
+ jLabel3.setText("Passes:");
+
+ spinnerPasses.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
+
+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Regions"));
+
+ buttonUp.setText("Move Up");
+ buttonUp.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonUpActionPerformed(evt);
+ }
+ });
+
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
@@ -381,6 +415,13 @@ public class XPS extends ScriptProcessor {
});
jScrollPane1.setViewportView(table);
+ buttonDown.setText("Move Down");
+ buttonDown.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonDownActionPerformed(evt);
+ }
+ });
+
buttonInsert.setText("Insert");
buttonInsert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -395,26 +436,40 @@ public class XPS extends ScriptProcessor {
}
});
- buttonClear.setText("Clear");
- buttonClear.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonClearActionPerformed(evt);
- }
- });
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(buttonUp)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonDown)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonInsert)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonDelete)))
+ .addContainerGap())
+ );
- buttonUp.setText("Move Up");
- buttonUp.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonUpActionPerformed(evt);
- }
- });
+ jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDelete, buttonDown, buttonInsert, buttonUp});
- buttonDown.setText("Move Down");
- buttonDown.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonDownActionPerformed(evt);
- }
- });
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonInsert)
+ .addComponent(buttonDelete)
+ .addComponent(buttonUp)
+ .addComponent(buttonDown))
+ .addContainerGap())
+ );
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
@@ -423,7 +478,6 @@ public class XPS extends ScriptProcessor {
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -435,18 +489,14 @@ public class XPS extends ScriptProcessor {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonSave))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
- .addComponent(buttonUp)
+ .addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonDown)
+ .addComponent(spinnerPasses, 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(buttonInsert)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(buttonDelete)))
+ .addComponent(buttonAddToQueue))
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
-
- jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDelete, buttonDown, buttonInsert, buttonUp});
-
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
@@ -458,14 +508,12 @@ public class XPS extends ScriptProcessor {
.addComponent(buttonSave)
.addComponent(buttonClear))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(11, 11, 11)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonInsert)
- .addComponent(buttonDelete)
- .addComponent(buttonUp)
- .addComponent(buttonDown))
- .addContainerGap())
+ .addComponent(buttonAddToQueue)
+ .addComponent(jLabel3)
+ .addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
jLabel2.setText("File ID:");
@@ -485,13 +533,6 @@ public class XPS extends ScriptProcessor {
textCurScan.setEditable(false);
textCurScan.setHorizontalAlignment(javax.swing.JTextField.CENTER);
- buttonAddToQueue.setText("Add To Queue");
- buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonAddToQueueActionPerformed(evt);
- }
- });
-
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -516,8 +557,6 @@ public class XPS extends ScriptProcessor {
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(buttonAddToQueue)
- .addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -533,13 +572,12 @@ public class XPS extends ScriptProcessor {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(7, 7, 7)
+ .addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textFileId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
- .addComponent(textCurScan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonAddToQueue))
+ .addComponent(textCurScan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonResetId)
@@ -718,10 +756,13 @@ public class XPS extends ScriptProcessor {
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
+ private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JSpinner spinnerPasses;
private javax.swing.JTable table;
private javax.swing.JTextField textCurScan;
private javax.swing.JTextField textFileId;
diff --git a/script/local.py b/script/local.py
index a674464..8d4b5f3 100644
--- a/script/local.py
+++ b/script/local.py
@@ -93,11 +93,14 @@ def dummy_trigger_scienta():
"""
Trigger detector to update the array sizes and calibration
"""
+ print "Dummy trigger... "
iterations = scienta.getIterations()
scienta.setIterations(1)
try:
trigger_scienta()
finally:
scienta.setIterations(iterations)
+ print "Done"
-
+def clear_output():
+ App.getInstance().mainFrame.clearScanDisplays()
diff --git a/script/templates/EnergyScan.py b/script/templates/EnergyScan.py
index 042d192..d929d61 100644
--- a/script/templates/EnergyScan.py
+++ b/script/templates/EnergyScan.py
@@ -18,7 +18,9 @@ print "REGIONS: ", REGIONS
print "PASSES: ", PASSES
IOC_AUTO_SAVE = False
-DUMMY_TRIGGER = True
+DUMMY_TRIGGER = False
+SPLIT_PASSES = False
+
set_device_alias(scienta.getSpectrum(), "spectrum")
set_device_alias(scienta.getDataMatrix(), "image")
@@ -29,6 +31,7 @@ sensors=[i0, scienta.stats[0], scienta.getSpectrum()] #), scienta.getDataMatrix(
def before_read(position, scan):
trigger_scienta()
+clear_output()
if DUMMY_TRIGGER:
dummy_trigger_scienta()
@@ -37,7 +40,9 @@ if IOC_AUTO_SAVE:
capture.write(1)
try:
- rscan(energy, sensors, REGIONS, latency = 0.0, passes=PASSES, split=True, before_read=before_read, after_read=after_readout, name = NAME)
+ rscan(energy, sensors, REGIONS, latency = 0.0, passes=PASSES, split=SPLIT_PASSES, \
+ before_read=before_read, after_read=after_readout, \
+ name=NAME, lazy=not DUMMY_TRIGGER)
finally:
if IOC_AUTO_SAVE:
capture.write(0)
diff --git a/script/templates/TimeResolved.py b/script/templates/TimeResolved.py
index 93263a8..1599008 100644
--- a/script/templates/TimeResolved.py
+++ b/script/templates/TimeResolved.py
@@ -13,7 +13,8 @@ if FILE:
NAME , SCANS= cfg[0], cfg[1]
print "FILE: ", FILE
print "SCANS: ", SCANS
-
+
+DUMMY_TRIGGER=False
"""
scienta.getState().assertReady()
@@ -37,12 +38,13 @@ sensors=[i0, scienta.getSpectrum()]
def before_read(position, scan):
trigger_scienta()
-
-dummy_trigger_scienta()
+clear_output()
+if DUMMY_TRIGGER:
+ dummy_trigger_scienta()
try:
- tscan(sensors, SCANS, 0.001, before_read=before_read, after_read=after_readout, name = NAME)
+ tscan(sensors, SCANS, 0.001, before_read=before_read, after_read=after_readout, name=NAME, lazy=not DUMMY_TRIGGER)
finally:
scienta.zeroSupplies()
diff --git a/script/templates/XPS.py b/script/templates/XPS.py
index abe15d0..f76835f 100644
--- a/script/templates/XPS.py
+++ b/script/templates/XPS.py
@@ -1,25 +1,23 @@
import json
-CURRENT_REGION = ""
-CURRENT_INDEX = -1
-
if get_exec_pars().debug:
print "Setting debug parameters"
NAME = None
FILE = None
+ PASSES = 1
R1 = """{
+ "scienta.acquisitionMode" : "Swept",
"scienta.elementSet" : "HiPPHAXPES",
"scienta.lensMode" : "T_HiPPHAXPES",
- "scienta.lowEnergy" : 387.0,
- "scienta.acquisitionMode" : "Swept",
- "scienta.slices" : 1.0,
- "scienta.stepSize" : 0.25,
- "scienta.passEnergy" : 2,
"scienta.detectorMode" : "ADC",
"scienta.energyMode" : "Kinetic",
- "scienta.centerEnergy" : 397.0,
+ "scienta.passEnergy" : 2,
+ "scienta.lowEnergy" : 387.0,
+ "scienta.centerEnergy" : 397.0,
+ "scienta.highEnergy" : 407.0,
+ "scienta.slices" : 1.0,
+ "scienta.stepSize" : 0.25,
"scienta.stepTime" : 1.0,
- "scienta.highEnergy" : 407.0,
"scienta.iterations" : 1.0
} """
@@ -29,17 +27,31 @@ if FILE:
FILE = get_context().setup.expandPath("{home}/parameters/" + FILE)
with open(FILE) as json_file:
cfg = json.load(json_file)
- NAME , REGIONS= cfg[0][0][0], cfg[1]
+ NAME , REGIONS, PASSES= cfg[0][0][0], cfg[1], cfg[2]
print "FILE: ", FILE
print "NAME: ", NAME
#print "REGIONS: ", REGIONS
-
-
+print "PASSES: ", PASSES
+
+DUMMY_TRIGGER = False
+CURRENT_REGION = ""
+CURRENT_INDEX = -1
+PLOT_TYPES={"spectrum":1, "energy":1}
+
+
+for r in REGIONS:
+ name=r[0]
+ pars = json.loads(r[1])
+ for k,v in pars.items():
+ if (v is None) or (v== float("NaN")):
+ raise Exception ("Invalid value in region: ", r, " parameter: ", k)
+
set_device_alias(scienta.getSpectrum(), "spectrum")
+set_device_alias(scienta.getSpectrumScale(), "energy")
set_device_alias(scienta.getDataMatrix(), "image")
set_device_alias(scienta.stats[0], "sum")
-sensors=[i0, scienta.stats[0], scienta.getSpectrum()]
+sensors=[i0, scienta.stats[0], scienta.getSpectrum(), scienta.getSpectrumScale()] #), scienta.getDataMatrix()]
def apply_pars(pars):
@@ -49,36 +61,50 @@ def apply_pars(pars):
scienta.energyMode = scienta.energyMode.valueOf(pars["scienta.energyMode"])
scienta.acquisitionMode = scienta.acquisitionMode.valueOf(pars["scienta.acquisitionMode"])
scienta.passEnergy = pars["scienta.passEnergy"]
- scienta.getLowEnergy().writeAsync(pars["scienta.centerEnergy"])
- scienta.getCenterEnergy().writeAsync(pars["scienta.passEnergy"])
+ scienta.getLowEnergy().writeAsync(pars["scienta.lowEnergy"])
+ scienta.getCenterEnergy().writeAsync(pars["scienta.centerEnergy"])
scienta.getHighEnergy().writeAsync(pars["scienta.highEnergy"])
scienta.getSlices().writeAsync(pars["scienta.slices"])
scienta.getStepSize().writeAsync(pars["scienta.stepSize"])
scienta.getStepTime().writeAsync(pars["scienta.stepTime"])
scienta.setIterations(int(pars["scienta.iterations"]))
-
+def set_region_index(index):
+ global REGIONS, CURRENT_REGION, CURRENT_INDEX
+ r=REGIONS[index]
+ name=r[0]
+ pars = json.loads(r[1])
+ CURRENT_REGION = name
+ CURRENT_INDEX = CURRENT_INDEX+1
+ print "Region: ", name
+ print "Pars: ", pars
+ apply_pars(pars)
+
def before_read(position, scan):
- #trigger_scienta()
+ #set_region_index(scan.getRecordIndexInPass()-1)
+ #time.sleep(0.5)
+ trigger_scienta()
pass
-
-#dummy_trigger_scienta()
-
+clear_output()
try:
- for r in REGIONS:
- name=r[0]
- pars = json.loads(r[1])
- CURRENT_REGION = name
- CURRENT_INDEX = CURRENT_INDEX+1
- print "Region: ", name
- print "Pars: ", pars
- apply_pars(pars)
- time.sleep(5.0)
-
- #tscan(sensors, 1, 0.001, before_read=before_read, after_read=after_readout, name = NAME)
-finally:
- scienta.zeroSupplies()
+ for i in range(len(REGIONS)):
+ set_region_index(i)
+ #tscan(sensors, len(REGIONS), 0.1, \
+ #passes=PASSES, split=SPLIT_PASSES, \
+ #before_read=before_read, after_read=after_readout, name = NAME)
+ if DUMMY_TRIGGER:
+ dummy_trigger_scienta()
+
+ tscan(sensors, PASSES, 0.1, tag=CURRENT_REGION, \
+ before_read=before_read, after_read=after_readout, \
+ name=NAME, lazy=not DUMMY_TRIGGER, plot_types=PLOT_TYPES)
+
+finally:
+ print "Finalizing"
+ scienta.zeroSupplies()
+ print "Quit script"
+