[SciPy-User] Scaling up root-finding

Charles R Harris charlesr.harris at gmail.com
Wed Sep 4 16:56:21 EDT 2013


On Wed, Sep 4, 2013 at 2:35 PM, Chris Weisiger <cweisiger at msg.ucsf.edu>wrote:

> We have a somewhat elderly microscopy camera whose response curve is
> best-characterized as a degree-2 polynomial (starts out steep, then
> flattens out; we hit the camera's maximum bit depth before the function
> stops being monotonic though). That is:
>
> reported photons = a + b * (incident photons) + c * (incident photons)^2
>
> Of course, each pixel is slightly different, giving 512*512 different
> polynomials. I want to linearize the camera's response in post-production,
> by inverting the (monotonic) function so that it maps reported photons to
> incident photons.
>
> The obvious method would be to use something from scipy.optimize's
> root-finding functions. I'm not remotely a numerical analysis expert, so I
> have no feel for which function would be best for this problem.
> Performance-wise, a quick test indicates that it would take about 3.5s on
> my laptop to process a single frame by manually iterating over every pixel
> in the frame and calling scipy.optimize.newton(that pixel's response
> function, that pixel's starting value). This isn't great, but it's well
> within the realm of feasibility.
>
> Is there some more efficient method to do this? In the ideal world we'd be
> able to handle arbitrary-degree polynomials, but I'd be willing to accept
> being restricted to degree-2. Of course, degree-1 is trivial to implement.
>
> Thanks for any advice you care to share.
>
>
Depends on the data you use to fit the curve. I always fit the inverse
response rather than the response.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130904/36e36810/attachment.html>


More information about the SciPy-User mailing list