Can you set numerix in a script?

Hi all,

I'm working on a MPL build for OS-X, and I'd like to be able to write scripts that will test as much as I can. In particular, I want to have this build work with Numeric, numarray and numpy.

To script that test, I need to be able to set numerix in a script, rather than in matplotlibrc. Can that be done?

While we're at it, it would be great if ANY of the config items in matplotlibrc could, instead, be set at run time in a script. I now a number of them can, but is there a standard way to do, and will it work with ALL the items in there?

Another note: it seems that numerix is very good at taking input from any of the Num* packages, regardless of which one is being used internally. Given that, I'm thinking of aiming for the future with my OS-X package, and just using numpy, and not bothering to build in support for the other two. any thoughts.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Christopher Barker wrote:

To script that test, I need to be able to set numerix in a script, rather than in matplotlibrc. Can that be done?

Yep, just do

from pylab import *
rcParams['numerix'] = 'numpy'

While we're at it, it would be great if ANY of the config items in matplotlibrc could, instead, be set at run time in a script. I now a number of them can, but is there a standard way to do, and will it work with ALL the items in there?

rcParams is the standard way and I think works for all items.

Another note: it seems that numerix is very good at taking input from any of the Num* packages, regardless of which one is being used internally. Given that, I'm thinking of aiming for the future with my OS-X package, and just using numpy, and not bothering to build in support for the other two. any thoughts.

-Chris

If I was developing something now, I would only bother supporting numpy.

Gary R.

Christopher Barker wrote:

Hi all,

I'm working on a MPL build for OS-X, and I'd like to be able to write scripts that will test as much as I can. In particular, I want to have this build work with Numeric, numarray and numpy.

To script that test, I need to be able to set numerix in a script, rather than in matplotlibrc. Can that be done?

For testing you may also take advantage of command-line arguments:

python examples/image_demo.py --Numeric

for example, runs using Numeric as the numerix setting.

The relevant code in numerix/__init__.py is:
for a in sys.argv:
     if a in ["--Numeric", "--numeric", "--NUMERIC",
              "--Numarray", "--numarray", "--NUMARRAY",
              "--NumPy", "--numpy", "--NUMPY", "--Numpy",
              ]:
         which = a[2:], "command line"
         break
     del a

If such a command-line option is found, it overrides everything else.

Eric

Gary Ruben wrote:

Yep, just do

from pylab import *
rcParams['numerix'] = 'numpy'

well, duh. sorry for being such and idiot, but I'm surprised that you can set numerix after importing pylab.

If I was developing something now, I would only bother supporting numpy.

That's my thought too, but I think I'll probably build Numeric an NumPy in anyway, as it's not hard to do.

Eric Firing wrote:

For testing you may also take advantage of command-line arguments:

python examples/image_demo.py --Numeric

Excellent! that will make things much easier.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...