Re: [Numpy-discussion] MATLAB to Numpy

2017-10-27 Thread Andrei Berceanu
Hmm, so how come this doesn't work now? mask = ((px > 2.) & ((py**2 + pz**2) / px**2 < 1.)) for arr in (px, py, pz, w, x, y, z): arr = arr[mask] On Mon, 23 Oct 2017 15:05:26 +0200 (CEST), "Andrei Berceanu" wrote: > Thank you so much, the solution was much simp

Re: [Numpy-discussion] MATLAB to Numpy

2017-10-23 Thread Andrei Berceanu
Thank you so much, the solution was much simpler than I expected! On Sat, 21 Oct 2017 23:04:43 +0200, Daπid wrote: > On 21 October 2017 at 22:32, Eric Wieser > wrote: > > > David, that doesn’t work, because np.cumsum(mask)[mask] is always equal > > to np.arange(mask.sum()) + 1. Robert’s answer

[Numpy-discussion] MATLAB to Numpy

2017-10-21 Thread Andrei Berceanu
Hi, I am new to Numpy, and would like to start by translating a (badly written?) piece of MATLAB code. What I have come up with so far is this: px = np.zeros_like(tmp_px); py = np.zeros_like(tmp_py); pz = np.zeros_like(tmp_pz) w = np.zeros_like(tmp_w) x = np.zeros_like(tmp_x); y = np.zeros_lik