Re: [Numpy-discussion] Cellular Automata Neighborhoods Numpy

2011-03-20 Thread Robert Cimrman
Hi Michael,

You can find the full game of life script at [1].
There is also Belousov-Zhabotinsky cellular automaton. Both have a strided 
version.

r.

[1] http://docs.sfepy.org/scientific-python-tutorial/examples

- Reply message -
From: Michael Mersky m...@mydis.org
To: numpy-discussion@scipy.org
Subject: [Numpy-discussion] Cellular Automata Neighborhoods amp; Numpy
Date: Sun, Mar 20, 2011 03:35
Hello, I stumbled upon this group tonight 
(http://mail.scipy.org/pipermail/numpy-discussion/2010-October/053420.html) 
while searching Google for examples of Cellular Automata(CA) using Numpy. The 
Game of Life Strides example looks great, but I don't fully comprehend how 
this example is working:


http://scipy.org/Cookbook/GameOfLifeStrides

If I have:

 world=arange(9).reshape(3,3)
 world
array([[0, 1, 2],
     [3, 4, 5],

     [6, 7, 8]])

how could I as_strided(world,shape?,strides) such that my 9 cell neighborhood 
at [0][0]

would be something like this (i.e. wrapped):

array([[8,6,7],
 [2,0,1],
 [5,3,4]])


Greatly appreciate your help!

-m___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread Ben Smith

So, in addition to my computer science work, I'm a PhD student in econ. Right 
now, the class is using GAUSS for almost everything. This sort of pisses me off 
because it means people are building libraries of code that become valueless 
when they graduate (because right now we get GAUSS licenses for free, but it is 
absurdly expensive later) -- particularly when this is the only language they 
know.

So, I had this idea of building some command line tools to do the same things 
using the most basic pieces of NumPy (arrays, dot products, transpose and 
inverse -- that's it). And it is going great. My problem however is that I'd 
like to be able to share these tools but I know I'm opening up a big can of 
worms where I have to go around building numpy on 75 peoples computers. What 
I'd like to do is limit myself to just the functions that are implemented in 
python, package it with py2exe and hand that to anyone that needs it. So, my 
question, if anyone knows, what's implemented in python and what depends on the 
c libraries? Is this even possible?

Thanks!

Ben

-- 
Ben Smith
Founder / CSA
WBP SYSTEMS
http://www.wbpsystems.com


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread josef . pktd
On Sun, Mar 20, 2011 at 11:08 AM, Ben Smith b...@wbpsystems.com wrote:

 So, in addition to my computer science work, I'm a PhD student in econ. Right 
 now, the class is using GAUSS for almost everything. This sort of pisses me 
 off because it means people are building libraries of code that become 
 valueless when they graduate (because right now we get GAUSS licenses for 
 free, but it is absurdly expensive later) -- particularly when this is the 
 only language they know.

 So, I had this idea of building some command line tools to do the same things 
 using the most basic pieces of NumPy (arrays, dot products, transpose and 
 inverse -- that's it). And it is going great. My problem however is that I'd 
 like to be able to share these tools but I know I'm opening up a big can of 
 worms where I have to go around building numpy on 75 peoples computers. What 
 I'd like to do is limit myself to just the functions that are implemented in 
 python, package it with py2exe and hand that to anyone that needs it. So, my 
 question, if anyone knows, what's implemented in python and what depends on 
 the c libraries? Is this even possible?

I think you can package also numpy with py2exe.

Overall I think restricting to pure python is a very bad idea if you
want to compete with Gauss.
Even for a minimal translation of Gauss programs I need at least numpy
and scipy, and statsmodels for the econometrics specific parts. linear
algebra, optimization and special functions for distributions look
like a minimum to me, and some scipy.signal for time series analysis,
and more random numbers than in python`s standard library.

Pure python will be slow for this and I doubt you will get anyone to
switch from Gauss to pure python.
Also, I haven`t seen yet a pure python matrix inverse, or linalg solver.

If they want to write their own python programs for analysis and use
python later on, then they are much better of getting a full python
distribution, EPD, pythonxy or similar. Binary distributions are
available and just one click or one command installs.
And, for example, using Spyder would be a lot nicer and easier for
writing scripts, that are equivalent to Gauss scripts, than using
commandline tools.

I fully agree with the objective of getting python/numpy/scipy tools
to get economists, econometricians to switch from gauss or matlab, but
to make it competitive we need enough supporting functions and we need
the speed that some Monte Carlo simulations don`t take days instead of
hours.

I hope you are successful with getting economists or econ students to
use python.

Josef

 Thanks!

 Ben

 --
 Ben Smith
 Founder / CSA
 WBP SYSTEMS
 http://www.wbpsystems.com


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread Dan Halbert

On Sunday, March 20, 2011 11:08am, Ben Smith b...@wbpsystems.com said:
 ... What I'd like to do is
 limit myself to just the functions that are implemented in python, package it 
 with
 py2exe and hand that to anyone that needs it. So, my question, if anyone 
 knows,
 what's implemented in python and what depends on the c libraries? Is this even
 possible?
 
The low-level code is all in non-Python libraries. However, I have used 
pyinstaller (similar to py2exe)
to build self-contained packages that include numpy, and it includes the 
necessary
non-Python libraries in the package. My impression is that py2exe will do the 
same thing.
Also, you don't need to build numpy on everyone's machine. There is a numpy 
installer
for Windows. You could just give people directions for installing Python and 
Numpy. IPython
might be nice too.
 
Other alternatives: The Enthought distribution is free for academic use. Sage 
is free. There's
also Python(x,y), though I don't know much about it. They all include a ton of 
stuff.
 
Dan___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread josef . pktd
On Sun, Mar 20, 2011 at 11:44 AM,  josef.p...@gmail.com wrote:
 On Sun, Mar 20, 2011 at 11:08 AM, Ben Smith b...@wbpsystems.com wrote:

 So, in addition to my computer science work, I'm a PhD student in econ. 
 Right now, the class is using GAUSS for almost everything. This sort of 
 pisses me off because it means people are building libraries of code that 
 become valueless when they graduate (because right now we get GAUSS licenses 
 for free, but it is absurdly expensive later) -- particularly when this is 
 the only language they know.

 So, I had this idea of building some command line tools to do the same 
 things using the most basic pieces of NumPy (arrays, dot products, transpose 
 and inverse -- that's it). And it is going great. My problem however is that 
 I'd like to be able to share these tools but I know I'm opening up a big can 
 of worms where I have to go around building numpy on 75 peoples computers. 
 What I'd like to do is limit myself to just the functions that are 
 implemented in python, package it with py2exe and hand that to anyone that 
 needs it. So, my question, if anyone knows, what's implemented in python and 
 what depends on the c libraries? Is this even possible?

 I think you can package also numpy with py2exe.

I should have explained this first:
all basic numpy array calculations are in C, extra packages in scipy
are often in fortran.
numpy.linalg uses C, but scipy.linalg uses the fortran libraries that
are the same (LAPACK,..) or similar versions as in GAUSS. numpy.random
is in C, scipy.special for distribution functions is in C and fortran.

Josef


 Overall I think restricting to pure python is a very bad idea if you
 want to compete with Gauss.
 Even for a minimal translation of Gauss programs I need at least numpy
 and scipy, and statsmodels for the econometrics specific parts. linear
 algebra, optimization and special functions for distributions look
 like a minimum to me, and some scipy.signal for time series analysis,
 and more random numbers than in python`s standard library.

 Pure python will be slow for this and I doubt you will get anyone to
 switch from Gauss to pure python.
 Also, I haven`t seen yet a pure python matrix inverse, or linalg solver.

 If they want to write their own python programs for analysis and use
 python later on, then they are much better of getting a full python
 distribution, EPD, pythonxy or similar. Binary distributions are
 available and just one click or one command installs.
 And, for example, using Spyder would be a lot nicer and easier for
 writing scripts, that are equivalent to Gauss scripts, than using
 commandline tools.

 I fully agree with the objective of getting python/numpy/scipy tools
 to get economists, econometricians to switch from gauss or matlab, but
 to make it competitive we need enough supporting functions and we need
 the speed that some Monte Carlo simulations don`t take days instead of
 hours.

 I hope you are successful with getting economists or econ students to
 use python.

 Josef

 Thanks!

 Ben

 --
 Ben Smith
 Founder / CSA
 WBP SYSTEMS
 http://www.wbpsystems.com


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread josef . pktd
On Sun, Mar 20, 2011 at 11:49 AM,  josef.p...@gmail.com wrote:
 On Sun, Mar 20, 2011 at 11:44 AM,  josef.p...@gmail.com wrote:
 On Sun, Mar 20, 2011 at 11:08 AM, Ben Smith b...@wbpsystems.com wrote:

 So, in addition to my computer science work, I'm a PhD student in econ. 
 Right now, the class is using GAUSS for almost everything. This sort of 
 pisses me off because it means people are building libraries of code that 
 become valueless when they graduate (because right now we get GAUSS 
 licenses for free, but it is absurdly expensive later) -- particularly when 
 this is the only language they know.

this looks interesting on this topic:

http://www.vwl.uni-mannheim.de/gaudecker/teaching.htm

Josef


 So, I had this idea of building some command line tools to do the same 
 things using the most basic pieces of NumPy (arrays, dot products, 
 transpose and inverse -- that's it). And it is going great. My problem 
 however is that I'd like to be able to share these tools but I know I'm 
 opening up a big can of worms where I have to go around building numpy on 
 75 peoples computers. What I'd like to do is limit myself to just the 
 functions that are implemented in python, package it with py2exe and hand 
 that to anyone that needs it. So, my question, if anyone knows, what's 
 implemented in python and what depends on the c libraries? Is this even 
 possible?

 I think you can package also numpy with py2exe.

 I should have explained this first:
 all basic numpy array calculations are in C, extra packages in scipy
 are often in fortran.
 numpy.linalg uses C, but scipy.linalg uses the fortran libraries that
 are the same (LAPACK,..) or similar versions as in GAUSS. numpy.random
 is in C, scipy.special for distribution functions is in C and fortran.

 Josef


 Overall I think restricting to pure python is a very bad idea if you
 want to compete with Gauss.
 Even for a minimal translation of Gauss programs I need at least numpy
 and scipy, and statsmodels for the econometrics specific parts. linear
 algebra, optimization and special functions for distributions look
 like a minimum to me, and some scipy.signal for time series analysis,
 and more random numbers than in python`s standard library.

 Pure python will be slow for this and I doubt you will get anyone to
 switch from Gauss to pure python.
 Also, I haven`t seen yet a pure python matrix inverse, or linalg solver.

 If they want to write their own python programs for analysis and use
 python later on, then they are much better of getting a full python
 distribution, EPD, pythonxy or similar. Binary distributions are
 available and just one click or one command installs.
 And, for example, using Spyder would be a lot nicer and easier for
 writing scripts, that are equivalent to Gauss scripts, than using
 commandline tools.

 I fully agree with the objective of getting python/numpy/scipy tools
 to get economists, econometricians to switch from gauss or matlab, but
 to make it competitive we need enough supporting functions and we need
 the speed that some Monte Carlo simulations don`t take days instead of
 hours.

 I hope you are successful with getting economists or econ students to
 use python.

 Josef

 Thanks!

 Ben

 --
 Ben Smith
 Founder / CSA
 WBP SYSTEMS
 http://www.wbpsystems.com


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread Lou Pecora
I'll add my $0.02 here.  Someone mentioned SAGE.  I can say that on the Mac the 
sage package seems to install very easily and reliably.   I've done 4 
installations on Macs 10.4 to 10.6.  You can do them with one command line. 
 They take a few hours, but all have gone flawlessly.  The installation 
contains 
a LOT of python stuff (including all the packages mentioned here) and you use 
it 
just like any other installation except you need to point to the sage folder. 
 There are examples in the documentation.  
 -- Lou Pecora,   my views are my own.


  
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread Alan G Isaac
On 3/20/2011 11:08 AM, Ben Smith wrote:
 I'd like to do is limit myself to just the functions that
 are implemented in python, package it with py2exe and hand
 that to anyone that needs it. So, my question, if anyone
 knows, what's implemented in python and what depends on
 the c libraries?

Perhaps a different approach is preferable.  Get them
to install the Enthought Python Distribution (free for
academic use) and provide some GAUSS function look
alikes, along this line
http://econpy.googlecode.com/svn/trunk/pytrix/pyGAUSS.py

fwiw,
Alan Isaac

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion