[Numpy-discussion] Re: applying function under certain conditions

Russell E. Owen rowen at cesmail.net
Fri May 20 15:40:04 EDT 2005


In article <cfc1a2ea4bfa61fa40080853c0875f87 at uni-mainz.de>,
 Christian Meesters <meesters at uni-mainz.de> wrote:

> Thanks. So, it is as easy as I thought ...
> Since I do not want to modify the original array in this case (it's 
> only for plotting purposes), I will go for Alexandre's solution here.

One more thing to consider...do you really want log? If you are looking 
for log-like behavior for positive values but graceful handling of 0 and 
negative values, consider arcsinh, e.g. arcsinh(scale * (x-offset)).

-- Russell

*Due to the properties I just mentioned, arcsinh is a very useful 
function for stretching astronomical images. Thanks to Robert Lupton for 
pointing this out to me.





More information about the NumPy-Discussion mailing list