Re: [Numpy-discussion] PyBUF_SIMPLE/PyBUF_FORMAT: casts to unsigned bytes

2011-09-01 Thread Stefan Krah
Dag Sverre Seljebotn wrote: > Under 2), would it make sense to also export the contents of a > Fortran-contiguous buffer as a raw byte stream? I was just the other week > writing code to serialize an array in Fortran order to a binary stream. Probably, since it works now and people might have got

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Nathaniel Smith
On Thu, Sep 1, 2011 at 8:31 PM, Christopher Jordan-Squire wrote: > On Thu, Sep 1, 2011 at 11:14 PM, Robert Kern wrote: >> On Thu, Sep 1, 2011 at 22:07, Christopher Jordan-Squire >> wrote: >> >>> So in the mean time, are there any suggestions for what this R sample >>> function should be called,

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Robert Kern
On Thu, Sep 1, 2011 at 22:31, Christopher Jordan-Squire wrote: > On Thu, Sep 1, 2011 at 11:14 PM, Robert Kern wrote: >> On Thu, Sep 1, 2011 at 22:07, Christopher Jordan-Squire >> wrote: >> >>> So in the mean time, are there any suggestions for what this R sample >>> function should be called, s

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Christopher Jordan-Squire
On Thu, Sep 1, 2011 at 11:14 PM, Robert Kern wrote: > On Thu, Sep 1, 2011 at 22:07, Christopher Jordan-Squire > wrote: > >> So in the mean time, are there any suggestions for what this R sample >> function should be called, since random.sample is apparently taken? > > If you default to size=1 (w

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Robert Kern
On Thu, Sep 1, 2011 at 22:07, Christopher Jordan-Squire wrote: > So in the mean time, are there any suggestions for what this R sample > function should be called, since random.sample is apparently taken? If you default to size=1 (which you probably should anyways), then np.random.choice() makes

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Christopher Jordan-Squire
On Thu, Sep 1, 2011 at 10:48 PM, Robert Kern wrote: > On Thu, Sep 1, 2011 at 21:39, Christopher Jordan-Squire > wrote: >> On Thu, Sep 1, 2011 at 10:01 PM,   wrote: > >>> First these functions would need to be deprecated. >> >> I discussed this with a few other people, and they suggested that it

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Robert Kern
On Thu, Sep 1, 2011 at 21:39, Christopher Jordan-Squire wrote: > On Thu, Sep 1, 2011 at 10:01 PM,   wrote: >> First these functions would need to be deprecated. > > I discussed this with a few other people, and they suggested that it > could be alright since it's for numpy 2.0 rather than numpy 1

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Christopher Jordan-Squire
On Thu, Sep 1, 2011 at 10:01 PM, wrote: > On Thu, Sep 1, 2011 at 6:02 PM, Christopher Jordan-Squire > wrote: >> Hi--I've just submitted a numpy 2.0 pull request for a function sample >> in np.random. It's essentially an implementation of R's sample >> function. It allows possibly non-uniform, po

Re: [Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread josef . pktd
On Thu, Sep 1, 2011 at 6:02 PM, Christopher Jordan-Squire wrote: > Hi--I've just submitted a numpy 2.0 pull request for a function sample > in np.random. It's essentially an implementation of R's sample > function. It allows possibly non-uniform, possibly without-replacement > sampling from a give

Re: [Numpy-discussion] Efficient way to load a 1Gb file?

2011-09-01 Thread Russell E. Owen
In article <781af0c6-b761-4abb-9798-938558253...@astro.physik.uni-goettingen.de>, Derek Homeier wrote: > On 11.08.2011, at 8:50PM, Russell E. Owen wrote: > > > It seems a shame that loadtxt has no argument for predicted length, > > which would allow preallocation and less appending/copying da

[Numpy-discussion] Pull Request Review: R-like sample function

2011-09-01 Thread Christopher Jordan-Squire
Hi--I've just submitted a numpy 2.0 pull request for a function sample in np.random. It's essentially an implementation of R's sample function. It allows possibly non-uniform, possibly without-replacement sampling from a given 1-D array-like. This is very useful for quickly and cleanly creating sam

Re: [Numpy-discussion] question about subtraction and shape

2011-09-01 Thread Tony Yu
On Thu, Sep 1, 2011 at 5:33 PM, Jonas Wallin wrote: > Hello, > > I implemented the following line of code: > > Gami[~index0].shape > (100,) > sigma.shape > (1,1) > Gami[~index0] = Gam[~index0] - sigma**2 > > I get the error message: > *** ValueError: array is not broadcastable

[Numpy-discussion] question about subtraction and shape

2011-09-01 Thread Jonas Wallin
Hello, I implemented the following line of code: Gami[~index0].shape > (100,) sigma.shape > (1,1) Gami[~index0] = Gam[~index0] - sigma**2 I get the error message: *** ValueError: array is not broadcastable to correct shape apparently *temp* = Gam[~index0] - sigma**2 *temp*.

Re: [Numpy-discussion] Eigenvalues did not converge

2011-09-01 Thread Charanpal Dhanjal
As Paul suggested I'd try compiling numpy with something other than the BLAS/LAPACK libraries currently in use. Here is a good place to start: http://www.scipy.org/Installing_SciPy/Linux. Charanpal On Thu, 1 Sep 2011 12:20:46 -0600, Rick Muller wrote: > Yes, as I pointed out, the problem does ru

Re: [Numpy-discussion] Eigenvalues did not converge

2011-09-01 Thread Rick Muller
Yes, as I pointed out, the problem does run on the Macintosh systems. But I'd like to be able to run these on our linux supercomputers. Surely this is possible, right? On Mon, Aug 29, 2011 at 9:31 AM, Paul Anton Letnes < paul.anton.let...@gmail.com> wrote: > I recently got into trouble with these

Re: [Numpy-discussion] A question about dtype syntax

2011-09-01 Thread Jean-Baptiste Marquette
Hi Warren & Pierre, > Notice that your array is actually a 2D structured array with shape (n, 1). > Try reshaping it to (n,) or apply np.squeeze before calling savetxt. Thanks to both of you, I made huge progress to understand how numpy arrays work. I use PyDev under Eclipse, and the debugger