From: Arnd B. <arn...@we...> - 2005-08-31 07:05:30
|
On Tue, 30 Aug 2005, Ken McIvor wrote: [...] > # assuming z0 is the initial MxN array that is being decayed... > z_min = min(nx.minimum.reduce(z0)) > z_max = max(nx.maximum.reduce(z0)) > image = axes.imshow(z0, vmin=z_min, vmax=z_max) > > As an aside: I'd love to hear if anyone knows of a nicer way to get > Numeric to give you the minimum value of a matrix. What about: z_min=min(ravel(z0)) In [3]:Numeric.ravel? ravel(m) returns a 1d array corresponding to all the elements of it's argument. OTOH, I am not sure, if the usage of min (which is a python builtin, operating on sequences) does not cost some performance. So maybe z_min = nx.minimum.reduce(nx.ravel(z0)) is more efficient? Best, Arnd |