[Scipy-svn] r4970 - in trunk/scipy/signal: . tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Nov 3 14:50:54 EST 2008
Author: stefan
Date: 2008-11-03 13:50:36 -0600 (Mon, 03 Nov 2008)
New Revision: 4970
Added:
trunk/scipy/signal/tests/test_waveforms.py
Modified:
trunk/scipy/signal/waveforms.py
Log:
Fix initial value of logarithmic chirp [patch by Christian Christelis].
Closes #547.
Added: trunk/scipy/signal/tests/test_waveforms.py
===================================================================
--- trunk/scipy/signal/tests/test_waveforms.py 2008-11-03 19:39:36 UTC (rev 4969)
+++ trunk/scipy/signal/tests/test_waveforms.py 2008-11-03 19:50:36 UTC (rev 4970)
@@ -0,0 +1,14 @@
+#this program corresponds to special.py
+
+import numpy as np
+from numpy.testing import *
+
+import scipy.signal as signal
+
+class TestChirp(TestCase):
+ def test_log_chirp_at_zero(self):
+ assert_almost_equal(signal.waveforms.chirp(t=0, method='log'),
+ 1.0)
+
+if __name__ == "__main__":
+ run_module_suite()
Modified: trunk/scipy/signal/waveforms.py
===================================================================
--- trunk/scipy/signal/waveforms.py 2008-11-03 19:39:36 UTC (rev 4969)
+++ trunk/scipy/signal/waveforms.py 2008-11-03 19:50:36 UTC (rev 4970)
@@ -177,7 +177,7 @@
"For a logarithmic sweep, f1=%f must be larger than f0=%f."
% (f1, f0))
beta = log10(f1-f0)/t1
- phase_angle = 2*pi * (f0*t + pow(10,beta*t)/(beta*log(10)))
+ phase_angle = 2*pi * (f0*t + (pow(10,beta*t)-1)/(beta*log(10)))
else:
raise ValueError("method must be 'linear', 'quadratic', or "
"'logarithmic' but a value of %r was given." % method)
More information about the Scipy-svn
mailing list