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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Mar 23 00:22:30 CET 2011


SVN commit 1225689 by netterfield:

Create scalar inputs before creating the object, so that short name loading works.



 M  +13 -3     kneefrequency/fitkneefrequency.cpp  
 M  +8 -2      polynomial_unweighted/fitpolynomial_unweighted.cpp  
 M  +7 -1      polynomial_weighted/fitpolynomial_weighted.cpp  
 M  +10 -2     sinusoid_unweighted/fitsinusoid_unweighted.cpp  
 M  +10 -2     sinusoid_weighted/fitsinusoid_weighted.cpp  


--- branches/work/kst/portto4/kst/src/plugins/fits/kneefrequency/fitkneefrequency.cpp #1225688:1225689
@@ -440,15 +440,25 @@
 
   if (ConfigWidgetFitKneeFrequencyPlugin* config = static_cast<ConfigWidgetFitKneeFrequencyPlugin*>(configWidget)) {
 
+    Kst::ScalarPtr max;
+    Kst::ScalarPtr min;
+    Kst::ScalarPtr noise;
+
+    if (setupInputsOutputs) {
+      max = config->selectedScalarMax();
+      min = config->selectedScalarMin();
+      noise = config->selectedScalarWhiteNoise();
+    }
+
     FitKneeFrequencySource* object = store->createObject<FitKneeFrequencySource>();
 
     if (setupInputsOutputs) {
       object->setupOutputs();
       object->setInputVector(VECTOR_IN_X, config->selectedVectorX());
       object->setInputVector(VECTOR_IN_Y, config->selectedVectorY());
-      object->setInputScalar(SCALAR_IN_MAX, config->selectedScalarMax());
-      object->setInputScalar(SCALAR_IN_MIN, config->selectedScalarMin());
-      object->setInputScalar(SCALAR_IN_WHITENOISE, config->selectedScalarWhiteNoise());
+      object->setInputScalar(SCALAR_IN_MAX, max);
+      object->setInputScalar(SCALAR_IN_MIN, min);
+      object->setInputScalar(SCALAR_IN_WHITENOISE, noise);
     }
 
     object->setPluginName(pluginName());
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_unweighted/fitpolynomial_unweighted.cpp #1225688:1225689
@@ -221,7 +221,7 @@
   QString str = Name();
 
   if (hasParameterVector()) {
-    Kst::VectorPtr vectorParam = _outputVectors["Parameters Vector"];
+    Kst::VectorPtr vectorParam = _outputVectors[VECTOR_OUT_Y_PARAMETERS];
     for (int i = 0; i < vectorParam->length(); i++) {
       QString paramName = parameterName(i);
       if (!paramName.isEmpty()) {
@@ -322,13 +322,19 @@
 
   if (ConfigWidgetFitPolynomialUnweightedPlugin* config = static_cast<ConfigWidgetFitPolynomialUnweightedPlugin*>(configWidget)) {
 
+    Kst::ScalarPtr order;
+
+    if (setupInputsOutputs) {
+      order = config->selectedScalarOrder();
+    }
+
     FitPolynomialUnweightedSource* object = store->createObject<FitPolynomialUnweightedSource>();
 
     if (setupInputsOutputs) {
       object->setupOutputs();
       object->setInputVector(VECTOR_IN_X, config->selectedVectorX());
       object->setInputVector(VECTOR_IN_Y, config->selectedVectorY());
-      object->setInputScalar(SCALAR_IN, config->selectedScalarOrder());
+      object->setInputScalar(SCALAR_IN, order);
     }
 
     object->setPluginName(pluginName());
--- branches/work/kst/portto4/kst/src/plugins/fits/polynomial_weighted/fitpolynomial_weighted.cpp #1225688:1225689
@@ -342,6 +342,12 @@
 
   if (ConfigWidgetFitPolynomialWeightedPlugin* config = static_cast<ConfigWidgetFitPolynomialWeightedPlugin*>(configWidget)) {
 
+    Kst::ScalarPtr order;
+
+    if (setupInputsOutputs) {
+      order = config->selectedScalarOrder();
+    }
+
     FitPolynomialWeightedSource* object = store->createObject<FitPolynomialWeightedSource>();
 
     if (setupInputsOutputs) {
@@ -349,7 +355,7 @@
       object->setInputVector(VECTOR_IN_X, config->selectedVectorX());
       object->setInputVector(VECTOR_IN_Y, config->selectedVectorY());
       object->setInputVector(VECTOR_IN_WEIGHTS, config->selectedVectorWeights());
-      object->setInputScalar(SCALAR_IN, config->selectedScalarOrder());
+      object->setInputScalar(SCALAR_IN, order);
     }
 
     object->setPluginName(pluginName());
--- branches/work/kst/portto4/kst/src/plugins/fits/sinusoid_unweighted/fitsinusoid_unweighted.cpp #1225688:1225689
@@ -337,14 +337,22 @@
 
   if (ConfigWidgetFitSinusoidUnweightedPlugin* config = static_cast<ConfigWidgetFitSinusoidUnweightedPlugin*>(configWidget)) {
 
+    Kst::ScalarPtr harmonics;
+    Kst::ScalarPtr period;
+
+    if (setupInputsOutputs) {
+      harmonics = config->selectedScalarHarmonics();
+      period = config->selectedScalarPeriod();
+    }
+
     FitSinusoidUnweightedSource* object = store->createObject<FitSinusoidUnweightedSource>();
 
     if (setupInputsOutputs) {
       object->setupOutputs();
       object->setInputVector(VECTOR_IN_X, config->selectedVectorX());
       object->setInputVector(VECTOR_IN_Y, config->selectedVectorY());
-      object->setInputScalar(SCALAR_IN_HARMONICS, config->selectedScalarHarmonics());
-      object->setInputScalar(SCALAR_IN_PERIOD, config->selectedScalarPeriod());
+      object->setInputScalar(SCALAR_IN_HARMONICS, harmonics);
+      object->setInputScalar(SCALAR_IN_PERIOD, period);
     }
 
     object->setPluginName(pluginName());
--- branches/work/kst/portto4/kst/src/plugins/fits/sinusoid_weighted/fitsinusoid_weighted.cpp #1225688:1225689
@@ -360,6 +360,14 @@
 
   if (ConfigWidgetFitSinusoidWeightedPlugin* config = static_cast<ConfigWidgetFitSinusoidWeightedPlugin*>(configWidget)) {
 
+    Kst::ScalarPtr harmonics;
+    Kst::ScalarPtr period;
+
+    if (setupInputsOutputs) {
+      harmonics = config->selectedScalarHarmonics();
+      period = config->selectedScalarPeriod();
+    }
+
     FitSinusoidWeightedSource* object = store->createObject<FitSinusoidWeightedSource>();
 
     if (setupInputsOutputs) {
@@ -367,8 +375,8 @@
       object->setInputVector(VECTOR_IN_X, config->selectedVectorX());
       object->setInputVector(VECTOR_IN_Y, config->selectedVectorY());
       object->setInputVector(VECTOR_IN_WEIGHTS, config->selectedVectorWeights());
-      object->setInputScalar(SCALAR_IN_HARMONICS, config->selectedScalarHarmonics());
-      object->setInputScalar(SCALAR_IN_PERIOD, config->selectedScalarPeriod());
+      object->setInputScalar(SCALAR_IN_HARMONICS, harmonics);
+      object->setInputScalar(SCALAR_IN_PERIOD, period);
     }
 
     object->setPluginName(pluginName());


More information about the Kst mailing list