[Kst] branches/work/kst/portto4/kst/src

Barth Netterfield netterfield at astro.utoronto.ca
Fri Mar 11 00:28:54 CET 2011


SVN commit 1224439 by netterfield:

More automatic label work:
 -propagate units through fits and filters
 -start work to handle labels for different units between multiple curves in the same window.




 M  +10 -0     libkstapp/legenditem.cpp  
 M  +4 -0      plugins/filters/butterworth_bandpass/butterworth_bandpass.cpp  
 M  +4 -0      plugins/filters/butterworth_bandstop/butterworth_bandstop.cpp  
 M  +4 -0      plugins/filters/butterworth_highpass/butterworth_highpass.cpp  
 M  +3 -0      plugins/filters/butterworth_lowpass/butterworth_lowpass.cpp  
 M  +4 -0      plugins/filters/despike/filterdespike.cpp  
 M  +7 -0      plugins/fits/exponential_unweighted/fitexponential_unweighted.cpp  
 M  +8 -0      plugins/fits/exponential_weighted/fitexponential_weighted.cpp  
 M  +8 -0      plugins/fits/gaussian_unweighted/fitgaussian_unweighted.cpp  
 M  +9 -0      plugins/fits/gaussian_weighted/fitgaussian_weighted.cpp  
 M  +14 -0     plugins/fits/gradient_unweighted/fitgradient_unweighted.cpp  
 M  +14 -0     plugins/fits/gradient_weighted/fitgradient_weighted.cpp  
 M  +13 -0     plugins/fits/linear_unweighted/fitlinear_unweighted.cpp  
 M  +13 -0     plugins/fits/linear_weighted/fitlinear_weighted.cpp  
 M  +8 -0      plugins/fits/lorentzian_unweighted/fitlorentzian_unweighted.cpp  
 M  +8 -0      plugins/fits/lorentzian_weighted/fitlorentzian_weighted.cpp  
 M  +7 -0      plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp  
 M  +7 -0      plugins/fits/polynomial_weighted/fitpolynomial_weighted.cpp  
 M  +7 -0      plugins/fits/sinusoid_unweighted/fitsinusoid_unweighted.cpp  
 M  +8 -0      plugins/fits/sinusoid_weighted/fitsinusoid_weighted.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1224438:1224439
@@ -89,7 +89,9 @@
   int count = legendItems.count();
   bool allAuto = true;
   bool sameX = true;
+  bool sameYUnits = true;
   LabelInfo label_info = legendItems.at(0)->xLabelInfo();
+  QString yUnits =  legendItems.at(0)->xLabelInfo().units;
 
   for (int i = 0; i<count; i++) {
     RelationPtr relation = legendItems.at(i);
@@ -99,7 +101,15 @@
     if (relation->xLabelInfo() != label_info) {
       sameX = false;
     }
+    // sameYUnits is false if any non empty units are defined differently.
+    if (yUnits.isEmpty()) {
+      yUnits = relation->yLabelInfo().units;
+    } else if (relation->yLabelInfo().units != yUnits) {
+      if (!relation->yLabelInfo().units.isEmpty()) {
+        sameYUnits = false;
   }
+    }
+  }
 
   if (!allAuto) {
     for (int i = 0; i<count; i++) {
--- branches/work/kst/portto4/kst/src/plugins/filters/butterworth_bandpass/butterworth_bandpass.cpp #1224438:1224439
@@ -217,6 +217,10 @@
   scalars.insert(1, rateScalar);
   scalars.insert(2, bandwidthScalar);
 
+  Kst::LabelInfo label_info = inputVector->labelInfo();
+  label_info.name = i18n("Filtered %1").arg(label_info.name);
+  outputVector->setLabelInfo(label_info);
+
   return kst_pass_filter( inputVector, scalars, outputVector);
 }
 
--- branches/work/kst/portto4/kst/src/plugins/filters/butterworth_bandstop/butterworth_bandstop.cpp #1224438:1224439
@@ -218,6 +218,10 @@
   scalars.insert(1, rateScalar);
   scalars.insert(2, bandwidthScalar);
 
+  Kst::LabelInfo label_info = inputVector->labelInfo();
+  label_info.name = i18n("Filtered %1").arg(label_info.name);
+  outputVector->setLabelInfo(label_info);
+
   return kst_pass_filter( inputVector, scalars, outputVector);
 }
 
--- branches/work/kst/portto4/kst/src/plugins/filters/butterworth_highpass/butterworth_highpass.cpp #1224438:1224439
@@ -194,6 +194,10 @@
   scalars.insert(0, orderScalar);
   scalars.insert(1, cutoffScalar);
 
+  Kst::LabelInfo label_info = inputVector->labelInfo();
+  label_info.name = i18n("Filtered %1").arg(label_info.name);
+  outputVector->setLabelInfo(label_info);
+
   return kst_pass_filter( inputVector, scalars, outputVector);
 }
 
--- branches/work/kst/portto4/kst/src/plugins/filters/butterworth_lowpass/butterworth_lowpass.cpp #1224438:1224439
@@ -190,6 +190,9 @@
   scalars.insert(0, orderScalar);
   scalars.insert(1, cutoffScalar);
 
+  Kst::LabelInfo label_info = inputVector->labelInfo();
+  label_info.name = i18n("Filtered %1").arg(label_info.name);
+  outputVector->setLabelInfo(label_info);
   return kst_pass_filter( inputVector, scalars, outputVector);
 }
 
--- branches/work/kst/portto4/kst/src/plugins/filters/despike/filterdespike.cpp #1224438:1224439
@@ -279,6 +279,10 @@
     }
   }
 
+  Kst::LabelInfo label_info = inputVector->labelInfo();
+  label_info.name = i18n("Despiked %1").arg(label_info.name);
+  outputVector->setLabelInfo(label_info);
+
   return true;
 }
 
--- branches/work/kst/portto4/kst/src/plugins/fits/exponential_unweighted/fitexponential_unweighted.cpp #1224438:1224439
@@ -212,6 +212,13 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Exponential Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Exponential Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear( inputVectorX, inputVectorY,
--- branches/work/kst/portto4/kst/src/plugins/fits/exponential_weighted/fitexponential_weighted.cpp #1224438:1224439
@@ -227,6 +227,14 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Exponential Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Exponential Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear_weighted( inputVectorX, inputVectorY, inputVectorWeights,
--- branches/work/kst/portto4/kst/src/plugins/fits/gaussian_unweighted/fitgaussian_unweighted.cpp #1224438:1224439
@@ -216,6 +216,14 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Gaussian Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gaussian Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear( inputVectorX, inputVectorY,
--- branches/work/kst/portto4/kst/src/plugins/fits/gaussian_weighted/fitgaussian_weighted.cpp #1224438:1224439
@@ -231,6 +231,15 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Gaussian Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gaussian Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear_weighted( inputVectorX, inputVectorY, inputVectorWeights,
--- branches/work/kst/portto4/kst/src/plugins/fits/gradient_unweighted/fitgradient_unweighted.cpp #1224438:1224439
@@ -172,6 +172,20 @@
   Kst::VectorPtr outputVectorYHi = _outputVectors[VECTOR_OUT_Y_HI];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Gradient Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Lower Limit");
+  outputVectorYLo->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Upper Limit");
+  outputVectorYHi->setLabelInfo(label_info);
+
   int i = 0;
   int iLength;
   bool bReturn = false;
--- branches/work/kst/portto4/kst/src/plugins/fits/gradient_weighted/fitgradient_weighted.cpp #1224438:1224439
@@ -189,6 +189,20 @@
   Kst::VectorPtr outputVectorYHi = _outputVectors[VECTOR_OUT_Y_HI];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Gradient Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Lower Limit");
+  outputVectorYLo->setLabelInfo(label_info);
+
+  label_info.name = i18n("Gradient Fit Upper Limit");
+  outputVectorYHi->setLabelInfo(label_info);
+
+
   int i = 0;
   int iLength;
   bool bReturn = false;
--- branches/work/kst/portto4/kst/src/plugins/fits/linear_unweighted/fitlinear_unweighted.cpp #1224438:1224439
@@ -185,6 +185,19 @@
   double y;
   double yErr;
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Linear Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Lower Limit");
+  outputVectorYLo->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Upper Limit");
+  outputVectorYHi->setLabelInfo(label_info);
+
   if( precursor( inputVectorX, inputVectorY, 0, &iLength, false, true, 2, pInputs, outputVectorYFitted, outputVectorYResiduals, outputVectorYParameters, outputVectorYCovariance, outputVectorYLo, outputVectorYHi ) ) {
 
     if( !gsl_fit_linear( pInputs[XVALUES], 1, pInputs[YVALUES], 1, iLength, &c0, &c1, &cov00, &cov01, &cov11, &dSumSq ) ) {
--- branches/work/kst/portto4/kst/src/plugins/fits/linear_weighted/fitlinear_weighted.cpp #1224438:1224439
@@ -189,6 +189,19 @@
   Kst::VectorPtr outputVectorYHi = _outputVectors[VECTOR_OUT_Y_HI];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Linear Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Lower Limit");
+  outputVectorYLo->setLabelInfo(label_info);
+
+  label_info.name = i18n("Linear Fit Upper Limit");
+  outputVectorYHi->setLabelInfo(label_info);
+
   int i = 0;
   int iLength;
   bool bReturn = false;
--- branches/work/kst/portto4/kst/src/plugins/fits/lorentzian_unweighted/fitlorentzian_unweighted.cpp #1224438:1224439
@@ -216,6 +216,14 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Lorentzian Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Lorentzian Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear( inputVectorX, inputVectorY,
--- branches/work/kst/portto4/kst/src/plugins/fits/lorentzian_weighted/fitlorentzian_weighted.cpp #1224438:1224439
@@ -231,6 +231,14 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Lorentzian Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Lorentzian Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
+
   bool bReturn = false;
 
   bReturn = kstfit_nonlinear_weighted( inputVectorX, inputVectorY, inputVectorWeights,
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp #1224438:1224439
@@ -193,6 +193,13 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Polynomial Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Polynomial Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   int iNumParams;
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_weighted/fitpolynomial_weighted.cpp #1224438:1224439
@@ -209,6 +209,13 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Polynomial Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Polynomial Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   int iNumParams;
--- branches/work/kst/portto4/kst/src/plugins/fits/sinusoid_unweighted/fitsinusoid_unweighted.cpp #1224438:1224439
@@ -217,6 +217,13 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Sinusoidal Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Sinusoidal Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   int iNumParams;
--- branches/work/kst/portto4/kst/src/plugins/fits/sinusoid_weighted/fitsinusoid_weighted.cpp #1224438:1224439
@@ -233,6 +233,14 @@
   Kst::VectorPtr outputVectorYCovariance = _outputVectors[VECTOR_OUT_Y_COVARIANCE];
   Kst::ScalarPtr outputScalar = _outputScalars[SCALAR_OUT];
 
+
+  Kst::LabelInfo label_info = inputVectorY->labelInfo();
+  label_info.name = i18n("Sinusoidal Fit to %1").arg(label_info.name);
+  outputVectorYFitted->setLabelInfo(label_info);
+
+  label_info.name = i18n("Sinusoidal Fit Residuals");
+  outputVectorYResiduals->setLabelInfo(label_info);
+
   bool bReturn = false;
 
   int iNumParams;


More information about the Kst mailing list