This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
#Thu Jan 16 14:47:12 CET 2020
|
||||
autoSaveScanData=true
|
||||
simulation=false
|
||||
commandExecutionEvents=false
|
||||
logDaysToLive=30
|
||||
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\\\\\://d.psi.ch | d.psi.ch | users.psi
|
||||
logLevelConsole=Off
|
||||
scanStreamerPort=-1
|
||||
parallelInitialization=false
|
||||
versionTrackingManual=true
|
||||
hostName=null
|
||||
userManagement=false
|
||||
instanceName=NanoXAS
|
||||
dataServerPort=-1
|
||||
hideServerMessages=false
|
||||
serverPort=8080
|
||||
versionTrackingEnabled=true
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
serverEnabled=false
|
||||
depthDimension=0
|
||||
dataScanReleaseRecords=false
|
||||
dataScanPreserveTypes=true
|
||||
logLevel=Fine
|
||||
dataScanFlushRecords=false
|
||||
logPath={logs}/{date}_{time}
|
||||
dataLayout=fda
|
||||
terminalEnabled=false
|
||||
notificationLevel=Off
|
||||
terminalPort=3579
|
||||
createSessionFiles=false
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07db.git
|
||||
dataProvider=fda
|
||||
saveCommandStatistics=false
|
||||
#Fri Jan 17 13:58:28 CET 2020
|
||||
autoSaveScanData=true
|
||||
commandExecutionEvents=false
|
||||
createSessionFiles=false
|
||||
dataLayout=fda
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
dataProvider=fda
|
||||
dataScanFlushRecords=false
|
||||
dataScanPreserveTypes=true
|
||||
dataScanReleaseRecords=false
|
||||
dataServerPort=-1
|
||||
depthDimension=0
|
||||
hideServerMessages=false
|
||||
hostName=null
|
||||
instanceName=NanoXAS
|
||||
logDaysToLive=30
|
||||
logLevel=Fine
|
||||
logLevelConsole=Off
|
||||
logPath={logs}/{date}_{time}
|
||||
notificationLevel=Off
|
||||
parallelInitialization=false
|
||||
saveCommandStatistics=false
|
||||
scanStreamerPort=-1
|
||||
serverEnabled=false
|
||||
serverPort=8080
|
||||
simulation=false
|
||||
terminalEnabled=false
|
||||
terminalPort=3579
|
||||
userAuthenticator=ch.psi.pshell.security.LdapAuthenticator | ldap\\\\\\\://d.psi.ch | d.psi.ch | users.psi
|
||||
userManagement=false
|
||||
versionTrackingEnabled=true
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
versionTrackingManual=true
|
||||
versionTrackingRemote=git@git.psi.ch\:pshell_config/x07db.git
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
Scienta.java=enabled
|
||||
ScientaPanel.java=enabled
|
||||
EnergyScan.java=enabled
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#Thu Jan 16 15:22:14 CET 2020
|
||||
FileSequentialNumber=38
|
||||
#Fri Jan 17 16:44:03 CET 2020
|
||||
FileSequentialNumber=52
|
||||
|
||||
11
devices/dp1.properties
Normal file
11
devices/dp1.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
#Fri Jan 17 16:47:14 CET 2020
|
||||
motor1=0.0|4.0|8.0|0.0
|
||||
motor2=0.0|5.0|3.0|NaN
|
||||
motor3=null
|
||||
motor4=null
|
||||
motor5=null
|
||||
motor6=null
|
||||
motor7=null
|
||||
motor8=null
|
||||
positions=Park|Ready|Out|Clear
|
||||
precision=-1
|
||||
16
devices/m1.properties
Normal file
16
devices/m1.properties
Normal file
@@ -0,0 +1,16 @@
|
||||
#Fri Jan 17 16:47:13 CET 2020
|
||||
defaultSpeed=1.0
|
||||
estbilizationDelay=0
|
||||
maxSpeed=10.0
|
||||
maxValue=10.0
|
||||
minSpeed=0.1
|
||||
minValue=-10.0
|
||||
monitorByPosition=false
|
||||
offset=0.0
|
||||
precision=2
|
||||
resolution=NaN
|
||||
rotation=false
|
||||
scale=1.0
|
||||
sign_bit=0
|
||||
startRetries=1
|
||||
unit=mm
|
||||
16
devices/m2.properties
Normal file
16
devices/m2.properties
Normal file
@@ -0,0 +1,16 @@
|
||||
#Fri Jan 17 16:47:13 CET 2020
|
||||
defaultSpeed=1.0
|
||||
estbilizationDelay=0
|
||||
maxSpeed=10.0
|
||||
maxValue=10.0
|
||||
minSpeed=0.1
|
||||
minValue=-10.0
|
||||
monitorByPosition=false
|
||||
offset=0.0
|
||||
precision=2
|
||||
resolution=NaN
|
||||
rotation=false
|
||||
scale=1.0
|
||||
sign_bit=0
|
||||
startRetries=1
|
||||
unit=mm
|
||||
10
devices/p1.properties
Normal file
10
devices/p1.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
#Fri Jan 17 16:47:14 CET 2020
|
||||
maxValue=1000.0
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
precision=-1
|
||||
resolution=NaN
|
||||
rotation=false
|
||||
scale=1.0
|
||||
sign_bit=0
|
||||
unit=mm
|
||||
25
devices/src1.properties
Normal file
25
devices/src1.properties
Normal file
@@ -0,0 +1,25 @@
|
||||
#Fri Jan 17 16:47:30 CET 2020
|
||||
colormap=Temperature
|
||||
colormapAutomatic=true
|
||||
colormapLogarithmic=false
|
||||
colormapMax=NaN
|
||||
colormapMin=NaN
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
grayscale=false
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
25
devices/src2.properties
Normal file
25
devices/src2.properties
Normal file
@@ -0,0 +1,25 @@
|
||||
#Fri Jan 17 16:47:30 CET 2020
|
||||
colormap=Grayscale
|
||||
colormapAutomatic=true
|
||||
colormapLogarithmic=false
|
||||
colormapMax=NaN
|
||||
colormapMin=NaN
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
grayscale=false
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
@@ -31,11 +31,16 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace pref="79" max="32767" attributes="0"/>
|
||||
<Component id="buttonStart" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="79" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonStart" linkSize="3" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" linkSize="3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkAutoSaveArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -43,12 +48,14 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkAutoSaveArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -71,33 +78,48 @@
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Regions"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="buttonAdd" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="15" max="32767" attributes="0"/>
|
||||
<Component id="buttonOpen" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonAdd" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonDelete" linkSize="2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="177" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="138" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonDelete" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="3" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonOpen" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -141,7 +163,28 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDeleteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonOpen">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Open"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonSave">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JCheckBox" name="checkAutoSaveArgs">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Auto save scan parameters"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
import ch.psi.pshell.core.JsonSerializer;
|
||||
import ch.psi.pshell.epics.Positioner;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.IO;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.Sys;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
/**
|
||||
@@ -10,6 +24,11 @@ import javax.swing.table.DefaultTableModel;
|
||||
public class EnergyScan extends Panel {
|
||||
|
||||
final DefaultTableModel model;
|
||||
Positioner energy;
|
||||
File currentFile;
|
||||
public static final String FILE_EXTENSION = "ens";
|
||||
public static final String DEFAULT_FOLDER = "{data}";
|
||||
|
||||
public EnergyScan() {
|
||||
initComponents();
|
||||
model = (DefaultTableModel) table.getModel();
|
||||
@@ -18,7 +37,7 @@ public class EnergyScan extends Panel {
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
|
||||
energy = (Positioner) this.getDevice("energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,6 +55,103 @@ public class EnergyScan extends Panel {
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
void checkValues(){
|
||||
if (model.getRowCount() == 0){
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
for (int i=0; i< model.getRowCount(); i++){
|
||||
Double start = (Double) model.getValueAt(i, 0);
|
||||
Double stop = (Double) model.getValueAt(i, 1);
|
||||
Double step = (Double) model.getValueAt(i, 2);
|
||||
if ( Double.isNaN(start) || Double.isNaN(stop) || Double.isNaN(step) ||
|
||||
(start >= stop) || (step<0) ||
|
||||
(start < energy.getMinValue()) ||
|
||||
(stop > energy.getMaxValue()) ){
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void start() throws Exception{
|
||||
checkValues();
|
||||
String lastOutput = getContext().getDataManager().getLastOutput();
|
||||
|
||||
HashMap args = new HashMap();
|
||||
ArrayList regions = new ArrayList();
|
||||
for (int i=0; i< model.getRowCount(); i++){
|
||||
ArrayList region = new ArrayList();
|
||||
region.add(model.getValueAt(i, 0));
|
||||
region.add(model.getValueAt(i, 1));
|
||||
region.add(model.getValueAt(i, 2));
|
||||
regions.add(region);
|
||||
}
|
||||
|
||||
args.put("REGIONS", regions);
|
||||
this.runAsync("templates/EnergyScan", args).handle((ret,ex)->{
|
||||
if (ex!=null){
|
||||
}
|
||||
if (checkAutoSaveArgs.isSelected()){
|
||||
//Save scan attributes
|
||||
String output = getContext().getDataManager().getLastOutput();
|
||||
if ((output!=null) && !output.isEmpty() &&!output.equals(lastOutput)){
|
||||
try {
|
||||
save(Paths.get(output + "." + FILE_EXTENSION));
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(EnergyScan.class.getName()).log(Level.WARNING, null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void save() throws IOException {
|
||||
JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(DEFAULT_FOLDER));
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("Energy scan definition file", FILE_EXTENSION);
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setFileHidingEnabled(false);
|
||||
if (currentFile != null) {
|
||||
try {
|
||||
chooser.setSelectedFile(currentFile);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
int rVal = chooser.showSaveDialog(this);
|
||||
if (rVal == JFileChooser.APPROVE_OPTION) {
|
||||
String fileName = chooser.getSelectedFile().getAbsolutePath();
|
||||
if (IO.getExtension(chooser.getSelectedFile().getAbsolutePath()).isEmpty()) {
|
||||
fileName += "." + FILE_EXTENSION;
|
||||
}
|
||||
save(Paths.get(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
public void save(Path path) throws IOException {
|
||||
currentFile = path.toFile();
|
||||
String json = JsonSerializer.encode(model.getDataVector(), true);
|
||||
Files.write(path, json.getBytes());
|
||||
}
|
||||
|
||||
public void open() throws IOException {
|
||||
JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(DEFAULT_FOLDER));
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("Energy scan definition file", FILE_EXTENSION);
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setFileHidingEnabled(true);
|
||||
|
||||
int rVal = chooser.showOpenDialog(this);
|
||||
if (rVal == JFileChooser.APPROVE_OPTION) {
|
||||
open(chooser.getSelectedFile().toPath());
|
||||
}
|
||||
}
|
||||
|
||||
public void open(Path path) throws IOException {
|
||||
String json = new String(Files.readAllBytes(path));
|
||||
currentFile = path.toFile();
|
||||
Object[][]vector = (Object[][]) JsonSerializer.decode(json, Object[][].class);
|
||||
model.setDataVector(vector, SwingUtils.getTableColumnNames(table));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -50,6 +166,9 @@ public class EnergyScan extends Panel {
|
||||
table = new javax.swing.JTable();
|
||||
buttonAdd = new javax.swing.JButton();
|
||||
buttonDelete = new javax.swing.JButton();
|
||||
buttonOpen = new javax.swing.JButton();
|
||||
buttonSave = new javax.swing.JButton();
|
||||
checkAutoSaveArgs = new javax.swing.JCheckBox();
|
||||
|
||||
jScrollPane2.setViewportView(jEditorPane1);
|
||||
|
||||
@@ -67,6 +186,8 @@ public class EnergyScan extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Regions"));
|
||||
|
||||
table.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
|
||||
@@ -99,47 +220,73 @@ public class EnergyScan extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
buttonOpen.setText("Open");
|
||||
buttonOpen.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonOpenActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonSave.setText("Save");
|
||||
buttonSave.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSaveActionPerformed(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()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(buttonAdd)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonDelete)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
|
||||
.addComponent(buttonOpen)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSave)))
|
||||
.addContainerGap())
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonAdd)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonDelete)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAdd, buttonDelete});
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAdd, buttonDelete, buttonOpen, buttonSave});
|
||||
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonAdd)
|
||||
.addComponent(buttonDelete))
|
||||
.addComponent(buttonDelete)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonOpen)
|
||||
.addComponent(buttonSave)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
checkAutoSaveArgs.setText("Auto save scan parameters");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap(79, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart)
|
||||
.addGap(45, 45, 45)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(33, 33, 33)
|
||||
.addComponent(buttonAbort)
|
||||
.addContainerGap(79, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(checkAutoSaveArgs)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonStart});
|
||||
@@ -148,33 +295,19 @@ public class EnergyScan extends Panel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkAutoSaveArgs)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonStart)
|
||||
.addComponent(buttonAbort))
|
||||
.addGap(4, 4, 4))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
||||
HashMap args = new HashMap();
|
||||
ArrayList regions = new ArrayList();
|
||||
for (int i=0; i< model.getRowCount(); i++){
|
||||
ArrayList region = new ArrayList();
|
||||
region.add(model.getValueAt(i, 0));
|
||||
region.add(model.getValueAt(i, 1));
|
||||
region.add(model.getValueAt(i, 2));
|
||||
regions.add(region);
|
||||
}
|
||||
|
||||
args.put("REGIONS", regions);
|
||||
try{
|
||||
this.runAsync("templates/EnergyScan", args).handle((ret,ex)->{
|
||||
if (ex!=null){
|
||||
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
start();
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
@@ -189,20 +322,48 @@ public class EnergyScan extends Panel {
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
private void buttonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddActionPerformed
|
||||
model.addRow(new Object[]{Double.NaN, Double.NaN, Double.NaN});
|
||||
try{
|
||||
//model.addRow(new Object[]{energy.getMinValue(), energy.getMaxValue(), 10.0});
|
||||
model.addRow(new Object[]{500.0, 1000.0, 10.0});
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonAddActionPerformed
|
||||
|
||||
private void buttonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDeleteActionPerformed
|
||||
if ((model.getRowCount()>0) && (table.getSelectedRow()>=0)){
|
||||
model.removeRow(table.getSelectedRow());
|
||||
}
|
||||
try{
|
||||
if ((model.getRowCount()>0) && (table.getSelectedRow()>=0)){
|
||||
model.removeRow(table.getSelectedRow());
|
||||
}
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonDeleteActionPerformed
|
||||
|
||||
private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed
|
||||
try{
|
||||
open();
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonOpenActionPerformed
|
||||
|
||||
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
|
||||
try{
|
||||
save();
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonSaveActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonAdd;
|
||||
private javax.swing.JButton buttonDelete;
|
||||
private javax.swing.JButton buttonOpen;
|
||||
private javax.swing.JButton buttonSave;
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JCheckBox checkAutoSaveArgs;
|
||||
private javax.swing.JEditorPane jEditorPane1;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
|
||||
@@ -10,8 +10,8 @@ capture.write(1)
|
||||
|
||||
def trigger(position, scan):
|
||||
scienta.start()
|
||||
scienta.waitNewImage(-1)
|
||||
|
||||
cienta.waitNewImage(-1)
|
||||
|
||||
|
||||
try:
|
||||
rscan(energy, sensors, REGIONS, latency = 0.0, before_read=trigger)
|
||||
|
||||
Reference in New Issue
Block a user