Re: [Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread Charles R Harris
On Tue, Feb 25, 2014 at 6:01 PM, Daniele Nicolodi wrote: > On 26/02/2014 00:04, JB wrote: > > At the risk of igniting a flame war...can someone please help me > understand > > the indexing behavior of NumPy? I will readily I admit I come from a > Matlab > > background, but I appreciate the power o

Re: [Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread Daniele Nicolodi
On 26/02/2014 00:04, JB wrote: > At the risk of igniting a flame war...can someone please help me understand > the indexing behavior of NumPy? I will readily I admit I come from a Matlab > background, but I appreciate the power of Python and am trying to learn more. > >>From a Matlab user's persp

Re: [Numpy-discussion] assigning full precision values to longdouble scalars

2014-02-25 Thread Sebastian Berg
On Di, 2014-02-25 at 17:52 -0500, Scott Ransom wrote: > Hi All, > > So I have a need to use longdouble numpy scalars in an application, and > I need to be able to reliably set long-double precision values in them. > Currently I don't see an easy way to do that. For example: > > In [19]: nump

Re: [Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread Eelco Hoogendoorn
To elaborate on what Julian wrote: it is indeed simply a convention; slices/ranges in python are from the start to one-past-the-end. The reason for the emergence of this convention is that C code using iterators looks most natural this way. This manifests in a simple for (i = 0; i < 5; i++), but al

Re: [Numpy-discussion] Custom floating point representation to IEEE 754 double

2014-02-25 Thread Daniele Nicolodi
On 26/02/2014 00:12, Oscar Benjamin wrote: > On 25 February 2014 11:08, Daniele Nicolodi wrote: >> Hello, >> >> I'm dealing with an instrument that transfers numerical values through >> an RS232 port in a custom (?) floating point representation (56 bits, 4 >> bits exponent and 52 bits significand

Re: [Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread Aaron O'Leary
Think of the python indices as the edges of the boxes, whereas the matlab indices are the boxes themselves. matlab: [1][2][3][4] python: 0[ ]1[ ]2[ ]3[ ]4[ ]5 you need to do 0:5 in python or you won't contain all the boxes! On 25 February 2014 23:04, JB wrote: > At the risk of igniting a flame

Re: [Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread Julian Taylor
On 26.02.2014 00:04, JB wrote: > At the risk of igniting a flame war...can someone please help me understand > the indexing behavior of NumPy? I will readily I admit I come from a Matlab > background, but I appreciate the power of Python and am trying to learn more. > >>From a Matlab user's persp

Re: [Numpy-discussion] Custom floating point representation to IEEE 754 double

2014-02-25 Thread Oscar Benjamin
On 25 February 2014 11:08, Daniele Nicolodi wrote: > Hello, > > I'm dealing with an instrument that transfers numerical values through > an RS232 port in a custom (?) floating point representation (56 bits, 4 > bits exponent and 52 bits significand). > > Of course I need to convert this format to

[Numpy-discussion] Help Understanding Indexing Behavior

2014-02-25 Thread JB
At the risk of igniting a flame war...can someone please help me understand the indexing behavior of NumPy? I will readily I admit I come from a Matlab background, but I appreciate the power of Python and am trying to learn more. >From a Matlab user's perspective, the behavior of indexing in NumP

[Numpy-discussion] assigning full precision values to longdouble scalars

2014-02-25 Thread Scott Ransom
Hi All, So I have a need to use longdouble numpy scalars in an application, and I need to be able to reliably set long-double precision values in them. Currently I don't see an easy way to do that. For example: In [19]: numpy.longdouble("1.12345678901234567890") Out[19]: 1.123456789012345691

Re: [Numpy-discussion] 1.8.1 release

2014-02-25 Thread Carl Kleffner
I build wheels for 32bit and 64bit (Windows, OpenBLAS) and put them here: https://drive.google.com/folderview?id=0B4DmELLTwYmlX05WSWpYVWJfRjg&usp=sharing Due to shortage of time I give not much more detailed informations before 1st of March. Carl 2014-02-25 1:53 GMT+01:00 Chris Barker : > What'

Re: [Numpy-discussion] shortcut nonzero?

2014-02-25 Thread Daniele Nicolodi
> On Tue, Feb 25, 2014 at 2:20 PM, Alan G Isaac > wrote: > > Is there a shortcut version for finding the first (k) instance(s) of > nonzero entries? > I'm thinking of Matlab's `find(X,k)`: > http://www.mathworks.com/help/matlab/ref/find.html > Easy

Re: [Numpy-discussion] shortcut nonzero?

2014-02-25 Thread Yuxiang Wang
Hi Alan, If you are only dealing with 1d array, What about: np.nonzero(your_array)[0][:k] ? -Shawn On Tue, Feb 25, 2014 at 2:20 PM, Alan G Isaac wrote: > Is there a shortcut version for finding the first (k) instance(s) of > nonzero entries? > I'm thinking of Matlab's `find(X,k)`: > http://

[Numpy-discussion] shortcut nonzero?

2014-02-25 Thread Alan G Isaac
Is there a shortcut version for finding the first (k) instance(s) of nonzero entries? I'm thinking of Matlab's `find(X,k)`: http://www.mathworks.com/help/matlab/ref/find.html Easy enough to write of course. I thought `flatnonzero` would be the obvious place for this, but it does not have a `first

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Raul Cota
Robert is right, you can always implement your own function. What version of numpy and Python are you using ? There may be something you can add to your numpy installation related to the old Numeric support which I believe is now deprecated. Raul On 25/02/2014 4:28 AM, Robert Kern wrote: >

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Jonathan T. Niehof
On 02/25/2014 09:41 AM, Alexander Belopolsky wrote: > That's not true about Python core and stdlib. Python developers strive > to maintain backward compatibility and any instance of newer python > failing to read older pickles would be considered a bug. This is even > true across 2.x / 3.x line.

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Peter Cock
On Tue, Feb 25, 2014 at 4:41 PM, Alexander Belopolsky wrote: > > On Tue, Feb 25, 2014 at 11:29 AM, Benjamin Root wrote: >> >> I seem to recall reading somewhere that pickles are not intended to be >> long-term archives as there is no guarantee that a pickle made in one >> version of python would

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Julian Taylor
On Tue, Feb 25, 2014 at 5:41 PM, Alexander Belopolsky wrote: > > On Tue, Feb 25, 2014 at 11:29 AM, Benjamin Root wrote: >> >> I seem to recall reading somewhere that pickles are not intended to be >> long-term archives as there is no guarantee that a pickle made in one >> version of python would

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Alexander Belopolsky
On Tue, Feb 25, 2014 at 11:29 AM, Benjamin Root wrote: > I seem to recall reading somewhere that pickles are not intended to be > long-term archives as there is no guarantee that a pickle made in one > version of python would work in another version, much less between > different versions of the

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Benjamin Root
Just to echo this sentiment a bit. I seem to recall reading somewhere that pickles are not intended to be long-term archives as there is no guarantee that a pickle made in one version of python would work in another version, much less between different versions of the same (or similar) packages. B

Re: [Numpy-discussion] numpy.random.geometric is shifted

2014-02-25 Thread Robert Kern
On Tue, Feb 25, 2014 at 4:06 PM, Alan G Isaac wrote: > Just got momentarily snagged by not checking the > excellent documentation, which clearly says that > numpy provides the shifted geometric. I'm wondering > why? As with most such questions, because the reference I was working from defined it

[Numpy-discussion] numpy.random.geometric is shifted

2014-02-25 Thread Alan G Isaac
Just got momentarily snagged by not checking the excellent documentation, which clearly says that numpy provides the shifted geometric. I'm wondering why? Who else does? (Not Mathematica, Matlab, Maple, or Octave.) Thanks, Alan Isaac ___ NumPy-Discussi

[Numpy-discussion] ANN: SfePy 2014.1

2014-02-25 Thread Robert Cimrman
I am pleased to announce release 2014.1 of SfePy. Description --- SfePy (simple finite elements in Python) is a software for solving systems of coupled partial differential equations by the finite element method. The code is based on NumPy and SciPy packages. It is distributed under the ne

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Robert Kern
On Tue, Feb 25, 2014 at 8:19 AM, Chris wrote: > I have some old code that uses cPickle.loads which used to work, but now > reports an error in loading the module Numeric. Since Numeric has been > replaced by numpy, this makes sense, but, how can I get cPickle.loads to > work? I tested the code aga

[Numpy-discussion] Custom floating point representation to IEEE 754 double

2014-02-25 Thread Daniele Nicolodi
Hello, I'm dealing with an instrument that transfers numerical values through an RS232 port in a custom (?) floating point representation (56 bits, 4 bits exponent and 52 bits significand). Of course I need to convert this format to a standard IEEE 754 double to be able to do anything useful with

Re: [Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Pierre Haessig
Hi, Le 25/02/2014 09:19, Chris a écrit : > I have some old code that uses cPickle.loads which used to work, but now > reports an error in loading the module Numeric. Since Numeric has been > replaced by numpy, this makes sense, but, how can I get cPickle.loads to > work? I tested the code again on

[Numpy-discussion] cPickle.loads and Numeric

2014-02-25 Thread Chris
I have some old code that uses cPickle.loads which used to work, but now reports an error in loading the module Numeric. Since Numeric has been replaced by numpy, this makes sense, but, how can I get cPickle.loads to work? I tested the code again on an older machine and it works fine there, but, I'