Re: optparse with numpy.array?

2009-01-27 Thread Johan Ekh
Thanks, James I will try your suggestion! Robert, what mean with interactively is that i would like to create an array in the ipython shell, e.g. with m_i = array([1.0, 2.0, 3.0]) or by reading a file with values etc., and then execute my program with myprog -m m_i and thus pass the array m_i to

Re: optparse with numpy.array?

2009-01-27 Thread Steve Holden
Johan Ekh wrote: Thanks, James I will try your suggestion! Robert, what mean with interactively is that i would like to create an array in the ipython shell, e.g. with m_i = array([1.0, 2.0, 3.0]) or by reading a file with values etc., and then execute my program with myprog -m m_i and thus

Re: optparse with numpy.array?

2009-01-27 Thread Robert Kern
On 2009-01-27 03:09, Johan Ekh wrote: Thanks, James I will try your suggestion! Robert, what mean with interactively is that i would like to create an array in the ipython shell, e.g. with m_i = array([1.0, 2.0, 3.0]) or by reading a file with values etc., and then execute my program with myprog

optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Hi all, I'm trying to use optparse to process command line parameters given to my program. It works as I expect for the types supported by optparse, i.e. int, float, string etc. but how can I pass a numpy.array or a list to my program? I have been searching for it but cannot find a good solution.

Re: optparse with numpy.array?

2009-01-26 Thread Robert Kern
On 2009-01-26 17:44, Johan Ekh wrote: Hi all, I'm trying to use optparse to process command line parameters given to my program. It works as I expect for the types supported by optparse, i.e. int, float, string etc. but how can I pass a numpy.array or a list to my program?

Re: optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Thank you Robert, but what if I just want to create an array interactively, e.g. like m = array([1.0, 2.0, 3.0]), and pass it to my program? I tried extending optparse with a new type as explained in the link you gave me but I was not able to get it to work. Is it really neccessary follow that

Re: optparse with numpy.array?

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 3:45 PM, Johan Ekh ekh.jo...@gmail.com wrote: Thank you Robert, but what if I just want to create an array interactively, e.g. like m = array([1.0, 2.0, 3.0]), and pass it to my program? I tried extending optparse with a new type as explained in the link you gave me

Re: optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Thank you James, but I just can't optparse to accept an array, only integers, floats ans strings. My code looks like this from optparse import OptionParser parser = OptionParser() parser.add_option('-t', '--dt', action='store', type='float', dest='dt_i', default=0.1, help='time increment where

Re: optparse with numpy.array?

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 4:01 PM, Johan Ekh ekh.jo...@gmail.com wrote: Thank you James, but I just can't optparse to accept an array, only integers, floats ans strings. My code looks like this from optparse import OptionParser parser = OptionParser() parser.add_option('-t', '--dt',

Re: optparse with numpy.array?

2009-01-26 Thread Robert Kern
On 2009-01-27 00:01, Johan Ekh wrote: Thank you James, but I just can't optparse to accept an array, only integers, floats ans strings. My code looks like this from optparse import OptionParser parser = OptionParser() parser.add_option('-t', '--dt', action='store', type='float', dest='dt_i',