comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Least square fitting
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Least square fitting [message #60324] Tue, 20 May 2008 04:16 Go to next message
Chris[5] is currently offline  Chris[5]
Messages: 16
Registered: May 2008
Junior Member
On May 19, 11:41 pm, MichaelT <michael.theus...@googlemail.com> wrote:
> Hi all,
>
> I have a problem with a rather complicated function depending on four
> parameters which I try to find using least square fitting and I don't
> know exactly how to do it.
>
> The basic problem is the following:
> I have an astronomical image of a star field and try to relate the sky
> coordinates (right ascension, declination) of the stars to the pixel
> coordinates (x, y).
>
> The function to relate the two depends on the not accurately known
> parameters focal length of the lens (f), the rotation of the field of
> view with respect of the north direction (beta) and the center sky
> coordinates of the image (bc, lc).
> I know the sky coordinates of certain stars accurately (bs, ls) as
> well as their pixel coordinates (xs, ys) and the center pixel
> coordinates of the image (xc, yc).
>
> Generally, the function is as follows (equivalent for ys', but the
> functions f1-f5 are slightly different):
>
> xs' = f1(xc, f2(f, f3(ls, lc, bs, bc)), f4(ls, lc, bs, bc, f5(ls, lc,
> bs, bc)), beta)
>
> The functions f1-f5 look rather complicated and contain many sines,
> cosines and acos etc.
>
> I then did the following as I didn't know better:
> First I minimized all this with respect of beta, then lc and bc and
> after that f starting with some initial values for the four
> parameters. Then I started all over again, beta, lc, bc, f (in a loop)
> until the difference between the known coordinates (xs, ys) and the
> calculated ones (xs', ys') reached a minimum.
>
> However, the minimum deviation reached at the end of the loop pretty
> much depends on the initially chosen values of beta, lc, bc and f.
>
> There certainly is a more optimal way to do the least square fitting
> than the one that I have chosen (partial derivatives etc.), but that
> f1 depends on f2 and f4 and these again depend on f3 and f5 is giving
> me some unsolvable problems.
>
> How should I proceed? What would be a good method to minimize this?
>
> Thanks, Michael
>
> The main problem now is for me, that f1 depends on f2 and f4 and that
> f2 and f4 themselves depend on f3 and f5.

How big is the field of view? If it is small enough (and the optics
consistent enough) that you don't need to worry about the pixel scale
(number of arcsecs/pixel) changing over the image, than the problem
seems easier, since most of the parameters to solve for ought to be
independent. I don't know how statistically kosher this is, but here
are some thoughts:

Assuming that the pixel scale p in arcsec/pixel is a constant, then
the RA,DEC (a,d) of stars are related to their pixel coords (x,y) by

a=ac+((x-xc)*cos(beta)-(y-yc)*sin(beta))*p
d=dc+((x-xc)*sin(beta)-(y-yc)*cos(beta))*p

where ac,dc,xc,yc are the sky and pixel coordinates of the center
pixel. Beta is the angle of rotation of the image y axis with respect
to north. I guess also here I've assumed that RA increases to the
right (backwards from convention) and that the image is near the
celestial equator so that 1 second of right ascension = 1 second of
declination. Both of these are easy to generalize (switch some of the
signs for East pointing left, and add in a cos(dec) term for off-
equator correction). Neither of these should affect the following
analysis.

For every (a,d) (x,y) pair, compute the pixel distance and angular
separation. A simple linear regression then determines p (an easier
but sloppier method would be to calculate p for each pair and take a
weighted average). p is independent of all of the other parameters, so
(to me) it seems like you could do this seperately.

Now that you know p, for a bunch of pairs of stars, compute the x
displacement in pixels and the RA displacement in arcsec. Convert the
x displacement in pixels to an angular distance using p. Now use the
equations above to solve for beta. (you can also use the y coordinates
and/or decs just as easily).

Finally, determining ac and dc is one more linear regression.

Is this the sort of thing you are trying to do?

Chris
Re: Least square fitting [message #60519 is a reply to message #60324] Tue, 20 May 2008 07:06 Go to previous message
MichaelT is currently offline  MichaelT
Messages: 52
Registered: May 2006
Member
Thanks for your thoughts, Chris!

But I think the field of view is not small enough to do it this way
(about 3.5° x 2.5° and larger). The focal length is shorter than 400
mm. Otherwise, it could very well work the way you described it, I
think.

These are the things I'd like to do in the end:
I have several images of the same object, but from different nights
taken with an amateur instrument. So the fov is slightly different
each time as well as the rotation angle (it's not a stationary scope).
Knowing all the parameters would enable me to exactly overlay the
images to increase the signal-to-noise ratio. I know that there are
various free programs (non-IDL) that can already do that, but they all
have some shortcomings. So I tried to do something myself.
Also, you could then use some neat routines from the IDL astronomy
library (http://idlastro.gsfc.nasa.gov/) and automatically generate an
overlay from the USNO catalog to determine the limiting magnitude or
to label objects (e.g. queryvizier and querysimbad).
There are many other things you could do if you knew the pixel-to-
coordinate conversion.

Michael
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Convolution
Next Topic: Re: Generalized Least Squares? (LONG POST!)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:38:16 PDT 2025

Total time taken to generate the page: 0.00552 seconds