[AstroPy] Linearity correction by polynomial fitting

Chris Beaumont beaumont at hawaii.edu
Thu Apr 18 15:33:28 EDT 2013


Hi Joe,

The astropy PR is good to know about -- keep me posted about what you
discover!

Fitting all ~3-5 million polynomial coefficients at once sounds like a bad
idea to me. The complexity of OLS increases roughly with ~coefficients^1-3
(depending on the method), so a single fit to 5-million unknowns is *much*
more computationally intensive than a million fits to 5-unknowns.

chris


On Thu, Apr 18, 2013 at 3:03 PM, James Turner <jturner at gemini.edu> wrote:

> Good.
>
> Tim Pickering also said that "something like scipy.optimize.fmin_powell"
> will handle vectors of coefficients so you can vectorize the whole thing
> but I think he forgot to copy you...
>
> James.
>
>
> On 18/04/13 15:00, Joe Philip Ninan wrote:
> > Hi James,
> > I think i shall try to keep the code as much pure python as possible.
> Installing
> > iraf on the controller machine just for one routine will probably be an
> over kill.
> > Nadia sent me link to pull request of astropy which can do fitting on 2d
> array.
> > So i only have to flatten by 3d to a 2d, with time along the column. (
> > https://github.com/astropy/astropy/pull/493 ).
> > This isn't merged to astropy yet, but i was told it will be merged soon.
> > Thanks for the suggestions,
> > -cheers
> > joe
> >
> >
> > On 18 April 2013 22:49, James Turner <jturner at gemini.edu
> > <mailto:jturner at gemini.edu>> wrote:
> >
> >      > But I couldn't find anything for fitting a polynomial for every
> pixel
> >     along an
> >      > axis of an ndarray.
> >      > Is there a tool to do this? Without implementing a python loop to
> loop
> >     through
> >      > each pixel and calculate coefficients?
> >
> >     I'm not sure if there is anything yet (could tell you how to do
> >     it in IRAF), as I think fitting has been a bit of a missing area
> >     in Python until some recent work-in-progress. But wouldn't it
> >     help to use Cython? I was also wondering whether a Python loop
> >     will really be that slow if you're doing something relatively
> >     non-trivial like a fit, but it probably will be since the axis
> >     you're fitting will be much shorter than the image size...
> >
> >     Cheers,
> >
> >     James.
> >
> >
> >      > Worst case scenario, i think i will have to write a C routine to
> do
> >     polynomial
> >      > fit and call it from python. But i would really love if a pure
> python
> >      > alternative exists.
> >      >
> >      > Thanks
> >      > -cheers
> >      > joe
> >      >
> >      >
> >      >
> >      >
> >      >
> >      > --
> >      > /---------------------------------------------------------------
> >      > "GNU/Linux: because a PC is a terrible thing to waste" -  GNU
> Generation
> >      >
> >      > ************************************************
> >      > Joe Philip Ninan http://sites.google.com/site/jpninan/
> >      > Research Scholar        /________________\
> >      > DAA,                            | Vadakeparambil |
> >      > TIFR,                           | Pullad P.O.         |
> >      > Mumbai-05, India.      | Kerala, India      |
> >      > Ph: +917738438212   | PIN:689548       |
> >      > ------------------------------\_______________/--------------
> >      >
> >      >
> >      > _______________________________________________
> >      > AstroPy mailing list
> >      > AstroPy at scipy.org <mailto:AstroPy at scipy.org>
> >      > http://mail.scipy.org/mailman/listinfo/astropy
> >     _______________________________________________
> >     AstroPy mailing list
> >     AstroPy at scipy.org <mailto:AstroPy at scipy.org>
> >     http://mail.scipy.org/mailman/listinfo/astropy
> >
> >
> >
> >
> > --
> > /---------------------------------------------------------------
> > "GNU/Linux: because a PC is a terrible thing to waste" -  GNU Generation
> >
> > ************************************************
> > Joe Philip Ninan http://sites.google.com/site/jpninan/
> > Research Scholar        /________________\
> > DAA,                            | Vadakeparambil |
> > TIFR,                           | Pullad P.O.         |
> > Mumbai-05, India.      | Kerala, India      |
> > Ph: +917738438212   | PIN:689548       |
> > ------------------------------\_______________/--------------
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 
************************************
Chris Beaumont
Graduate Student
Institute for Astronomy
University of Hawaii at Manoa
2680 Woodlawn Drive
Honolulu, HI 96822
www.ifa.hawaii.edu/~beaumont
************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20130418/e7b4832f/attachment.html>


More information about the AstroPy mailing list