# [AstroPy] Cross-Identification of stars in a collection of images

Joe Harrington jh@physics.ucf....
Thu Mar 15 14:26:50 CDT 2012

```You could also try something simpler, based on image morphing.  Write
the transformation matrix that scales, shifts, and rotates image 1 to
mimic image 2.  Calculate the reduced chi-squared between the images,
possibly with a background offset.  Put that into a function minimizer
and solve for the elements of the transformation matrix as free
parameters.  You'll need an initial guess at the parameters that is
pretty good, which you can get from manually matching a few stars.

Then, use the fitted matrix to transform all the coordinates of the
identified stars in image 1 to the coordinates of image 2.  Clean those
up if you need to by re-running your centering routine with those
positions as initial guesses.  It sounds complicated, but I'm betting
it's a lot fewer calcs than the gigatriangles talked about in the page
you cited (though I didn't read thoroughly, maybe there was a shortcut),
and there may already be image morphing code that does the ugly part.
Or, use an optical distortions code and fit for the polynomial
coefficients.  That would handle things like differential refraction, if
these are ground-based images.

A thornier problem is tracking features in pairs of mapped giant-planet
images.  There you use a full image-morphing routine to derive a fluid
flow field between two images.  If you have access to one of those (I
don't), the star-matching problem seems like a relatively simple
sub-case.

Finally, some of our exoplanet transit survey friends might have a
routine they are willing to share.

--jh--

Date: Thu, 15 Mar 2012 16:47:57 +0530
From: Joe Philip Ninan <indiajoe@gmail.com>
Subject: Re: [AstroPy] Cross-Identification of stars in a collection
of	images
To: Richard P Wagner <rpwagner@sdsc.edu>, wkerzendorf@gmail.com
Cc: astropy <astropy@scipy.org>
Message-ID:
<CAJ_T+b7PK9hmedLRE_xwxrDkATbUAGZZhJq61O_LbxC-2AF-Fw@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,
The blog[1] Richard mentioned seems to be dealing with matching the stars
using their RA and Dec.
Even the code mentioned in the last comment of the page seems to be for
that.
I was looking for a code which matches stars from frame to frame using
their pixel coordinates.
The http://astrometry.net suggested by Wolfgang does what i wanted.
But as he suggested, i think i shall write a function in python itself to
do that, so that we can use it for general purpose.
I am planning to use the algorithm mentioned by Peter B. Stetson in his
'The Techniques of Least squares and stellar Photometry with CCDs'  [2].
Thanking you all for suggestions,
-cheers
Joe

[2] http://ned.ipac.caltech.edu/level5/Stetson/Stetson5_2.html

On 14 March 2012 21:49, Richard P Wagner <rpwagner@sdsc.edu> wrote:

> Hi Joe,
>
> On Mar 14, 2012, at 7:13 AM, Joe Philip Ninan wrote:
>
> > Hi,
> > Is there any python function to cross-identify the stars between
> different frames and calculate the coefficients of coordinate
> transformation equations?
> > If not, i am planning to implement it by first running daofind using
> pyraf and then trying to match triangles; starting from brightest stars.
> > Is there any better/easier way to do this?
> > Thanking you,
> > Joe
>
> I don't tackle observational data myself, but I know that others work on
> cross-matching regularly. You might find this AstroPython blog post a
> useful starting point [1].
>
> --Rick
>
> [1]
> http://www.astropython.org/blog/2010/4/Question-Cross-matching-in-python
```