Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: reshape and keep x,y,z ordering Date: Tue, 7 Jun 2016 08:48:05 -0400 Lines: 30 Message-ID: References: <5ef3691e-2317-41df-ad60-3d2450841413@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de y0nGfV9P8nfyp7l3iXURJwunjZPzDLXclnEbukIhdj+w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'array.': 0.07; 'cc:addr :python-list': 0.09; 'assumed': 0.09; 'received:209.85.218': 0.10; 'url:blog': 0.10; 'anyway': 0.11; '2016': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:n 50': 0.16; 'x,y,z': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'skip:n 60': 0.22; 'sorry,': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'follows': 0.29; 'array': 0.29; 'url:mailman': 0.30; "can't": 0.32; 'help,': 0.32; 'url:python': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'this?': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'cases': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'mailing': 0.38; 'data': 0.39; 'url:mail': 0.40; 'hello,': 0.40; 'here.': 0.62; 'more': 0.63; 'url:info': 0.71; 'subject:,': 0.82; '7:25': 0.84; 'to:none': 0.91; 'joel': 0.91; 'subject:keep': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=couEdiuHZ2VADU/P8KuFSYcoEnOtGHaPr1M9ovqFX18=; b=Fxycl6QmZKz5vx59tW+VwnA3GcjGs2l34IZpCGR99sHnJ5d8lVK2N2z4kFjApi4bmY HXJ2zIDwgKgFsrFkNfj8dUe2AdmprDHKyfxgmOfpBvzkpaqDM5rhWFglObpJuvgWfuq7 sA3bHThMW4FAZdmkhz93eN/DHGuofoTPia6vbnGhp+LN+r/2XrJMhDSFHjuI2SXpA6Tx Zie/9d/5XJKl0aXb2lveFXm08+QtS+OLqTlLsRmT6b9pUfXqxuWNAkBaiI/3ZW7FvqPW rnGZHDPS2iztG13S+W9btC5BYAZb3Mr7OC8wHtuOBRiuvjeH6TxplEo9sf8jlJxvHpl4 s8Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=couEdiuHZ2VADU/P8KuFSYcoEnOtGHaPr1M9ovqFX18=; b=VHPc612ZtQchlKIOrdL3rLUojAPNKZmn1c0STAkt2feXa3i+rNFL/Db28AJxO4mpQt w5R4R0xQsi2s9KbQP0JkZY5oT2w0PuTnKmiWL8jwAvT//xz9k1EJpkvaQMpdnyneCSta 2Or4vJvY8iZ0hEDukhxUg3s9+a+XF/QxgyIHRUYBdb17K/AbrbGxZDX3/M5Dgof6LPT0 lkkXmE99CUWUJNAXBI+XviGEYpiAiROYIeQUpR9KGbdmbA9bmIV5hopENtbotGh0Jarf dd2RMTBuIRI966f1rGMmvxsV/mQksMAV3rmx1oCNFtf1Rdp7s/AU47sttP6ubWHPu2K9 nyRQ== X-Gm-Message-State: ALyK8tJ+cJ93PTcdF937oB/MHmuSIrTxPwAAV9RMDMrOMd7WLfn46aw4kbCYbzK4UiOj/zq2E0UBab+JtERY7w== X-Received: by 10.157.4.116 with SMTP id 107mr10384804otc.171.1465303686055; Tue, 07 Jun 2016 05:48:06 -0700 (PDT) In-Reply-To: <5ef3691e-2317-41df-ad60-3d2450841413@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5ef3691e-2317-41df-ad60-3d2450841413@googlegroups.com> Xref: csiph.com comp.lang.python:109625 On Tue, Jun 7, 2016 at 7:25 AM, Heli 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