As you said, this did the trick.
sortedVal=np.array(val[ind]).reshape((xcoord.size,ycoord.size,zcoord.size))
Only val[ind] instead of val[ind,:] as val is 1D.
Thanks Oscar,
--
https://mail.python.org/mailman/listinfo/python-list
Thanks Oscar,
In my case this did the trick.
sortedVal=np.array(val[ind]).reshape((xcoord.size,ycoord.size,zcoord.size))
--
https://mail.python.org/mailman/listinfo/python-list
On 7 April 2016 at 15:31, Heli wrote:
>
> Thanks a lot Oscar,
>
> The lexsort you suggested was the way to go.
Glad to hear it.
> import h5py
> import numpy as np
> f=np.loadtxt(inputFile,delimiter=None)
> xcoord=np.sort(np.unique(f[:,0]))
> ycoord=np.sort(np.unique(f[:,1]))
> zcoord=np.sort(np.
Thanks a lot Oscar,
The lexsort you suggested was the way to go.
import h5py
import numpy as np
f=np.loadtxt(inputFile,delimiter=None)
xcoord=np.sort(np.unique(f[:,0]))
ycoord=np.sort(np.unique(f[:,1]))
zcoord=np.sort(np.unique(f[:,2]))
x=f[:,0]
y=f[:,1]
z=f[:,2]
val=f[:,3]
ind = np.lexsort(
On 6 April 2016 at 17:26, Heli wrote:
>
> Thanks for your replies. I have a question in regard with my previous
> question. I have a file that contains x,y,z and a value for that coordinate
> on each line. Here I am giving an example of the file using a numpy array
> called f.
>
> f=np.array([[
Thanks for your replies. I have a question in regard with my previous question.
I have a file that contains x,y,z and a value for that coordinate on each line.
Here I am giving an example of the file using a numpy array called f.
f=np.array([[1,1,1,1],
[1,1,2,2],
[1,1,3
> What you want is called *transposing* the array:
>
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.transpose.html
>
> That should be a sufficiently fast operation.
Transposing itself is fast, as it just swaps the strides and dimensions
without touching the data (i.e. it returns a n
On 23 March 2016 10:06:56 GMT+00:00, Heli wrote:
>Hi,
>
>I have a 2D numpy array like this:
>
>[[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
>Is there any fast way to convert this array to
>
>[[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
Use the transpose() method:
http://docs.scipy
On Wednesday, March 23, 2016 at 11:07:27 AM UTC+1, Heli wrote:
> Hi,
>
> I have a 2D numpy array like this:
>
> [[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
> Is there any fast way to convert this array to
>
> [[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
>
> In general I wo
On Wed, Mar 23, 2016 at 9:06 PM, Heli wrote:
> I have a 2D numpy array like this:
>
> [[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
> Is there any fast way to convert this array to
>
> [[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
What you want is called *transposing* the array:
h
On 03/23/16 at 03:06am, Heli wrote:
> I have a 2D numpy array like this:
>
> [[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
> Is there any fast way to convert this array to
>
> [[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
You don't mean just transposing your original array, as
On Wed, 23 Mar 2016 09:06 pm, Heli wrote:
> Hi,
>
> I have a 2D numpy array like this:
>
> [[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
> Is there any fast way to convert this array to
>
> [[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
Mathematically, this is called the "tran
On Jun 11, 12:29 am, Martin wrote:
> On Jun 10, 9:02 pm, Philip Semanchuk wrote:
>
>
>
> > On Jun 10, 2010, at 9:58 AM,JavierMontoyawrote:
>
> > > Dear all,
>
> > > I'm new to python and have been working with the numpy package. I have
> > > some numpy float arrays (obtained from np.fromfile and
On Jun 10, 9:02 pm, Philip Semanchuk wrote:
> On Jun 10, 2010, at 9:58 AM, Javier Montoya wrote:
>
> > Dear all,
>
> > I'm new to python and have been working with the numpy package. I have
> > some numpy float arrays (obtained from np.fromfile and np.cov
> > functions) and would like to convert t
On Jun 10, 2010, at 9:58 AM, Javier Montoya wrote:
Dear all,
I'm new to python and have been working with the numpy package. I have
some numpy float arrays (obtained from np.fromfile and np.cov
functions) and would like to convert them to simple python arrays.
I was wondering which is the best
sturlamolden wrote:
On Sep 10, 6:39 am, Travis Oliphant <[EMAIL PROTECTED]> wrote:
I wanted to point anybody interested to a blog post that describes a
useful pattern for having a NumPy array that points to the memory
created by a different memory manager than the standard one used by
NumPy.
On Sep 10, 6:39 am, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> I wanted to point anybody interested to a blog post that describes a
> useful pattern for having a NumPy array that points to the memory
> created by a different memory manager than the standard one used by
> NumPy.
Here is somethi
17 matches
Mail list logo