[Scipy-tickets] [SciPy] #1105: Logarithmic chirp frequency sweep incorrect

SciPy Trac scipy-tickets@scipy....
Sun Jan 31 05:55:55 CST 2010

#1105: Logarithmic chirp frequency sweep incorrect
 Reporter:  johntryan                    |       Owner:  somebody
     Type:  defect                       |      Status:  new     
 Priority:  normal                       |   Milestone:  0.8.0   
Component:  scipy.signal                 |     Version:  0.7.0   
 Keywords:  chirp logarithmic frequency  |  
 The algorithm used to calculate the frequency sweep in waveforms.py is

 In the current implementation in scipy, if the start and end frequencies
 differ by 1, there is an exception due to taking log of 0 in beta =
 log10(f1-f0)/t1, however this is a valid sweep range and should work.

 Ticket 547 quotes this source for the algorithm

 I think that this source is incorrect.

 From basics, a plot of log(frequency) vs time should be a straight line
 with equation y=mx+c

 The slope m is
 (log(end_frequency) - log(start_freqency)) / (end_time - start_time)
 The reference has this incorrectly as log(start_frequency-end_frequency) /

 The constant c is log(start_freqency)

 The following code fragment implements a logarithmic sweep

     elif method in ['logarithmic','log','lo']:
         logf0 = log10( f0 )
         beta = (log10(f1)-logf0)/t1
         freq = pow(10,beta*t+logf0)
         phase_angle = 2*pi*freq*t


 With this code the f0 and f1 can be equal, and downward sweeps work (f0 >
 f1), hence there is no need to raise a valueerror if f1 <= f0.

 This defect is present in the 0.8.0 code from subversion.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1105>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list