[Kst] kdeextragear-2/kst/plugins/pass_filters

Barth Netterfield netterfield at astro.utoronto.ca
Fri Aug 27 21:01:14 CEST 2004


CVS commit by netterfield: 

Change the defaults to something possibly more useful

The bandpass limits were not being used correctly: fixes this.


  M +14 -10    butterworth_bandpass/butterworth_bandpass.cpp   1.5
  M +3 -3      butterworth_bandpass/butterworth_bandpass.xml   1.7
  M +2 -2      butterworth_highpass/butterworth_highpass.xml   1.6
  M +2 -2      butterworth_lowpass/butterworth_lowpass.xml   1.6


--- kdeextragear-2/kst/plugins/pass_filters/butterworth_bandpass/butterworth_bandpass.cpp  #1.4:1.5
@@ -8,4 +8,5 @@
 #include <math.h>
 #include "../filters.h"
+#include <gsl/gsl_pow_int.h>
 
 extern "C" int filter_bandpass(const double *const inArrays[], const int inArrayLens[],
@@ -34,8 +35,11 @@ double filter_calculate( double dFreqVal
   double dValue;
 
+  int order2 = int(2.0*inScalars[0]);
+  double lp = inScalars[1] + 0.5*inScalars[2];
+  double hp = lp - inScalars[2];
+
   if( dFreqValue > 0.0 ) {
-    dValue  = (dFreqValue * dFreqValue) - (inScalars[1] * inScalars[1]);
-    dValue /= ( dFreqValue * inScalars[2] );
-    dValue  = 1.0 / ( 1.0 + pow( dValue, 2.0 * (double)inScalars[0] ) );
+    dValue = 1.0 / ( 1.0 + gsl_pow_int( dFreqValue / lp, order2) );
+    dValue *= 1.0 / ( 1.0 + gsl_pow_int( hp / dFreqValue, order2) );
   } else {
     dValue = 0.0;

--- kdeextragear-2/kst/plugins/pass_filters/butterworth_bandpass/butterworth_bandpass.xml  #1.6:1.7
@@ -16,11 +16,11 @@
 </input>
 <input>
-<float name="Order" descr="Order of the band pass filter." />
+<float name="Order" descr="Order of the band pass filter." default="4"/>
 </input>
 <input>
-<float name="Central frequency/sample rate" descr="Central frequency of the band pass filter." default="1" />
+<float name="Central frequency/sample rate" descr="Central frequency of the band pass filter." default="0.052" />
 </input>
 <input>
-<float name="Band width" descr="Width of the band pass filter." default="1" />
+<float name="Band width" descr="Width of the band pass filter." default="0.096" />
 </input>
 

--- kdeextragear-2/kst/plugins/pass_filters/butterworth_highpass/butterworth_highpass.xml  #1.5:1.6
@@ -16,8 +16,8 @@
 </input>
 <input>
-<float name="Order" descr="Order of the high pass filter." />
+<float name="Order" descr="Order of the high pass filter." default="4"/>
 </input>
 <input>
-<float name="Cutoff frequency/sample rate" descr="Cutoff frequency of the high pass filter." default="1" />
+<float name="Cutoff frequency/sample rate" descr="Cutoff frequency of the high pass filter." default="0.02" />
 </input>
 

--- kdeextragear-2/kst/plugins/pass_filters/butterworth_lowpass/butterworth_lowpass.xml  #1.5:1.6
@@ -16,8 +16,8 @@
 </input>
 <input>
-<float name="Order" descr="Order of the low pass filter." />
+<float name="Order" descr="Order of the low pass filter." default="4"/>
 </input>
 <input>
-<float name="Cutoff frequency/sample rate" descr="Cutoff frequency of the low pass filter." default="1" />
+<float name="Cutoff frequency/sample rate" descr="Cutoff frequency of the low pass filter." default="0.1" />
 </input>
 





More information about the Kst mailing list