Re: [Numpy-discussion] distributing pre-compiled f2py extensions on OSX

2012-02-25 Thread Ralf Gommers
On Fri, Feb 24, 2012 at 3:39 PM, Mark Bakker mark...@gmail.com wrote:

 Two short questions:

 1. When I distribute pre-compiled f2py extensions for OSX, it seems that
 the users need gfortran installed, else it cannot find libgfortran.3.dylib.
 Is there a way to link that file with the extension?


You can look at how this is done in Scipy.


 2. Should extensions compiled on Snowleopard work on Lion?


Yes.

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


Re: [Numpy-discussion] Problem Building Numpy with Python 2.7.1 and OS X 10.7.3

2012-02-25 Thread Ralf Gommers
On Thu, Feb 23, 2012 at 11:28 PM, Patrick Armstrong patri...@uvic.cawrote:

 Hi there,

 I'm having a problem building NumPy on Python 2.7.1 and OS X 10.7.3. Here
 is my build log:

 https://gist.github.com/1895377

 Does anyone have any idea what might be happening? I get a very similar
 error when compiling with clang.

 Installing a binary really isn't an option for me due to some specifics of
 my project. Does anyone have an idea what might be wrong?


Since you're using pip, I assume that gcc-4.2 is llvm-gcc. As a first step,
I suggest using plain gcc and not using pip (so just python setup.py
install). Also make sure you follow the recommendations in version
specific notes at http://scipy.org/Installing_SciPy/Mac_OS_X.

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


[Numpy-discussion] numpy uint16 array to unicode string

2012-02-25 Thread Janwillem
I have a buffer as a numpy array of uint16. Chunks of this buffer are 
unicode characters. How do I get these chunks, say data[start:end], in a 
string?
Other chunks are 32bit integers how do I get these chunks into a numpy 
array of int32?
Many thanks, Janwillem
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy uint16 array to unicode string

2012-02-25 Thread Robert Kern
On Sat, Feb 25, 2012 at 19:50, Janwillem jwevand...@xs4all.nl wrote:
 I have a buffer as a numpy array of uint16. Chunks of this buffer are
 unicode characters. How do I get these chunks, say data[start:end], in a
 string?

data[sart:end].tostring().decode('UTF-16LE')

or 'UTF-16BE' if they are big-endian.

 Other chunks are 32bit integers how do I get these chunks into a numpy
 array of int32?

data[start:end].view(np.int32)

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


Re: [Numpy-discussion] distributing pre-compiled f2py extensions on OSX

2012-02-25 Thread Mark Bakker
Thanks for the reply, Ralf.
Can you point me a bit in the right direction.
Scipy is pretty big.
Thanks,
Mark

--

 Message: 2
 Date: Sat, 25 Feb 2012 11:16:50 +0100
 From: Ralf Gommers ralf.gomm...@googlemail.com
 Subject: Re: [Numpy-discussion] distributing pre-compiled f2py
extensions on   OSX
 To: Discussion of Numerical Python numpy-discussion@scipy.org
 Message-ID:
CABL7CQiBO35Lo=vhzy4mnls7ks3-322gtmdz_6qebf+sjbh...@mail.gmail.com
 
 Content-Type: text/plain; charset=iso-8859-1

 On Fri, Feb 24, 2012 at 3:39 PM, Mark Bakker mark...@gmail.com wrote:

  Two short questions:
 
  1. When I distribute pre-compiled f2py extensions for OSX, it seems that
  the users need gfortran installed, else it cannot find
 libgfortran.3.dylib.
  Is there a way to link that file with the extension?
 

 You can look at how this is done in Scipy.


  2. Should extensions compiled on Snowleopard work on Lion?
 

 Yes.

 Ralf
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120225/9fa76d70/attachment-0001.html

 --


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


Re: [Numpy-discussion] numpy uint16 array to unicode string

2012-02-25 Thread Janwillem
Thanks, works, should have found that myself.

On 25-02-2012 20:56, Robert Kern wrote:
 On Sat, Feb 25, 2012 at 19:50, Janwillemjwevand...@xs4all.nl  wrote:
 I have a buffer as a numpy array of uint16. Chunks of this buffer are
 unicode characters. How do I get these chunks, say data[start:end], in a
 string?
 data[sart:end].tostring().decode('UTF-16LE')

 or 'UTF-16BE' if they are big-endian.

 Other chunks are 32bit integers how do I get these chunks into a numpy
 array of int32?
 data[start:end].view(np.int32)


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


Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-25 Thread Wes McKinney
On Fri, Feb 24, 2012 at 9:07 AM, Erin Sheldon erin.shel...@gmail.com wrote:
 Excerpts from Travis Oliphant's message of Thu Feb 23 15:08:52 -0500 2012:
 This is actually on my short-list as well --- it just didn't make it to the 
 list.

 In fact, we have someone starting work on it this week.  It is his
 first project so it will take him a little time to get up to speed on
 it, but he will contact Wes and work with him and report progress to
 this list.

 Integration with np.loadtxt is a high-priority.  I think loadtxt is
 now the 3rd or 4th text-reading interface I've seen in NumPy.  I
 have no interest in making a new one if we can avoid it.   But, we do
 need to make it faster with less memory overhead for simple cases like
 Wes describes.

 I'm willing to adapt my code if it is wanted, but at the same time I
 don't want to step on this person's toes.  Should I proceed?

 -e
 --
 Erin Scott Sheldon
 Brookhaven National Laboratory
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

That may work-- I haven't taken a look at the code but it is probably
a good starting point. We could create a new repo on the pydata GitHub
org (http://github.com/pydata) and use that as our point of
collaboration. I will hopefully be able to put some serious energy
into this this spring.

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


[Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread James Bergstra
bincount([]) makes no sense, but if a minlength argument is provided,
then the routine should succeed.
It fails in 1.6.1, has it been fixed in master?

- James
-- 
http://www-etud.iro.umontreal.ca/~bergstrj
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-25 Thread Erin Sheldon
Excerpts from Wes McKinney's message of Sat Feb 25 15:49:37 -0500 2012:
 That may work-- I haven't taken a look at the code but it is probably
 a good starting point. We could create a new repo on the pydata GitHub
 org (http://github.com/pydata) and use that as our point of
 collaboration. I will hopefully be able to put some serious energy
 into this this spring.

First I want to make sure that we are not duplicating effort of the
person Travis mentioned.

Logistically, I think it is probably easier to just fork numpy into my
github account and then work it directly into the code base, and ask for
a pull request when things are ready.

I expect I could have something with all the required features ready in
a week or so.  It is mainly just porting the code from C++ to C, and
writing the interfaces by hand instead of with swig; I've got plenty of
experience with that, so it should be straightforward.

-e
-- 
Erin Scott Sheldon
Brookhaven National Laboratory
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread Alan G Isaac
On 2/25/2012 4:44 PM, James Bergstra wrote:
 bincount([]) makes no sense,

I disagree:
http://permalink.gmane.org/gmane.comp.python.numeric.general/42041


 but if a minlength argument is provided,
 then the routine should succeed.

Definitely!

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


Re: [Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread Skipper Seabold
On Sat, Feb 25, 2012 at 5:13 PM, Alan G Isaac alan.is...@gmail.com wrote:
 On 2/25/2012 4:44 PM, James Bergstra wrote:
 bincount([]) makes no sense,

 I disagree:
 http://permalink.gmane.org/gmane.comp.python.numeric.general/42041


 but if a minlength argument is provided,
 then the routine should succeed.

 Definitely!


There's a PR to fix this here.

https://github.com/numpy/numpy/pull/84

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


Re: [Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread Benjamin Root
On Saturday, February 25, 2012, Alan G Isaac wrote:

 On 2/25/2012 4:44 PM, James Bergstra wrote:
  bincount([]) makes no sense,

 I disagree:
 http://permalink.gmane.org/gmane.comp.python.numeric.general/42041


  but if a minlength argument is provided,
  then the routine should succeed.

 Definitely!

 Alan Isaac


I thought we already fixed this? Or was that only for histogram?

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


Re: [Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread James Bergstra
On Sat, Feb 25, 2012 at 5:13 PM, Alan G Isaac alan.is...@gmail.com wrote:
 On 2/25/2012 4:44 PM, James Bergstra wrote:
 bincount([]) makes no sense,

 I disagree:
 http://permalink.gmane.org/gmane.comp.python.numeric.general/42041

gmane is down to me at the moment, but if this argues that the answer
should be [], that would make sense to me too. I was too quick about
undefining it in my post.

-- 
http://www-etud.iro.umontreal.ca/~bergstrj
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] distributing pre-compiled f2py extensions on OSX

2012-02-25 Thread Ralf Gommers
On Sat, Feb 25, 2012 at 9:29 PM, Mark Bakker mark...@gmail.com wrote:

 Thanks for the reply, Ralf.
 Can you point me a bit in the right direction.
 Scipy is pretty big.


All Fortran sources in Scipy are wrapped with f2py, and can be compiled
with gfortran the way you want. As a simple example, have a look at
integrate/setup.py to see how the extension dop is compiled. You can
probably just use a similar config.add_library() call. If you only need the
exact compile arguments, just compile scipy and get them from the build log.

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


[Numpy-discussion] Creating a bool array with Cython

2012-02-25 Thread Keith Goodman
Is this a reasonable (and fast) way to create a bool array in cython?

def makebool():
cdef:
int n = 2
np.npy_intp *dims = [n]
np.ndarray[np.uint8_t, ndim=1] a
a = PyArray_EMPTY(1, dims, NPY_UINT8, 0)
a[0] = 1
a[1] = 0
a.dtype = np.bool
return a

Will a numpy bool array be np.uint8 on all platforms?

How can I do a.dtype=np.bool using the numpy C api? Is there any point
(speed) in doing so?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-25 Thread Travis Oliphant
I will just let Jay know that he should coordinate with you.It would be 
helpful for him to have someone to collaborate with on this.  

I'm looking forward to seeing your code.   Definitely don't hold back on our 
account.  We will adapt to whatever you can offer. 

Best regards,

-Travis

On Feb 24, 2012, at 8:07 AM, Erin Sheldon wrote:

 Excerpts from Travis Oliphant's message of Thu Feb 23 15:08:52 -0500 2012:
 This is actually on my short-list as well --- it just didn't make it to the 
 list. 
 
 In fact, we have someone starting work on it this week.  It is his
 first project so it will take him a little time to get up to speed on
 it, but he will contact Wes and work with him and report progress to
 this list. 
 
 Integration with np.loadtxt is a high-priority.  I think loadtxt is
 now the 3rd or 4th text-reading interface I've seen in NumPy.  I
 have no interest in making a new one if we can avoid it.   But, we do
 need to make it faster with less memory overhead for simple cases like
 Wes describes.
 
 I'm willing to adapt my code if it is wanted, but at the same time I
 don't want to step on this person's toes.  Should I proceed?
 
 -e
 -- 
 Erin Scott Sheldon
 Brookhaven National Laboratory

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