# [SciPy-User] Help optimizing an algorithm

Chris Weisiger cweisiger@msg.ucsf....
Thu Jan 31 15:39:30 CST 2013

```Okay, still working on the map_coordinates stuff. I don't have uniform
spacing for my sampling, but I believe it should be possible to work around
that. We have a 3D array of pixel data, where the axes are (sample, y, x),
i.e. the first axis is the index of the sample. If I can map into that
array and get values out in "sample indices", I can then map sample indices
to exposure times rather easily.

For example, if my exposure times are (10, 20, 25), and for a given pixel,
map_coordinates tells me 1.5, then that means that that pixel's exposure
time is 22.5 (halfway between the exposure times with indices 1 and 2).

Let's say that my sampling is just 2 4x3 images:

>>> a = np.arange(24.0).reshape(2,4,3)
>>> a
array([[[  0.,   1.,   2.],
[  3.,   4.,   5.],
[  6.,   7.,   8.],
[  9.,  10.,  11.]],

[[ 12.,  13.,  14.],
[ 15.,  16.,  17.],
[ 18.,  19.,  20.],
[ 21.,  22.,  23.]]])

and I want to find the proper value for the (0, 0) pixel if its reported
value was 6. What I want in this case is actually .5 (i.e. halfway between
the two images). This is where I'm getting stuck, unfortunately. I'm
missing some conversion or something, I think. Help would be appreciated.

-Chris

On Thu, Jan 31, 2013 at 9:57 AM, Chris Weisiger <cweisiger@msg.ucsf.edu>wrote:

> On Thu, Jan 31, 2013 at 9:39 AM, Zachary Pincus <zachary.pincus@yale.edu>wrote:
>
>> if not:
>>
>> http://www.microscopy-analysis.com/files/jwiley_microscopy/2012_January_Sabharwal.pdf
>>
>> They mention the dual amplifier gain issues, and also point out some
>> potential trouble spots (toward the end in the "unexpected findings"
>> section) with the low-gain amplifier at least for the (unidentified) camera
>> they used. Worth knowing about...
>>
>>
> I hadn't seen that; shame on me for not doing my due-diligence. However,
> their plots look significantly worse than ours do, even if they're
> cherry-picking bad pixels. For comparison, here's our 7 worst (most
> nonlinear) pixels:
>
> And here's our sensor-wide average low-end nonlinearity (note that camera
> baseline is 100 counts):
> http://derakon.dyndns.org/~chriswei/temp2/lowEndToe.png
>
> I don't have a plot of the least-linear low-end pixels handy.
>
> Thanks again for the help! map_coordinates is a confusing function, but I
> have confidence I'll sort it out sooner or later.
>
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130131/5bd4f23e/attachment.html
```