negative log transforms

Speaking of branches, we may need to seriously consider a branch here,
mpl1. The changes here may involve breaking a fair amount of code,
which I don't mind doing to get it right, but I'm somewhat inclined to
branch off here for matplotlib1.0, with the goal of using traits,
fixing axis handling (eg multiple y-axis with arbitrary placement),
and rewriting the transforms.

On the topic of transforms, I would like to be able to do dynamic range
compression on a decaying oscillatory signal. Think of it as a logarithmic
axis which supports negative numbers. AFAICT, the current transform
infrastructure does not allow me to add this as a third party package.

The axis would look something like:

>- 10**2
>
>- 10**1
>
>- 10**0
>
>- 10**-1
>
>- 0
>
>- -10**-1
>
>- -10**0

As well as a max and min parameter, there would have to be a cutoff
parameter. For auto axes, choose a cutoff which allows a reasonable
number of decades to be displayed (I'm guessing reasonable is seven).

The transform would be something like the following:

if (x[i] > cut) newx[i] = log10(x[i]) - log10cut;
else if (x[i] < -cut) newx[i] = log10cut - log10(-x[i]);
else newx[i] = 0.;

with inverse:

if (x[i] < 0) newx[i] = -pow(10.0, log10cut - x[i]);
else if (x[i] > 0) newx[i] = pow(10.0, x[i] - log10cut);
else x[i] = 0.

Even extending the current LOG10 support would present a challenge of
how to get the cut value into the transform.

Suggestions how I can implement this in the current architecture, or
should I wait for the new transforms code?

- Paul

···

On Tue, Jul 17, 2007 at 08:33:47AM -0500, John Hunter wrote:

This is exactly the sort of thing that I thought a transform approach would make easier to do. So if it isn't urgent, waiting probably would be better. (by the way, we see exactly the same sort of log scale you propose in one of our older (non-python) packages. So there is a call for this sort of thing.

Perry

···

On Jul 17, 2007, at 10:36 AM, Paul Kienzle wrote:

On Tue, Jul 17, 2007 at 08:33:47AM -0500, John Hunter wrote:

Speaking of branches, we may need to seriously consider a branch here,
mpl1. The changes here may involve breaking a fair amount of code,
which I don't mind doing to get it right, but I'm somewhat inclined to
branch off here for matplotlib1.0, with the goal of using traits,
fixing axis handling (eg multiple y-axis with arbitrary placement),
and rewriting the transforms.

On the topic of transforms, I would like to be able to do dynamic range
compression on a decaying oscillatory signal. Think of it as a logarithmic
axis which supports negative numbers. AFAICT, the current transform
infrastructure does not allow me to add this as a third party package.

The axis would look something like:

>- 10**2
>
>- 10**1
>
>- 10**0
>
>- 10**-1
>
>- 0
>
>- -10**-1
>
>- -10**0

As well as a max and min parameter, there would have to be a cutoff
parameter. For auto axes, choose a cutoff which allows a reasonable
number of decades to be displayed (I'm guessing reasonable is seven).

The transform would be something like the following:

if (x[i] > cut) newx[i] = log10(x[i]) - log10cut;
else if (x[i] < -cut) newx[i] = log10cut - log10(-x[i]);
else newx[i] = 0.;

with inverse:

if (x[i] < 0) newx[i] = -pow(10.0, log10cut - x[i]);
else if (x[i] > 0) newx[i] = pow(10.0, x[i] - log10cut);
else x[i] = 0.

Even extending the current LOG10 support would present a challenge of
how to get the cut value into the transform.

Suggestions how I can implement this in the current architecture, or
should I wait for the new transforms code?

- Paul

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel