Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Sturla Molden
Daniele Nicolodi wrote: > Sure, I realize that, thank for the clarification. The arrays are quite > small, then the three loops and the temporary take negligible time and > memory in the overall processing. If they are small, a Python loop would do the job as well. And if it doesn't, it is just

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
On 11/02/2014 18:18, Sturla Molden wrote: > Daniele Nicolodi wrote: > >> That's more or less my current approach (except that I use the fact that >> the data is evenly samples to use np.where(np.diff(t1) != dt) to detect >> the regions of continuous data, to avoid the loop. > > I hope you realiz

Re: [Numpy-discussion] Geometrically defined masking arrays; how to optimize?

2014-02-11 Thread Daπid
A small improvement: # Dimensions N = 100 M = 200 # Coordinates of the centre x0 = 40 y0 = 70 x, y = np.meshgrid(np.arange(N) - x0, np.arange(M) - y0, sparse=True) # Center at 40, 70, radius 20 out_circle = (x * x + y * y < 20**2) out_ring = out_circle - (x * x + y * y < 10**2) plt.imshow(out

Re: [Numpy-discussion] Geometrically defined masking arrays; how to optimize?

2014-02-11 Thread Daπid
Here it is an example: import numpy as np import pylab as plt N = 100 M = 200 x, y = np.meshgrid(np.arange(N), np.arange(M)) # Center at 40, 70, radius 20 x -= 40 y -= 70 out_circle = (x * x + y * y < 20**2) out_ring = out_circle - (x * x + y * y < 10**2) plt.imshow(out_circle) plt.figure() pl

[Numpy-discussion] Geometrically defined masking arrays; how to optimize?

2014-02-11 Thread Wolfgang Draxinger
Hi, I implemented the following helper function to create masking arrays: def gen_mask(self, ring, sector): in_segment = None if ring == 0: radius = self.scales()[0] def in_center_circle(xy): dx = xy[0] - self.xy[0]

Re: [Numpy-discussion] Suggestions for GSoC Projects

2014-02-11 Thread Pauli Virtanen
Hi, 08.02.2014 06:16, Stéfan van der Walt kirjoitti: > On 8 Feb 2014 04:51, "Ralf Gommers" wrote: >> >>> Members of the dipy team would also be interested. >> >> That's specifically for the spherical harmonics topic right? > > Right. Spherical harmonics are used as bases in many of DiPy's > rec

Re: [Numpy-discussion] Suggestions for GSoC Projects

2014-02-11 Thread Pauli Virtanen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, 04.02.2014 20:30, jennifer stone kirjoitti: > 3. As stated earlier, we have spherical harmonic functions (with > much scope >>> for dev) we are yet to have elliptical and cylindrical harmonic >>> function, which may be developed. >> >> This sound

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Matthew Brett
Hi, On Tue, Feb 11, 2014 at 11:40 AM, Pauli Virtanen wrote: > 11.02.2014 21:20, alex kirjoitti: > [clip] >> In the spirit of offsetting this bias and because this thread is >> lacking in examples of projects that use numpy.matrix, here's another >> data point: cvxpy (https://github.com/cvxgrp/cvx

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Pauli Virtanen
11.02.2014 21:20, alex kirjoitti: [clip] > In the spirit of offsetting this bias and because this thread is > lacking in examples of projects that use numpy.matrix, here's another > data point: cvxpy (https://github.com/cvxgrp/cvxpy) is a serious > active project that supports the numpy.matrix inte

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread alex
On Tue, Feb 11, 2014 at 12:05 PM, Matthew Brett wrote: > Hi, > > On Tue, Feb 11, 2014 at 8:55 AM, wrote: >> >> >> On Tue, Feb 11, 2014 at 11:25 AM, Matthew Brett >> wrote: >>> >>> Hi, >>> >>> On Tue, Feb 11, 2014 at 4:16 AM, Jacco Hoekstra - LR >>> wrote: >>> > For our students, the matrix cla

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread alex
On Tue, Feb 11, 2014 at 12:14 PM, Chris Barker wrote: > On Tue, Feb 11, 2014 at 8:25 AM, Matthew Brett > wrote: >> >> > Anyway, I would say that there is a clear use for the matrix class: >> > readability of linear algebra code and hence a lower chance of errors, so >> > higher productivity. >> >

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread josef . pktd
On Tue, Feb 11, 2014 at 12:14 PM, Chris Barker wrote: > On Tue, Feb 11, 2014 at 8:25 AM, Matthew Brett wrote: > >> > Anyway, I would say that there is a clear use for the matrix class: >> readability of linear algebra code and hence a lower chance of errors, so >> higher productivity. >> >> Yes, b

Re: [Numpy-discussion] record arrays with char*?

2014-02-11 Thread Chris Barker
On Tue, Feb 11, 2014 at 8:57 AM, Christopher Jordan-Squire wrote: > Thanks for the answers! My responses are inline. my C is a bit weak, so forgive my misunderstanding, but: >> { >> char* ind; >> double val, wght; >> } data[] = { {"camera", 15, 2}, {"necklace", 100, 20}, {"vase", 90, 20}, >>

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Sturla Molden
Daniele Nicolodi wrote: > That's more or less my current approach (except that I use the fact that > the data is evenly samples to use np.where(np.diff(t1) != dt) to detect > the regions of continuous data, to avoid the loop. I hope you realize that np.where(np.diff(t1) != dt) generates three lo

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Chris Barker
On Tue, Feb 11, 2014 at 8:25 AM, Matthew Brett wrote: > > Anyway, I would say that there is a clear use for the matrix class: > readability of linear algebra code and hence a lower chance of errors, so > higher productivity. > > Yes, but it looks like there are not any developers on this list who

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Matthew Brett
Hi, On Tue, Feb 11, 2014 at 8:55 AM, wrote: > > > On Tue, Feb 11, 2014 at 11:25 AM, Matthew Brett > wrote: >> >> Hi, >> >> On Tue, Feb 11, 2014 at 4:16 AM, Jacco Hoekstra - LR >> wrote: >> > For our students, the matrix class is really appealing as we use a lot >> > of linear algebra and expre

Re: [Numpy-discussion] record arrays with char*?

2014-02-11 Thread Christopher Jordan-Squire
Thanks for the answers! My responses are inline. On Tue, Feb 11, 2014 at 8:36 AM, Chris Barker wrote: > On Mon, Feb 10, 2014 at 10:43 PM, Christopher Jordan-Squire > wrote: >> >> I'm trying to wrap some C code using cython. The C code can take >> inputs in two modes: dense inputs and sparse inpu

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread josef . pktd
On Tue, Feb 11, 2014 at 11:25 AM, Matthew Brett wrote: > Hi, > > On Tue, Feb 11, 2014 at 4:16 AM, Jacco Hoekstra - LR > wrote: > > For our students, the matrix class is really appealing as we use a lot > of linear algebra and expressions with matrices simply look better with an > operator instead

Re: [Numpy-discussion] record arrays with char*?

2014-02-11 Thread Chris Barker
On Mon, Feb 10, 2014 at 10:43 PM, Christopher Jordan-Squire wrote: > I'm trying to wrap some C code using cython. The C code can take > inputs in two modes: dense inputs and sparse inputs. For dense inputs > the array indexing is naive. I have wrappers for that. In the sparse > case the matrix en

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Matthew Brett
Hi, On Tue, Feb 11, 2014 at 4:16 AM, Jacco Hoekstra - LR wrote: > For our students, the matrix class is really appealing as we use a lot of > linear algebra and expressions with matrices simply look better with an > operator instead of a function: > > x=A.I*b > > looks much better than

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
On 11/02/2014 15:38, Sturla Molden wrote: > Daniele Nicolodi wrote: > >> I was probably not that clear: I have two 2xN arrays, one for each data >> recording, one column for time (taken from the same clock for both >> measurements) and one with data values. Each array has some gaps. > > If you

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Joris Van den Bossche
2014-02-11 14:55 GMT+01:00 Andreas Hilboll : > On 11.02.2014 14:47, Daniele Nicolodi wrote: > > On 11/02/2014 14:41, Andreas Hilboll wrote: > >> On 11.02.2014 14:22, Daniele Nicolodi wrote: > >>> On 11/02/2014 14:10, Andreas Hilboll wrote: > On 11.02.2014 14:08, Daniele Nicolodi wrote: >

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Sturla Molden
Daniele Nicolodi wrote: > I was probably not that clear: I have two 2xN arrays, one for each data > recording, one column for time (taken from the same clock for both > measurements) and one with data values. Each array has some gaps. If you want all subarrays where both timeseries are sampled,

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Alan G Isaac
On 2/11/2014 5:25 AM, Pauli Virtanen wrote: > the ndarray is also lacking some useful things, as > you point out. But I think the right solution would be to stuff > the required additions into ndarray, rather than retaining the > otherwise incompatible np.matrix as a crutch. Given that we now h

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread RayS
At 06:07 AM 2/11/2014, you wrote: >On 11/02/2014 14:56, Sturla Molden wrote: > > Daniele Nicolodi wrote: > > > >> Correct me if I'm wrong, but this assumes that missing data points are > >> represented with Nan. In my case missing data points are just missing. > > > > Then your data cannot be sto

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
On 11/02/2014 14:56, Sturla Molden wrote: > Daniele Nicolodi wrote: > >> Correct me if I'm wrong, but this assumes that missing data points are >> represented with Nan. In my case missing data points are just missing. > > Then your data cannot be stored in a 2 x N array as you indicated. I wa

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread RayS
> On 11.02.2014 14:08, Daniele Nicolodi wrote: >> Hello, >> >> I have two time series (2xN dimensional arrays) recorded on the same >> time basis, but each with it's own dead times (and start and end >> recording times). I would like to obtain two time series containing >> only the time overlap

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Sturla Molden
Daniele Nicolodi wrote: > Correct me if I'm wrong, but this assumes that missing data points are > represented with Nan. In my case missing data points are just missing. Then your data cannot be stored in a 2 x N array as you indicated. Sturla ___

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread RayS
> On 11.02.2014 14:08, Daniele Nicolodi wrote: >> Hello, >> >> I have two time series (2xN dimensional arrays) recorded on the same >> time basis, but each with it's own dead times (and start and end >> recording times). I would like to obtain two time series containing >> only the time overlap

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Andreas Hilboll
On 11.02.2014 14:47, Daniele Nicolodi wrote: > On 11/02/2014 14:41, Andreas Hilboll wrote: >> On 11.02.2014 14:22, Daniele Nicolodi wrote: >>> On 11/02/2014 14:10, Andreas Hilboll wrote: On 11.02.2014 14:08, Daniele Nicolodi wrote: > Hello, > > I have two time series (2xN dimension

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Sturla Molden
Daniele Nicolodi wrote: > I can imagine strategies about how to approach the problem, but none > that would be efficient. Ideas? I would just loop from the start and loop from the end and find out where to clip. Then slice in between. If Python loops take too much time, JIT compile them with

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
On 11/02/2014 14:41, Andreas Hilboll wrote: > On 11.02.2014 14:22, Daniele Nicolodi wrote: >> On 11/02/2014 14:10, Andreas Hilboll wrote: >>> On 11.02.2014 14:08, Daniele Nicolodi wrote: Hello, I have two time series (2xN dimensional arrays) recorded on the same time basis, but

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Andreas Hilboll
On 11.02.2014 14:22, Daniele Nicolodi wrote: > On 11/02/2014 14:10, Andreas Hilboll wrote: >> On 11.02.2014 14:08, Daniele Nicolodi wrote: >>> Hello, >>> >>> I have two time series (2xN dimensional arrays) recorded on the same >>> time basis, but each with it's own dead times (and start and end >>>

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
On 11/02/2014 14:10, Andreas Hilboll wrote: > On 11.02.2014 14:08, Daniele Nicolodi wrote: >> Hello, >> >> I have two time series (2xN dimensional arrays) recorded on the same >> time basis, but each with it's own dead times (and start and end >> recording times). I would like to obtain two time s

Re: [Numpy-discussion] Overlapping time series

2014-02-11 Thread Andreas Hilboll
On 11.02.2014 14:08, Daniele Nicolodi wrote: > Hello, > > I have two time series (2xN dimensional arrays) recorded on the same > time basis, but each with it's own dead times (and start and end > recording times). I would like to obtain two time series containing > only the time overlapping segme

[Numpy-discussion] Overlapping time series

2014-02-11 Thread Daniele Nicolodi
Hello, I have two time series (2xN dimensional arrays) recorded on the same time basis, but each with it's own dead times (and start and end recording times). I would like to obtain two time series containing only the time overlapping segments of the data. Does numpy or scipy offer something tha

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Sturla Molden
Pauli Virtanen wrote: > [1] http://fperez.org/py4science/numpy-pep225/numpy-pep225.html I have to agree with Robert Kern here. One operator that we can (ab)use for matrix multiplication would suffice. Sturla ___ NumPy-Discussion mailing list NumPy-Di

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Jacco Hoekstra - LR
For our students, the matrix class is really appealing as we use a lot of linear algebra and expressions with matrices simply look better with an operator instead of a function: x=A.I*b looks much better than x = np.dot(np.linalg.inv(A),b) And this gets worse when the expres

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Pauli Virtanen
Sturla Molden gmail.com> writes: > Pauli Virtanen iki.fi> wrote: > > It is not a good thing that there is no well defined > > "domain specific language" for matrix algebra in Python. > > Perhaps Python should get some new operators? It might still be possible to advocate for this in core Python

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Sturla Molden
Pauli Virtanen wrote: > It is not a good thing that there is no well defined > "domain specific language" for matrix algebra in Python. Perhaps Python should get some new operators? __dot__ __cross__ __kronecker__ Obviously, using them in real Python code would require unicode. ;-) On the se

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Eelco Hoogendoorn
My 2pc: I personally hardly ever use matrix, even in linear algebra dense code. It can be nice though, to use matrix semantics within a restricted scope. When I first came to numpy, the ability to choose linear algebra versus array semantics seemed like a really neat thing to me; though in practic

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Pauli Virtanen
Alan G Isaac gmail.com> writes: [clip] > Here, quacking is behaving like an ndarray (in your view, > as I understand it) when asked. But how do we ask? > Your view (if I understand) is we ask via the operations > supported by ndarrays. But maybe that is the wrong way > for the library to ask thi

Re: [Numpy-discussion] Inheriting from ndarray Was: deprecate numpy.matrix

2014-02-11 Thread Todd
On Feb 11, 2014 5:01 AM, "Alexander Belopolsky" wrote: > > > On Mon, Feb 10, 2014 at 11:31 AM, Nathaniel Smith wrote: >> >> And in the long run, I >> think the goal is to move people away from inheriting from np.ndarray. > > > This is music to my ears, There are a lot of units (meter, foot, buil

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-11 Thread Todd
On Feb 11, 2014 3:23 AM, "Alan G Isaac" wrote: > > On 2/10/2014 7:39 PM, Pauli Virtanen wrote: > > The issue here is semantics for basic linear algebra operations, such as > > matrix multiplication, that work for different matrix objects, including > > ndarrays. > > > I'll see if I can restate my