This commit is contained in:
2020-06-18 09:40:29 +02:00
parent d62f017235
commit 99fd48f459
6 changed files with 143 additions and 121 deletions

View File

@@ -1,2 +1,2 @@
#Thu Jun 18 08:54:10 CEST 2020
Au_C+=2.0 18.06.20 08\:54
#Thu Jun 18 09:33:46 CEST 2020
Au_C+=10.0 18.06.20 09\:33

View File

@@ -1,3 +1,6 @@
HarmonicScan.java=disabled
Sven.java=disabled
ScreenPanel6.java=disabled
AthosScreens-1.0.0.jar=disabled
Eiger.java=disabled
AthosCameras.java=disabled

View File

@@ -1,2 +1,2 @@
#Wed Jun 17 11:25:33 CEST 2020
FileSequentialNumber=333
#Thu Jun 18 09:33:47 CEST 2020
FileSequentialNumber=340

View File

@@ -34,10 +34,10 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" pref="157" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
@@ -66,14 +66,15 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboElement" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="buttonConfigure" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="comboPolarizarion" linkSize="6" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonConfigure" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -88,34 +89,31 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="comboElement" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonConfigure" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonConfigure" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerHalfwidth" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerHalfwidth" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="comboPolarizarion" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboPolarizarion" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStep" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace pref="9" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -166,6 +164,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Energy"/>
</Properties>
</Component>
@@ -178,6 +177,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Halfwidth:"/>
</Properties>
</Component>
@@ -190,6 +190,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Step:"/>
</Properties>
</Component>
@@ -279,20 +280,20 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="textLastOffset" pref="140" max="32767" attributes="0"/>
<Component id="textTimestamp" max="32767" attributes="0"/>
<Component id="textLastOffset" linkSize="11" pref="200" max="32767" attributes="0"/>
<Component id="textTimestamp" linkSize="11" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonSet" linkSize="10" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="valueOffset" min="-2" pref="140" max="-2" attributes="0"/>
<Component id="valueOffset" linkSize="11" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="textScanReturn" min="-2" pref="140" max="-2" attributes="0"/>
<Component id="textScanReturn" linkSize="11" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonApply" linkSize="10" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="138" max="32767" attributes="0"/>
<EmptySpace pref="132" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -304,7 +305,7 @@
<Component id="jLabel6" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="valueOffset" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textLastOffset" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -315,7 +316,7 @@
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textTimestamp" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textScanReturn" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -359,7 +360,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Current:"/>
<Property name="text" type="java.lang.String" value="Current Offset:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="valueOffset">
@@ -381,6 +382,7 @@
<Component class="javax.swing.JButton" name="buttonApply">
<Properties>
<Property name="text" type="java.lang.String" value="Apply"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonApplyActionPerformed"/>

View File

@@ -33,9 +33,9 @@ public class HarmonicScan extends Panel {
@Override
public void onInitialize(int runCount) {
super.onInitialize(runCount);
try{
setElement();
} catch (Exception ex){
try {
setElement();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}
@@ -45,7 +45,7 @@ public class HarmonicScan extends Panel {
super.onStart();
loadConfig();
}
@Override
public void onStateChange(State state, State former) {
setEnabled(state == State.Ready);
@@ -62,7 +62,7 @@ public class HarmonicScan extends Panel {
Path getOffsetTableFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "harmonic_scan_offsets.properties");
}
@Override
public void setEnabled(boolean value) {
buttonExecute.setEnabled(value);
@@ -97,85 +97,90 @@ public class HarmonicScan extends Panel {
throw new IOException("Invalid file format: " + tokens.length);
}
spinnerEnergy.setValue(Double.valueOf(tokens[0].trim()));
getOffsetTable();
}
void setPolarizarion() throws IOException {
getOffsetTable();
}
String getOffsetEntry(){
}
String getOffsetEntry() {
String element = comboElement.getSelectedItem().toString().trim();
String polarization = comboPolarizarion.getSelectedItem().toString().trim();
String polarization = comboPolarizarion.getSelectedItem().toString().trim();
return element + "_" + polarization;
}
EditorDialog dlgConfig;
void editEnergyTable() throws IOException{
if ((dlgConfig==null) || (!dlgConfig.isShowing())){
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);
DsvEditor editor = new DsvEditor(columns, types, " ");
dlgConfig = editor.getDialog(getView(), false);
editor.load(getEnergyTableFile().toString());
editor.setTitle("Harmonic Scan Energy Table");
}
dlgConfig.setSize(640, 320);
showWindow(dlgConfig);
dlgConfig.setSize(640, 320);
showWindow(dlgConfig);
}
void getOffsetTable() throws IOException{
void getOffsetTable() throws IOException {
textLastOffset.setText("");
textTimestamp.setText("");
try{
try {
Properties prop = new Properties();
prop.load(new FileInputStream(getOffsetTableFile().toFile()));
prop.load(new FileInputStream(getOffsetTableFile().toFile()));
String val = prop.getProperty(getOffsetEntry());
if ((val!=null)&& !val.isEmpty()){
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());
textTimestamp.setText(tokens[1].trim() + " " + tokens[2].trim());
}
} catch (FileNotFoundException ex){
} catch (FileNotFoundException ex) {
}
}
void setOffsetTable(double offset) throws IOException{
void setOffsetTable(double offset) throws IOException {
Properties prop = new Properties();
String timestamp = Chrono.getTimeStr(System.currentTimeMillis(), "dd.MM.YY HH:mm") ;
prop.setProperty(getOffsetEntry(), offset + " " + timestamp );
try (FileOutputStream out = new FileOutputStream(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);
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));
}
return ret;
});
}
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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -235,14 +240,17 @@ public class HarmonicScan extends Panel {
}
});
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));
@@ -259,9 +267,10 @@ public class HarmonicScan extends Panel {
.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(buttonConfigure, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(comboPolarizarion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(80, 80, 80)
.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)
@@ -271,38 +280,38 @@ public class HarmonicScan extends Panel {
.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(20, Short.MAX_VALUE))
.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(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.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(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.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonConfigure))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.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))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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(jLabel11)
.addComponent(comboPolarizarion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(150, 150, 150))
.addContainerGap(9, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
@@ -361,7 +370,7 @@ public class HarmonicScan extends Panel {
}
});
jLabel6.setText("Current:");
jLabel6.setText("Current Offset:");
valueOffset.setDeviceName("pol_offset");
@@ -371,6 +380,7 @@ public class HarmonicScan extends Panel {
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);
@@ -392,20 +402,22 @@ public class HarmonicScan extends Panel {
.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, 140, Short.MAX_VALUE)
.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, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.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, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textScanReturn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(buttonApply)))
.addContainerGap(138, Short.MAX_VALUE))
.addContainerGap(132, 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()
@@ -413,7 +425,7 @@ public class HarmonicScan extends Panel {
.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, 18)
.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)
@@ -422,7 +434,7 @@ public class HarmonicScan extends Panel {
.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, 18)
.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)
@@ -445,9 +457,9 @@ public class HarmonicScan extends Panel {
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
@@ -456,7 +468,6 @@ public class HarmonicScan extends Panel {
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
try {
textScanReturn.setText("");
run();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
@@ -467,7 +478,7 @@ public class HarmonicScan extends Panel {
try {
abort();
} catch (InterruptedException ex) {
SwingUtils.showException(this, ex);
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
@@ -478,7 +489,7 @@ public class HarmonicScan extends Panel {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_comboElementActionPerformed
private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed
try {
editEnergyTable();
@@ -488,15 +499,15 @@ public class HarmonicScan extends Panel {
}//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));
}
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
@@ -508,7 +519,11 @@ public class HarmonicScan extends Panel {
}//GEN-LAST:event_comboPolarizarionActionPerformed
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
// TODO add your handling code here:
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

View File

@@ -21,10 +21,12 @@ try:
if MODE == "LH":
set_pol_lin(0.0)
elif MODE == "LV":
set_pol_lin(90.0)
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)
@@ -32,8 +34,8 @@ try:
ydata = ret.getReadable(0)
ymin = min(ydata)
e0 = xdata[ydata.index(min(ydata))]
new_offset =ID_ENERGY e0 + pol_offset.take()
print "E0=",xminmin," ymin=",ymin," Offset=",new_offset
new_offset =ID_ENERGY - e0 + current_offset
print "E0=",e0," ymin=",ymin," Offset=",new_offset
set_return(new_offset)