[Numpy-discussion] [numpy-discussion] Transform 3d data

Thomas Königstein thkoe002@gmail....
Mon Oct 25 04:39:54 CDT 2010


Wow, thanks a million, this worked just fine and I think I understood at
least parts of the method :)

Cheers

Thomas


*


On Tue, 2010-10-19 at 14:20 +0200, Nadav Horesh wrote:


> Of course there is an (at least one) error:

*

> the line should be:

>
> XYZ =
> np.mgrid[lwrbnd[0]:uprbnd[0]:shape[0]*1j,lwrbnd[1]:uprbnd[1]:shape[1]*1j, lwrbnd[2]:uprbnd[2]:shape[2]*1j]


> On Tue, 2010-10-19 at 14:10 +0200, Nadav Horesh wrote:
> >* You can aid mgrid, riughy as the follows (I may have mistakes, but the*> >* direction should be clear):*> >* *> >* def transform_3d_data_(field,lwrbnd,uprbnd): *> >*   shape = field.shape *> >*   XYZ = np.mgrid[lwrbnd[0]:uprbnd[0]:shape[0],*> >* lwrbnd[1]:uprbnd[1]:shape[1], lwrbnd[2]:uprbnd[2]:shape[2]] *>* **

>

** vectors = fields.reshape(-1,3) *


> >*   np.savetxt(np.hstack((XYZ.reshape(3,-1).T, vectors)))*> >* *> >* *> >*   Nadav *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101025/a66d810e/attachment.html 


More information about the NumPy-Discussion mailing list