[SciPy-User] frequency components of a signal buried in a noisy time domain signal

josef.pktd at gmail.com josef.pktd at gmail.com
Sat Feb 27 14:16:25 EST 2010


On Sat, Feb 27, 2010 at 2:07 PM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>
> On Sat, Feb 27, 2010 at 12:03 PM, Ivo Maljevic <ivo.maljevic at gmail.com>
> wrote:
>>
>> Another suggestion, and this one also makes the parallel to Matlab. Make
>> sure it works for vectors:
>>
>> >>> a=np.array([7,11,250])
>> >>> nextpow2(a)
>> array([ 3.,  4.,  8.])
>>
>
> In [27]: tab.searchsorted([7,11,250])
> Out[27]: array([3, 4, 8])
>
> In [28]: np.frexp([7,11,250])[1]
> Out[28]: array([3, 4, 8], dtype=int32)

It looks like frexp is doubling the array if n is already an integer power

>>> np.frexp(2**np.arange(5))
(array([ 0.5,  0.5,  0.5,  0.5,  0.5]), array([1, 2, 3, 4, 5]))
>>> np.arange(5)
array([0, 1, 2, 3, 4])
>>> np.ceil(np.log2(2**np.arange(5)))
array([ 0.,  1.,  2.,  3.,  4.])


Josef

>
> <snip>
>
> Chuck
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>



More information about the SciPy-User mailing list