[Numpy-discussion] Masking through generator arrays

Scott Ransom sransom at nrao.edu
Thu May 10 14:52:03 EDT 2012

On 05/10/2012 02:23 PM, Chris Barker wrote:
> On Thu, May 10, 2012 at 2:38 AM, Dag Sverre Seljebotn
> <d.s.seljebotn at astro.uio.no>  wrote:
>> What would serve me? I use NumPy as a glorified "double*".
>> all I want is my glorified
>> "double*". I'm probably not a representative user.)
> Actually, I think you are representative of a LOT of users -- it
> turns, out, whether Jim Huginin originally was thinking this way or
> not, but numpy arrays are really powerful because the provide BOTH and
> nifty, full featured array object in Python, AND a wrapper around a
> generic "double*" (actually char*, that could be any type).
> This is are really widely used feature, and has become even more so
> with Cython's numpy support.
> That is one of my concerns about the "bit pattern" idea -- we've then
> created a new binary type that no other standard software understands
> -- that looks like a a lot of work to me to deal with, or even worse,
> ripe for weird, non-obvious errors in code that access that good-old
> char*.
> So I'm happier with a mask implementation -- more memory, yes, but it
> seems more robust an easy to deal with with outside code.
> But either way, Dag's key point is right on -- in Cython (or any other
> code) -- we need to make sure ti's easy to get a regular old pointer
> to a regular old C array, and get something else by accident.
> -Chris

Agreed.  (As someone who has been heavily using Numpy since the early 
days of numeric, and who wrote and maintains a suite of scientific 
software that uses Numpy and its C-API in exactly this way.)

Note that I wasn't aware that the proposed mask implementation might (or 
would?) change this behavior...  (and hopefully I haven't just 
misinterpreted these last few emails.  If so, I apologize.).



Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989

More information about the NumPy-Discussion mailing list