Closedown

This commit is contained in:
x03daop
2016-06-14 14:24:03 +02:00
parent fb8c175369
commit 8df4c9c215
4 changed files with 55 additions and 10 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
DataFile.java=enabled
DataFile.java=disabled
XPSSpectrum.java=enabled
HoloScan.java=enabled
PhotonEnergy.java=enabled
+9 -1
View File
@@ -86,6 +86,7 @@
</Group>
<Component id="buttonScientaSetup" alignment="0" max="32767" attributes="0"/>
<Component id="checkEndScan" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkSaveImage" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -126,6 +127,8 @@
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="checkEndScan" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkSaveImage" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonScientaSetup" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
@@ -245,6 +248,11 @@
<Property name="text" type="java.lang.String" value="Turn off beam at end"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkSaveImage">
<Properties>
<Property name="text" type="java.lang.String" value="Save Scienta image"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
@@ -295,7 +303,7 @@
<Component id="buttonSkip" alignment="3" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="rangeSelectionPanel" pref="230" max="32767" attributes="0"/>
<Component id="rangeSelectionPanel" pref="0" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btLoad" alignment="1" min="-2" max="-2" attributes="0"/>
+12 -3
View File
@@ -128,6 +128,7 @@ public class XPSSpectrum extends Panel {
valueIterations.setEnabled(value);
comboPass.setEnabled(value);
checkEndScan.setEnabled(value);
checkSaveImage.setEnabled(value);
updateButtons();
}
@@ -191,7 +192,8 @@ public class XPSSpectrum extends Panel {
void start() throws Controller.ControllerStateException{
HashMap<String, Object> args = new HashMap<>();
args.put("ranges", scanRanges);
args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString()));
args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString()));
args.put("save_scienta_image", checkSaveImage.isSelected());
args.put("ENDSCAN", checkEndScan.isSelected());
currentScanIndex = -1;
@@ -220,6 +222,7 @@ public class XPSSpectrum extends Panel {
jLabel17 = new javax.swing.JLabel();
buttonScientaSetup = new javax.swing.JButton();
checkEndScan = new javax.swing.JCheckBox();
checkSaveImage = new javax.swing.JCheckBox();
jPanel2 = new javax.swing.JPanel();
btLoad = new javax.swing.JButton();
btSave = new javax.swing.JButton();
@@ -300,6 +303,8 @@ public class XPSSpectrum extends Panel {
checkEndScan.setText("Turn off beam at end");
checkSaveImage.setText("Save Scienta image");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -332,7 +337,8 @@ public class XPSSpectrum extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(valueIterations, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(buttonScientaSetup, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan))
.addComponent(checkEndScan)
.addComponent(checkSaveImage))
.addContainerGap())
);
@@ -369,6 +375,8 @@ public class XPSSpectrum extends Panel {
.addComponent(comboPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkSaveImage)
.addGap(18, 18, 18)
.addComponent(buttonScientaSetup)
.addGap(26, 26, 26))
@@ -457,7 +465,7 @@ public class XPSSpectrum extends Panel {
.addComponent(buttonAbort)
.addComponent(buttonSkip))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addComponent(rangeSelectionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btLoad, javax.swing.GroupLayout.Alignment.TRAILING)
@@ -609,6 +617,7 @@ public class XPSSpectrum extends Panel {
private javax.swing.JButton buttonScientaSetup;
private javax.swing.JButton buttonSkip;
private javax.swing.JCheckBox checkEndScan;
private javax.swing.JCheckBox checkSaveImage;
private javax.swing.JComboBox comboPass;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel11;
+33 -5
View File
@@ -1,6 +1,7 @@
#Parameters (global variables):
# ranges: list of RangeSelection havinf args = (step_size, step_time, iterations)
# pass_energy
# save_scienta_image
#
# skip_iteration: if set to 1 then skips after end of current iteration
from ch.psi.pshell.data.LayoutDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION
@@ -52,14 +53,16 @@ try:
#iterations done in script
xdata = None
ydata = None
image_data = None
task = fork(plot_cur_spectrum)
path="scan" + str(cur_range+1) + "/"
for cur_iteration in range(vars[2]):
plots[cur_range+1].setTitle(str(ranges[cur_range]) + " - iteration " + str(cur_iteration+1))
while True:
wait_beam()
trig_scienta()
spectrum_array = Scienta.spectrum.read()
spectrum_array = Scienta.spectrum.read()
if beam_ok:
break
if ydata is None:
@@ -70,16 +73,41 @@ try:
if xdata is None:
xdata = Scienta.spectrumX
plots[cur_range+1].getSeries(0).setData(xdata, ydata)
if save_scienta_image:
image_array = Scienta.dataMatrix.read()
if image_data is None:
image_data = image_array
else:
for k in range (len(image_data)):
for j in range (len(image_data[0])):
image_data[k][j] = image_data[k][j] + image_array[k][j]
if skip_iteration:
break
save_dataset(path + "ScientaSpectrum", ydata)
set_attribute(path, "Iterations",cur_iteration+1)
if save_scienta_image:
save_dataset(path + "ScientaImage", image_data)
if cur_iteration==0:
save_dataset(path + "ScientaChannels", xdata)
set_attribute(path + "ScientaChannels", ATTR_WRITABLE_DIMENSION, 1)
set_attribute(path, "Range Low", ranges[cur_range].min)
set_attribute(path, "Range High", ranges[cur_range].max)
set_attribute(path, "Step Time",vars[0])
set_attribute(path, "Step Size",vars[1])
set_attribute(path, "Pass Energy",pass_energy)
set_attribute(path, "Readables", ["ScientaSpectrum","ScientaImage"] if save_scienta_image else ["ScientaSpectrum",])
set_attribute(path, "Writables", ["ScientaChannels",])
create_diag_datasets(path)
append_diag_datasets(path)
plots[cur_range+1].setTitle(str(ranges[cur_range]))
ret.append((xdata, ydata))
data1d = [1,2,3,4,5]
path="scan" + str(cur_range+1) + "/"
"""
save_dataset(path + "ScientaSpectrum", ydata)
save_dataset(path + "ScientaChannels", xdata)
if save_scienta_image:
save_dataset(path + "ScientaImage", image_data)
set_attribute(path + "ScientaChannels", ATTR_WRITABLE_DIMENSION, 1)
set_attribute(path, "Range Low", ranges[cur_range].min)
set_attribute(path, "Range High", ranges[cur_range].max)
@@ -89,9 +117,9 @@ try:
set_attribute(path, "Iterations",cur_iteration+1)
set_attribute(path, "Readables", ["ScientaSpectrum",])
set_attribute(path, "Writables", ["ScientaChannels",])
create_diag_datasets(path)
append_diag_datasets(path)
"""
finally: