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

Peter Kümmel syntheticpp at gmx.net
Sun Mar 20 13:19:41 CET 2011


SVN commit 1225374 by kuemmel:

mathematical form of polynom

 M  +1 -1      libkstapp/filterfitdialog.cpp  
 M  +2 -0      libkstmath/basicplugin.h  
 M  +31 -1     plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp  
 M  +1 -2      plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.h  


--- branches/work/kst/portto4/kst/src/libkstapp/filterfitdialog.cpp #1225373:1225374
@@ -279,7 +279,7 @@
 
     if (dataObject->hasParameterVector()) {
       CreateLabelCommand *cmd = new CreateLabelCommand;
-      QString *tmpstring = new QString(dataObject->label(9));
+      QString *tmpstring = new QString(dataObject->parameterVectorToString());
 
       cmd->createItem(tmpstring);
     }
--- branches/work/kst/portto4/kst/src/libkstmath/basicplugin.h #1225373:1225374
@@ -94,6 +94,8 @@
 
     virtual void internalUpdate();
     virtual bool hasParameterVector() const { return _outputVectors.contains("Parameters Vector");}
+    virtual QString parameterVectorToString() const { return label(9);}
+
   protected:
     BasicPlugin(ObjectStore *store);
     virtual ~BasicPlugin();
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp #1225373:1225374
@@ -125,7 +125,7 @@
         if (vectory) {
           setSelectedVectorX(vectory);
         }
-        QString scalarName = _cfg->value("Order Scalar").toString();
+        QString scalarName = _cfg->value("Input Order Scalar").toString();
         object = _store->retrieveObject(scalarName);
         Kst::Scalar* orderScalar = static_cast<Kst::Scalar*>(object);
         if (orderScalar) {
@@ -214,7 +214,37 @@
   return bReturn;
 }
 
+QString FitPolynomialUnweightedSource::parameterVectorToString() const {
 
+  QString str = Name();
+
+  if (hasParameterVector()) {
+    Kst::VectorPtr vectorParam = _outputVectors["Parameters Vector"];
+    //for (int i = vectorParam->length() - 1; i >= 0; i--) {
+    for (int i = 0; i < vectorParam->length(); i++) {
+      QString paramName = parameterName(i);
+      if (!paramName.isEmpty()) {
+        if (_outputScalars.contains(paramName)) {
+          QString name = _outputScalars[paramName]->Name();
+          double value = _outputScalars[paramName]->value();
+          if (i == 0) {
+            str += QString("\n[%1]").arg(name);
+          } else {
+            QString sign;
+            if (value >= 0) {
+              sign = " +";
+            }
+            str += QString("%1 [%2]%3").arg(sign).arg(_outputScalars[paramName]->Name()).arg(paramName);
+          }
+        }
+      }
+    }
+  }
+
+  return str;
+}
+
+
 Kst::VectorPtr FitPolynomialUnweightedSource::vectorX() const {
   return _inputVectors[VECTOR_IN_X];
 }
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.h #1225373:1225374
@@ -49,10 +49,9 @@
     ~FitPolynomialUnweightedSource();
 
     virtual QString parameterName(int index) const;
+    virtual QString parameterVectorToString() const;
 
   friend class Kst::ObjectStore;
-
-
 };
 
 


More information about the Kst mailing list