[Kst] [Bug 129598] Inconsistent UI in regard to color palette

Duncan Hanson duncan.hanson at gmail.com
Thu Jun 22 23:44:23 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=129598         




------- Additional Comments From duncan.hanson gmail com  2006-06-22 23:44 -------
SVN commit 554016 by dhanson:

CCBUG:129598 i find that the psds calculated with psdcalculator differ from those calculated by KstPSD because of normalization. i've reverted PSDCalculator to the original normalization- but I can't see that I've done anything wrong.

 M  +12 -2     psdcalculator.cpp  


--- trunk/extragear/graphics/kst/src/libkstmath/psdcalculator.cpp #554015:554016
 @ -33,7 +33,7  @
 #define PSDMINLEN 2
 #define PSDMAXLEN 27
 
-double PSDCalculator::cabs2(double r, double i) {
+inline double PSDCalculator::cabs2(double r, double i) {
   return r*r + i*i;
 }
 
 @ -184,7 +184,7  @
     updateWindowFxn(apodizeFxn, gaussianSigma);
   }
 
-  int currentCopyLen;
+  int currentCopyLen, nsamples = 0;
   int i_samp, i_subset, ioffset;
 
   memset(output, 0, sizeof(double)*outputLen); // initialize output.
 @ -246,6 +246,8  @
       }
     }
 
+    nsamples += currentCopyLen;
+
     rdft(_awLen, 1, _a); //real discrete fourier transorm on _a.
 
     output[0] += _a[0] * _a[0];
 @ -255,6 +257,9  @
     }
   }
 
+  // FIXME: NORMALIZATION. 
+  /* This normalization doesn't give the same results as the original KstPSD.
+
   double frequencyStep = .5*(double)inputSamplingFreq/(double)(outputLen-1);
 
   //normalization factors which were left out earlier for speed. 
 @ -262,7 +267,12  @
   //    - /(_awLen*_awLen) for the constant Wss from numerical recipes in C. (ensure that the window function agrees with this.)
   //    - /i_subset to average the powers in all the subsets.
   double norm = 2.0/(double)_awLen/(double)_awLen/(double)i_subset;
+  */
 
+  // original normalization
+  double frequencyStep = 2.0*(double)inputSamplingFreq/(double)nsamples; //OLD value for frequencyStep.
+  double norm = 2.0/(double)nsamples*2.0/(double)nsamples; //OLD value for norm.
+
   switch (outputType) {
   default:
     case PSDAmplitudeSpectralDensity: // amplitude spectral density (default) [V/Hz^1/2]


More information about the Kst mailing list