Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-16 Thread Friedrich Romstedt
Ok, maybe can you print shape of the {rho} array as calculated my matlab? I know that sum() in matlab sums over rows (i.e., the first dimension), but I'm curious if it returns for an, say, (10x20) array an (20,) array or an (1, 20) array. And to Josef: cx is an 1d vector, so no. And Hmmm ...

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-15 Thread Friedrich Romstedt
Ok, so I send yet another version. Maybe Bruce is right, but I didn't care, because we have fret enough. Now it not only computes something, but also displays something :-( Nicolas, maybe you can now waste some of your time with it? I was curious, both to understand and to get it working, but

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-15 Thread Nicolas Rougier
Thanks and in fact, I already wasted quite some time on and your last version will help me a lot. Unfortunately, I'm not a specialist at lattice Boltzmann methods at all so I'm not able to answer your questions (my initial idea was to convert the matlab script to be have a running example to

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-15 Thread josef . pktd
On Mon, Mar 15, 2010 at 5:58 PM, Nicolas Rougier nicolas.roug...@loria.fr wrote: Thanks and in fact, I already wasted quite some time on and your last version will help me a lot. Unfortunately, I'm not a specialist at lattice Boltzmann methods at all so I'm not able to answer your questions

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-14 Thread Nicolas Rougier
Thanks a lot for the translation. I think the opp relates to the opp array declared at the top and the circshift can be made using numpy roll. I modified your translation to include them. The results should be something like http://www.lbmethod.org/openlb/gif/karman.avi (I think) but

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-14 Thread Bruce Southey
On Sun, Mar 14, 2010 at 7:14 AM, Nicolas Rougier nicolas.roug...@loria.fr wrote: Thanks a lot for the translation. I think the opp relates to the opp array declared at the top and the circshift can be made using numpy roll. I modified your translation to include them. The results should

[Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Nicolas Rougier
Hello, I'm trying to translate a small matlab program for the simulation in a 2D flow in a channel past a cylinder and since I do not have matlab access, I would like to know if someone can help me, especially on array indexing. The matlab source code is available at:

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Fabrice Silva
Le samedi 13 mars 2010 à 10:20 +0100, Nicolas Rougier a écrit : Hello, I'm trying to translate a small matlab program for the simulation in a 2D flow in a channel past a cylinder and since I do not have matlab access, I would like to know if someone can help me, especially on array indexing.

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Nicolas Rougier
Thanks. I agree that the use of ':' is a bit weird. Nicolas On Mar 13, 2010, at 11:45 , Fabrice Silva wrote: Le samedi 13 mars 2010 à 10:20 +0100, Nicolas Rougier a écrit : Hello, I'm trying to translate a small matlab program for the simulation in a 2D flow in a channel past a cylinder

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Ryan May
On Sat, Mar 13, 2010 at 4:45 AM, Fabrice Silva si...@lma.cnrs-mrs.fr wrote: Le samedi 13 mars 2010 à 10:20 +0100, Nicolas Rougier a écrit : Hello, I'm trying to translate a small matlab program for the simulation in a 2D flow in a channel past a cylinder and since I do not have matlab access,

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Friedrich Romstedt
2010/3/13 Nicolas Rougier nicolas.roug...@loria.fr: I'm trying to translate a small matlab program for the simulation in a 2D flow in a channel past a cylinder and since I do not have matlab access, I would like to know if someone can help me, especially on array indexing. The matlab source

Re: [Numpy-discussion] Some help on matlab to numpy translation

2010-03-13 Thread Fabrice Silva
As ux 's shape is (1,lx,ly), ux(:,1,col) is equal to ux(1,1,col) which is a vector with the elements [ux(1,1,2), ... ux(1,1,ly-1)]. Using : juste after the reshape seems a lit bit silly... Except that python uses 0-based indexing and does not include the last number in a slice, while