Re: [Numpy-discussion] [SciPy-Dev] Hamming etc. windows are wrong

2014-09-27 Thread Robert Kern
On Sat, Sep 27, 2014 at 1:10 AM, Jerry lancebo...@qwest.net wrote:

 I don't recall what I had imported, but probably scipy, as in import
 scipy, or maybe import scipy as sc. I do believe that I was working
 interactively so I don't have any actual evidence at this point.

 But I just had this thought—maybe I was in numpy and not scipy. For some
 reason both numpy and scipy provide a hamming function (why?) so maybe I was
 using the numpy version by accident which IIRC does not have the second
 argument.

 My sample code is in Octave. 8^)

scipy's hamming() function is scipy.signal.hamming(). It's in the
subpackage, and you need to import it like so:

  from scipy import signal
  signal.hamming(...)

There *is* a scipy.hamming() function as well, which is just an alias
for numpy.hamming().

  [~]
  |1 import scipy

  [~]
  |2 import numpy

  [~]
  |3 scipy.hamming is numpy.hamming
  True

Explaining why is a long story, but let's just say historical
reasons and leave it at that. You almost never want to just import
scipy. All of the scipy goodness is in the subpackages.

-- 
Robert Kern
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [SciPy-Dev] Hamming etc. windows are wrong

2014-09-26 Thread Daπid
On 26 September 2014 10:41, Jerry lancebo...@qwest.net wrote:

  I am just learning Python-NumPy-SciPy but it appears as though the
 SciPy situation is that the documentation page above *** mentions the flag
 but the flag has not been implemented into SciPy itself. I would be glad to
 stand corrected.


Regarding this, you can look at the source:

odd = M % 2
if not sym and not odd:
w = w[:-1]

so it is implemented  in Scipy, explicitely limited to even windows. It is
not in Numpy, though (but that can be fixed).

I think a reference is worth adding to the documentation, to make the
intent and application of the sym flag clear. I am sure a PR will be most
appreciated.


/David.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [SciPy-Dev] Hamming etc. windows are wrong

2014-09-26 Thread Jerry

On Sep 26, 2014, at 2:56 AM, Daπid davidmen...@gmail.com wrote:

 
 On 26 September 2014 10:41, Jerry lancebo...@qwest.net wrote:
  I am just learning Python-NumPy-SciPy but it appears as though the SciPy 
 situation is that the documentation page above *** mentions the flag but the 
 flag has not been implemented into SciPy itself. I would be glad to stand 
 corrected.

Hmm Earlier I was getting a Python error when I tried to supply the second 
argument, sym. That was the reason for my comment but now it accepts the second 
argument without complaint.
 
 Regarding this, you can look at the source:
 
 odd = M % 2
 if not sym and not odd:
 w = w[:-1]
 
 so it is implemented  in Scipy, explicitely limited to even windows.

I can't see any reason this should be limited to even-length windows. Like I 
said in my original note, the principal applies regardless of even- or 
odd-length windows.

Jerry

 It is not in Numpy, though (but that can be fixed).
 
 I think a reference is worth adding to the documentation, to make the intent 
 and application of the sym flag clear. I am sure a PR will be most 
 appreciated.
 
  
 /David.
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [SciPy-Dev] Hamming etc. windows are wrong

2014-09-26 Thread Paul Hobson
On Fri, Sep 26, 2014 at 3:39 AM, Jerry lancebo...@qwest.net wrote:


 On Sep 26, 2014, at 2:56 AM, Daπid davidmen...@gmail.com wrote:


 On 26 September 2014 10:41, Jerry lancebo...@qwest.net wrote:

  I am just learning Python-NumPy-SciPy but it appears as though the
 SciPy situation is that the documentation page above *** mentions the flag
 but the flag has not been implemented into SciPy itself. I would be glad to
 stand corrected.


 Hmm Earlier I was getting a Python error when I tried to supply the
 second argument, sym. That was the reason for my comment but now it accepts
 the second argument without complaint.


Just curious: had you imported pylab at any point? You sample code looks
like you did several from xxx import * and it might have clobbered the
scipy version (or vise versa).
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [SciPy-Dev] Hamming etc. windows are wrong

2014-09-26 Thread Jerry

On Sep 26, 2014, at 2:03 PM, Paul Hobson pmhob...@gmail.com wrote:

 
 
 On Fri, Sep 26, 2014 at 3:39 AM, Jerry lancebo...@qwest.net wrote:
 
 On Sep 26, 2014, at 2:56 AM, Daπid davidmen...@gmail.com wrote:
 
 
 On 26 September 2014 10:41, Jerry lancebo...@qwest.net wrote:
  I am just learning Python-NumPy-SciPy but it appears as though the 
 SciPy situation is that the documentation page above *** mentions the flag 
 but the flag has not been implemented into SciPy itself. I would be glad to 
 stand corrected.
 
 Hmm Earlier I was getting a Python error when I tried to supply the 
 second argument, sym. That was the reason for my comment but now it accepts 
 the second argument without complaint.
 
 Just curious: had you imported pylab at any point? You sample code looks like 
 you did several from xxx import * and it might have clobbered the scipy 
 version (or vise versa).

I don't recall what I had imported, but probably scipy, as in import scipy, 
or maybe import scipy as sc. I do believe that I was working interactively so 
I don't have any actual evidence at this point.

But I just had this thought—maybe I was in numpy and not scipy. For some reason 
both numpy and scipy provide a hamming function (why?) so maybe I was using the 
numpy version by accident which IIRC does not have the second argument.

My sample code is in Octave. 8^)

Jerry
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion