[Kst] extragear/graphics/kst/src/plugins/fits/kneefrequency_unweighted
Duncan Hanson
duncan.hanson at gmail.com
Wed Feb 28 02:03:42 CET 2007
SVN commit 637870 by dhanson:
It's ok to have x=0s as long as we ignore them (specifically, f=0 of power spectra)
M +7 -5 kstfit_kneefrequency_unweighted.cpp
--- trunk/extragear/graphics/kst/src/plugins/fits/kneefrequency_unweighted/kstfit_kneefrequency_unweighted.cpp #637869:637870
@@ -146,17 +146,19 @@
xi = inArrays[KNEEFREQ_XVALUES][i];
yi = inArrays[KNEEFREQ_YVALUES][i];
- if (!(xi>0) || !((yi-ybar)>0)) {
+ if (!((yi-ybar)>0)) {
////FIXME: give a more descriptive error.
//return -2; // input error: maxOneOverFFreq too large?
printf("KSTFIT_KNEE_FREQUENCY_UNWEIGHTED: ERROR. INVALID DATA?\n");
return 0; //FIXME: remove. errors for fit plugins don't seem to be handled safely right now.
}
- sumLnXLnY += log(xi)*log(yi-ybar); //-ybar to isolate 1/f noise.
- sumLnX += log(xi);
- sumLnY += log(yi-ybar);
- sumLnX2 += pow(log(xi),2);
+ if (xi>0) {
+ sumLnXLnY += log(xi)*log(yi-ybar); //-ybar to isolate 1/f noise.
+ sumLnX += log(xi);
+ sumLnY += log(yi-ybar);
+ sumLnX2 += pow(log(xi),2);
+ }
}
double a, b;
More information about the Kst
mailing list