Add correlation panel
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#Tue Sep 27 11:07:44 CEST 2022
|
||||
#Tue Sep 27 11:58:29 CEST 2022
|
||||
bins=1000
|
||||
min=11501.94250320649
|
||||
max=11601.94250320649
|
||||
min=11480.451953125
|
||||
max=11580.451953125
|
||||
precision=-1
|
||||
description=null
|
||||
numberOfSamples=10000
|
||||
|
||||
@@ -920,6 +920,275 @@
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel9">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Correlation">
|
||||
<Property name="tabTitle" type="java.lang.String" value="Correlation"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel10" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="plotCorrelation" pref="461" 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"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel10" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="plotCorrelation" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel10">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonStart" min="-2" pref="189" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel26" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel25" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel24" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel22" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel21" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel20" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel23" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="comboTypeY" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboTypeX" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textCorrelation" alignment="0" pref="250" max="32767" attributes="0"/>
|
||||
<Component id="spinnerInterval" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerWindow" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textLinear" alignment="0" pref="250" max="32767" attributes="0"/>
|
||||
<Component id="textQuadratic" alignment="0" pref="250" max="32767" attributes="0"/>
|
||||
<Component id="checkLinear" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkQuadratic" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="26" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="textDevX" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="textDevY" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</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"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel20" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textDevX" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="comboTypeX" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel21" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textDevY" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
|
||||
<Component id="comboTypeY" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel22" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerInterval" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel23" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerWindow" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="checkLinear" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkQuadratic" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="19" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="textCorrelation" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel24" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="jLabel25" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textLinear" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="jLabel26" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textQuadratic" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel20">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="X device:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textDevX">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="SARFE10-PSSS059:SPECTRUM_Y_SUM"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textDevY">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="SARFE10-PBPS053:INTENSITY"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel21">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Y device:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel22">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Interval (s):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerInterval">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0.1" minimum="0.001" numberType="java.lang.Double" stepSize="1.0" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel23">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Window size:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerWindow">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="50" minimum="3" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonStart">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Start"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel24">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="4"/>
|
||||
<Property name="text" type="java.lang.String" value="Correlation:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textCorrelation">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel25">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="4"/>
|
||||
<Property name="text" type="java.lang.String" value="Liner fit:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textLinear">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel26">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="4"/>
|
||||
<Property name="text" type="java.lang.String" value="Quadratric fit:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textQuadratic">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkLinear">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Linear fit"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkQuadratic">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Quadratic fit"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="comboTypeX">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="3">
|
||||
<StringItem index="0" value="Channel"/>
|
||||
<StringItem index="1" value="Stream"/>
|
||||
<StringItem index="2" value="Camera"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="selectedIndex" type="int" value="1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="comboTypeY">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="3">
|
||||
<StringItem index="0" value="Channel"/>
|
||||
<StringItem index="1" value="Stream"/>
|
||||
<StringItem index="2" value="Camera"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="selectedIndex" type="int" value="1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plotCorrelation">
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
+312
-1
@@ -17,6 +17,7 @@ import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -51,7 +52,10 @@ public class PSSS extends Panel {
|
||||
plot.setTickLabelFont(TICK_LABEL_FONT);
|
||||
history.setTickLabelFont(TICK_LABEL_FONT);
|
||||
histogramGeneratorPanelCenter.getPlot().setTickLabelFont(TICK_LABEL_FONT);
|
||||
histogramGeneratorFwhm.getPlot().setTickLabelFont(TICK_LABEL_FONT);
|
||||
histogramGeneratorFwhm.getPlot().setTickLabelFont(TICK_LABEL_FONT);
|
||||
|
||||
plotCorrelation.getAxis(Plot.AxisId.X).setLabel(null);
|
||||
plotCorrelation.getAxis(Plot.AxisId.Y).setLabel(null);
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@@ -112,6 +116,33 @@ public class PSSS extends Panel {
|
||||
radioCrystalScan.setEnabled(state == State.Ready);
|
||||
radioCameraScan.setEnabled(state == State.Ready);
|
||||
this.btAbort.setEnabled(state.isRunning());
|
||||
|
||||
|
||||
buttonStart.setEnabled((state==State.Ready) || (state==State.Busy));
|
||||
if (isRunningCorrelation()){
|
||||
if (state==State.Ready){
|
||||
buttonStart.setText("Start");
|
||||
}
|
||||
} else {
|
||||
if (state==State.Busy){
|
||||
buttonStart.setText("Stop");
|
||||
}
|
||||
}
|
||||
textDevX.setEnabled(state==State.Ready);
|
||||
textDevY.setEnabled(state==State.Ready);
|
||||
spinnerInterval.setEnabled(state==State.Ready);
|
||||
spinnerWindow.setEnabled(state==State.Ready);
|
||||
comboTypeX.setEnabled(state==State.Ready);
|
||||
comboTypeY.setEnabled(state==State.Ready);
|
||||
checkLinear.setEnabled(state==State.Ready);
|
||||
checkQuadratic.setEnabled(state==State.Ready);
|
||||
|
||||
if ((former==State.Initializing) && (state == State.Ready)){
|
||||
if (App.hasArgument("start")) {
|
||||
buttonStartActionPerformed(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,9 +169,14 @@ public class PSSS extends Panel {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (isRunningCorrelation()){
|
||||
updateResults();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@@ -179,6 +215,42 @@ public class PSSS extends Panel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateResults(){
|
||||
try{
|
||||
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
|
||||
} catch (Exception ex){
|
||||
textCorrelation.setText("");
|
||||
}
|
||||
|
||||
if (checkLinear.isSelected()){
|
||||
try{
|
||||
List pars = (List)getContext().getInterpreterVariable("pars_lin");
|
||||
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
|
||||
} catch (Exception ex){
|
||||
textLinear.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
if (checkQuadratic.isSelected()){
|
||||
try{
|
||||
List pars = (List)getContext().getInterpreterVariable("pars_quad");
|
||||
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
|
||||
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
|
||||
|
||||
} catch (Exception ex){
|
||||
textQuadratic.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean isRunningCorrelation(){
|
||||
return buttonStart.getText().equals("Stop");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
@@ -248,6 +320,28 @@ public class PSSS extends Panel {
|
||||
jLabel15 = new javax.swing.JLabel();
|
||||
jLabel19 = new javax.swing.JLabel();
|
||||
registerPanel1 = new ch.psi.pshell.swing.RegisterPanel();
|
||||
jPanel9 = new javax.swing.JPanel();
|
||||
jPanel10 = new javax.swing.JPanel();
|
||||
jLabel20 = new javax.swing.JLabel();
|
||||
textDevX = new javax.swing.JTextField();
|
||||
textDevY = new javax.swing.JTextField();
|
||||
jLabel21 = new javax.swing.JLabel();
|
||||
jLabel22 = new javax.swing.JLabel();
|
||||
spinnerInterval = new javax.swing.JSpinner();
|
||||
jLabel23 = new javax.swing.JLabel();
|
||||
spinnerWindow = new javax.swing.JSpinner();
|
||||
buttonStart = new javax.swing.JButton();
|
||||
jLabel24 = new javax.swing.JLabel();
|
||||
textCorrelation = new javax.swing.JTextField();
|
||||
jLabel25 = new javax.swing.JLabel();
|
||||
textLinear = new javax.swing.JTextField();
|
||||
jLabel26 = new javax.swing.JLabel();
|
||||
textQuadratic = new javax.swing.JTextField();
|
||||
checkLinear = new javax.swing.JCheckBox();
|
||||
checkQuadratic = new javax.swing.JCheckBox();
|
||||
comboTypeX = new javax.swing.JComboBox();
|
||||
comboTypeY = new javax.swing.JComboBox();
|
||||
plotCorrelation = new ch.psi.pshell.plot.LinePlotJFree();
|
||||
|
||||
tab.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
@@ -819,6 +913,166 @@ public class PSSS extends Panel {
|
||||
|
||||
tab.addTab("Control", jPanel6);
|
||||
|
||||
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel20.setText("X device:");
|
||||
|
||||
textDevX.setText("SARFE10-PSSS059:SPECTRUM_Y_SUM");
|
||||
|
||||
textDevY.setText("SARFE10-PBPS053:INTENSITY");
|
||||
|
||||
jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel21.setText("Y device:");
|
||||
|
||||
jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel22.setText("Interval (s):");
|
||||
|
||||
spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.001d, null, 1.0d));
|
||||
|
||||
jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel23.setText("Window size:");
|
||||
|
||||
spinnerWindow.setModel(new javax.swing.SpinnerNumberModel(50, 3, null, 1));
|
||||
|
||||
buttonStart.setText("Start");
|
||||
buttonStart.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonStartActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel24.setText("Correlation:");
|
||||
|
||||
textCorrelation.setEditable(false);
|
||||
textCorrelation.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel25.setText("Liner fit:");
|
||||
|
||||
textLinear.setEditable(false);
|
||||
textLinear.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel26.setText("Quadratric fit:");
|
||||
|
||||
textQuadratic.setEditable(false);
|
||||
textQuadratic.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
checkLinear.setSelected(true);
|
||||
checkLinear.setText("Linear fit");
|
||||
|
||||
checkQuadratic.setText("Quadratic fit");
|
||||
|
||||
comboTypeX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
|
||||
comboTypeX.setSelectedIndex(1);
|
||||
|
||||
comboTypeY.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
|
||||
comboTypeY.setSelectedIndex(1);
|
||||
|
||||
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
|
||||
jPanel10.setLayout(jPanel10Layout);
|
||||
jPanel10Layout.setHorizontalGroup(
|
||||
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel10Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(jPanel10Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel26, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel24, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel10Layout.createSequentialGroup()
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textLinear, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(checkLinear)
|
||||
.addComponent(checkQuadratic))
|
||||
.addContainerGap())
|
||||
.addComponent(textDevX)
|
||||
.addComponent(textDevY)))
|
||||
);
|
||||
jPanel10Layout.setVerticalGroup(
|
||||
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel10Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel20)
|
||||
.addComponent(textDevX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel21)
|
||||
.addComponent(textDevY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(3, 3, 3)
|
||||
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel22)
|
||||
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel23)
|
||||
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(checkLinear)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkQuadratic)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(textCorrelation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel24))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel25)
|
||||
.addComponent(textLinear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel26)
|
||||
.addComponent(textQuadratic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart)
|
||||
.addGap(45, 45, 45))
|
||||
);
|
||||
|
||||
plotCorrelation.setTitle("");
|
||||
|
||||
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
|
||||
jPanel9.setLayout(jPanel9Layout);
|
||||
jPanel9Layout.setHorizontalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(plotCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel9Layout.setVerticalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addComponent(plotCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())))
|
||||
);
|
||||
|
||||
tab.addTab("Correlation", jPanel9);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -904,12 +1158,52 @@ public class PSSS extends Panel {
|
||||
|
||||
}//GEN-LAST:event_spinnerEnergyStateChanged
|
||||
|
||||
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
||||
try {
|
||||
if (isRunningCorrelation()){
|
||||
abort();
|
||||
updateResults();
|
||||
//buttonStart.setText("Start");
|
||||
} else {
|
||||
textCorrelation.setText("");
|
||||
textLinear.setText("");
|
||||
textQuadratic.setText("");
|
||||
HashMap args = new HashMap();
|
||||
args.put("dx", textDevX.getText());
|
||||
args.put("dy", textDevY.getText());
|
||||
args.put("interval", spinnerInterval.getValue());
|
||||
args.put("window", spinnerWindow.getValue());
|
||||
args.put("dxtype", comboTypeX.getSelectedIndex());
|
||||
args.put("dytype", comboTypeY.getSelectedIndex());
|
||||
args.put("linear_fit", checkLinear.isSelected());
|
||||
args.put("quadratic_fit", checkQuadratic.isSelected());
|
||||
|
||||
args.put("p", plotCorrelation);
|
||||
runAsync("psss/Correlation", args).handle((ok, ex) -> {
|
||||
if (ex != null) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return ok;
|
||||
});
|
||||
///buttonStart.setText("Stop");
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonStartActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btAbort;
|
||||
private javax.swing.JButton btStartCam;
|
||||
private javax.swing.JButton btStartCr;
|
||||
private javax.swing.JButton btStartEn;
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JCheckBox checkLinear;
|
||||
private javax.swing.JCheckBox checkQuadratic;
|
||||
private javax.swing.JComboBox comboTypeX;
|
||||
private javax.swing.JComboBox comboTypeY;
|
||||
private ch.psi.pshell.swing.DiscretePositionerSelector discretePositionerSelector1;
|
||||
private ch.psi.pshell.swing.DiscretePositionerSelector discretePositionerSelector2;
|
||||
private ch.psi.pshell.swing.HistogramGeneratorPanel histogramGeneratorFwhm;
|
||||
@@ -927,6 +1221,13 @@ public class PSSS extends Panel {
|
||||
private javax.swing.JLabel jLabel18;
|
||||
private javax.swing.JLabel jLabel19;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel20;
|
||||
private javax.swing.JLabel jLabel21;
|
||||
private javax.swing.JLabel jLabel22;
|
||||
private javax.swing.JLabel jLabel23;
|
||||
private javax.swing.JLabel jLabel24;
|
||||
private javax.swing.JLabel jLabel25;
|
||||
private javax.swing.JLabel jLabel26;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
@@ -935,6 +1236,7 @@ public class PSSS extends Panel {
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel10;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
@@ -942,11 +1244,13 @@ public class PSSS extends Panel {
|
||||
private javax.swing.JPanel jPanel6;
|
||||
private javax.swing.JPanel jPanel7;
|
||||
private javax.swing.JPanel jPanel8;
|
||||
private javax.swing.JPanel jPanel9;
|
||||
private javax.swing.JPanel panelCameraScan;
|
||||
private javax.swing.JPanel panelCrystalScan;
|
||||
private javax.swing.JPanel panelEnergyScan;
|
||||
private javax.swing.JPanel panelScan;
|
||||
private ch.psi.pshell.plot.LinePlotJFree plot;
|
||||
private ch.psi.pshell.plot.LinePlotJFree plotCorrelation;
|
||||
private ch.psi.pshell.plot.LinePlotJFree plotScan;
|
||||
private javax.swing.JRadioButton radioCameraScan;
|
||||
private javax.swing.JRadioButton radioCrystalScan;
|
||||
@@ -969,6 +1273,13 @@ public class PSSS extends Panel {
|
||||
private javax.swing.JSpinner spToEn;
|
||||
private javax.swing.JSpinner spinnerAverage;
|
||||
private javax.swing.JSpinner spinnerEnergy;
|
||||
private javax.swing.JSpinner spinnerInterval;
|
||||
private javax.swing.JSpinner spinnerWindow;
|
||||
private javax.swing.JTabbedPane tab;
|
||||
private javax.swing.JTextField textCorrelation;
|
||||
private javax.swing.JTextField textDevX;
|
||||
private javax.swing.JTextField textDevY;
|
||||
private javax.swing.JTextField textLinear;
|
||||
private javax.swing.JTextField textQuadratic;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user