Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109625

Re: reshape and keep x,y,z ordering

From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Subject Re: reshape and keep x,y,z ordering
Date 2016-06-07 08:48 -0400
Message-ID <mailman.58.1465303695.2306.python-list@python.org> (permalink)
References <5ef3691e-2317-41df-ad60-3d2450841413@googlegroups.com> <CAPM-O+waJvgpfoz8R2-MHK+nr9s6v+XXkmLdLjLGv+e+p-iLsA@mail.gmail.com>

Show all headers | View raw


On Tue, Jun 7, 2016 at 7:25 AM, Heli <hemla21@gmail.com> wrote:
> Hello,
>
> I have a question regarding reshaping numpy array.
>
> I either have a 1D array that I need to reshape to a 3D array or a 3D array to reshape to a 1d numpy array.
>
> In both of these cases it is assumed that data follows x,y,z ordering.
>
> and I use the following to reshape the numpy array.
>
>
> new_1d_array=np.reshape(3d.transpose(),(3d_nx*3d_ny*3d_nz,))
>
>
> new_3d_array=np.reshape(1d,((3d_x,3d_y,3d_z)).transpose())
>
> My question is if there is anyway that reshape would keep x,y,z ordering that would not require transpose? and if there is a better more efficient way to do this?
>
> Thanks alot,
> --
> https://mail.python.org/mailman/listinfo/python-list

Sorry, I can't help, others may be able to help you here.  But there
is also a numpy specific mailing list you might try

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

reshape and keep  x,y,z ordering Heli <hemla21@gmail.com> - 2016-06-07 04:25 -0700
  Re: reshape and keep x,y,z ordering Joel Goldstick <joel.goldstick@gmail.com> - 2016-06-07 08:48 -0400
  Re: reshape and keep x,y,z ordering Michael Selik <michael.selik@gmail.com> - 2016-06-07 13:16 +0000
    Re: reshape and keep x,y,z ordering Heli <hemla21@gmail.com> - 2016-06-07 06:37 -0700

csiph-web