Author Topic: Image Plate Solve Script  (Read 53011 times)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Image Plate Solve Script
« on: 2012 February 28 06:04:14 »
Some time ago I a had an idea for implementing a plate solving algorithm using Pixinsight. The idea is quite simple: using StarGenerator we generate a reference image with known coordinates. Then with StarAlignment we align the image which we want to solve against the reference image.

For generating the reference image we need to estimate the coordinates of the center of the image. The coordinates don't need to be very precise, but they must be inside the image. Also, for estimating the resolution of the image the user has to set the focal length and pixel size of the camera. Again, this parameters don't need to be very precise, but they should be within a factor of two of the real values. The algorithm iterates using the results of the last step as inputs of the following step.
The initial values can be initialized from the keywords OBJCTRA, OBJCTDEC, FOCALLEN,  XPIXSZ, YPIXSZ and DATE_OBS if present in the image.

The result of the algorithm is like this:
Code: [Select]
Image plate-solve v0.1:
------------------------
Referentiation Matrix (Coords[RA,Dec] = Matrix * Coords[x,y]):
[ -0.0002884164925960009 -0.0000058272042116800396 315.2354073119532
0.0000056731204796174085 -0.0002884526396079686 43.887194882104225
0 0 1]
Resolution X: 1.0385 arcsec/pix
Resolution Y: 1.0386 arcsec/pix
Resolution: 1.0386 arcsec/pix
Rotation: -1.138191 deg
Focal: 1469.67 mm
Image center:
    RA: +20 59 46.066
    Dec: +43 36 26.229
Image bounds:
    TopLeft: RA: +21 00 56.498 Dec: +43 53 13.902
    TopRight: RA: +20 58 38.404 Dec: +43 53 54.646
    BottomLeft: RA: +21 00 53.729 Dec: +43 18 57.811
    BottomRight: RA: +20 58 35.635 Dec: +43 19 38.556

I have been trying to analyze the precision of the results, but I can only compare with astrometry.net. I don't know the precision of astrometry.net, but my script is usually at 1 or 2 arcseconds of it. Also, I have only tried with my images taken with a 8" SCT with resolutions between 0.6" and 1.2" and LRGB and narrowband filters. It would be very helpful if somebody could test the script using images of different resolutions and signal levels and also compare the results with other programs (PinPoint?).
The precision of the algorithm depends on the precision of the PixInsight's star database and of the precision of StarAlignment.

There is still work to do:
  • The dialog should let to set the resolution of the image choosing between focal & pixelsize or arcsec/px.
  • There should be a checkbox for activating the writing of the WCS keywords in the image (http://fits.gsfc.nasa.gov/fits_wcs.html).

I hope that this script is useful for someone.

Edited for removing an obsolete version of the script. Please, use the last version.
« Last Edit: 2012 March 01 04:27:29 by Andres.Pozo »

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Image Plate Solve Script
« Reply #1 on: 2012 February 28 08:01:56 »
This is really cool  8). Thought about doing something like this myself, but never came around to it!

Remark about astrometry.net/BlindSolver: The special thing about this is that it does not necessarily need hints about scale and region. Solves are usually ok, but if you want sub-arc-second accuracy, you need a more accurate plate solver as a second stage. Also, occasionally, astrometry.net gets things very wrong.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #2 on: 2012 February 28 08:44:53 »
I have a question for Juan: ¿In the matrix returned by StarAlign what coordinate convention is used? ¿What coordinates in pixels has the center of the top-left pixel of the image? ¿(0,0)? ¿0.5,0.5)? ¿(1,1)?

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Image Plate Solve Script
« Reply #3 on: 2012 February 28 09:47:56 »
(0.5,0.5)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #4 on: 2012 February 28 09:57:16 »
Thanks Carlos. That is what I assumed when I wrote the script.

I have been reading about FITS WCS and it uses (1,1) for the first pixel. Section 2.1.4 at http://www.aanda.org/index.php?...

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #5 on: 2012 February 29 01:23:17 »
I have found an error in the v0.1 version of the script. A new fixed version is attached.

Yesterday I analyzed the precision of the algorithm and I found that the center coordinates are ok but not the corners nor the resolution.
I have to understand better the gnomonic projection and how StarGenerator uses it. I will keep working on this.

Edited for removing an obsolete version of the script. Please, use the last version.
« Last Edit: 2012 March 01 04:27:49 by Andres.Pozo »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Image Plate Solve Script
« Reply #6 on: 2012 February 29 10:30:00 »
Nice work, Andrés!

I've played with the script and it has worked well for a wide field shot (105 mm) but I've had to reduce the limit magnitude (otherwise StarGenerator takes ages; I have to improve it) and StarAlignment does not correct for wide field distortions. For long focal lengths this script should work very well if we had a much denser (and precise) star catalog. With PPMX there are too few stars in most cases. We have a lot of work to do here!
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #7 on: 2012 March 01 04:26:13 »
Last night I improved the algorithm and now it gets much better precision. It is also faster since it converges in less iterations. In fact, usually after only 2 iterations the result it is good enough.

The algorithm finds a transformation matrix that transform between pixel coordinates to rectangular coordinates projected with a gnomonic projection. After this, the celestial coordinates (RA,Dec) are calculated using the inverse transformation of the gnomonic projection.

I have made several comparisons with images solved with Pinpoint LE and the results of the script are very similar. The difference in the center of image and the four corners is usually less than 1 arcsecond.

Code: [Select]
Image plate-solve v0.2:
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    -0.0005499025856485008 0.0012010112162600477 -0.23786918649860667
    -0.0012024127660266374 -0.0005506869240066633 1.6027866280764136
    0 0 1
Resolution..... 4.7582 arcsec/pix
Rotation....... -114.624791 deg
Focal.......... 411.82 mm
Image center... RA: +05 04 56.325  Dec:-07 15 55.952
Image bounds:
  TopLeft...... RA: +05 05 54.144 Dec: -08 52 05.014
  TopRight..... RA: +05 10 26.512 Dec: -06 23 49.330
  BottomLeft... RA: +04 59 24.863 Dec: -08 07 47.598
  BottomRight.. RA: +05 03 58.918 Dec: -05 39 46.437

Now I have all the pieces necessary for constructing the WCS keywords. I hope to have it ready in a few days.


Edited for removing an obsolete version of the script. Please, use the last version.
« Last Edit: 2012 March 05 07:22:43 by Andres.Pozo »

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #8 on: 2012 March 01 08:56:42 »
I have tested the script with the entries of this month contest. I have been able to solve all but one:

IC 342
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    0.0005928055309323613 0.0004721516334621138 -0.3641335937119266
    0.0004728565185741555 -0.0005916493493551539 -0.00987076357729913
    0 0 1
Resolution..... 2.7274 arcsec/pix
Rotation....... -51.364863 deg
Image center... RA: +03 46 48.761  Dec:+68 05 53.511
Image bounds:
  TopLeft...... RA: +03 50 43.399 Dec: +68 06 19.140
  TopRight..... RA: +03 45 51.281 Dec: +67 44 41.531
  BottomLeft... RA: +03 47 48.030 Dec: +68 27 04.205
  BottomRight.. RA: +03 42 54.326 Dec: +68 05 07.112

 
Abell 21
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    -0.00017752461864504115 -0.0003462425984331703 0.33785349020514893
    0.0003465636739290167 -0.00017736813001716022 -0.10858073741452492
    0 0 1
Resolution..... 1.4011 arcsec/pix
Rotation....... 117.097688 deg
Image center... RA: +07 28 52.881  Dec:+13 18 08.828
Image bounds:
  TopLeft...... RA: +07 27 29.488 Dec: +13 24 38.958
  TopRight..... RA: +07 28 25.952 Dec: +12 57 52.795
  BottomLeft... RA: +07 29 19.885 Dec: +13 38 24.683
  BottomRight.. RA: +07 30 16.199 Dec: +13 11 37.000

IC 434
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    0.00011493140954809154 -0.0013640430722459327 1.0403898575396264
    0.0013645330330926432 0.00011602831684888024 -0.9141934627080415
    0 0 1
Resolution..... 4.9290 arcsec/pix
Rotation....... 85.153468 deg
Image center... RA: +05 38 35.029  Dec:-02 15 29.564
Image bounds:
  TopLeft...... RA: +05 34 25.131 Dec: -01 20 34.277
  TopRight..... RA: +05 33 51.636 Dec: -02 59 01.900
  BottomLeft... RA: +05 43 18.138 Dec: -01 31 53.783
  BottomRight.. RA: +05 42 45.241 Dec: -03 10 22.162
 
 
IC 410
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    0.000004488091200476447 0.0004522264429892269 -0.2470204484846687
    -0.0004512441673826314 0.000004807985415067577 0.3053680102246028
    0 0 1
Resolution..... 1.6263 arcsec/pix
Rotation....... -89.347971 deg
Image center... RA: +05 22 45.113  Dec:+33 24 57.636
Image bounds:
  TopLeft...... RA: +05 23 55.960 Dec: +33 06 36.224
  TopRight..... RA: +05 23 54.695 Dec: +33 43 35.274
  BottomLeft... RA: +05 21 36.027 Dec: +33 06 17.587
  BottomRight.. RA: +05 21 33.765 Dec: +33 43 16.513
 
IC2935, NGC2660 and Vela SNR
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    -0.000002322224546967854 -0.0005849419845754362 0.840461421527047
    0.0005845852099993975 -0.000002310131817363132 -1.2506452759052227
    0 0 1
Resolution..... 2.1052 arcsec/pix
Rotation....... 90.244416 deg
Image center... RA: +08 39 39.350  Dec:-48 10 14.721
Image bounds:
  TopLeft...... RA: +08 34 44.207 Dec: -46 54 49.431
  TopRight..... RA: +08 34 33.086 Dec: -49 25 14.750
  BottomLeft... RA: +08 44 30.961 Dec: -46 54 26.275
  BottomRight.. RA: +08 44 49.243 Dec: -49 24 50.428

NGC 7635
------------------------
Referentiation Matrix (Gnomonic = Matrix * Coords[x,y]):
    -0.000012054661364035286 0.0002167142613088296 -0.2028667913942405
    -0.0002167986511588695 -0.000012184676337912991 0.22847614359138313
    0 0 1
Resolution..... 0.7815 arcsec/pix
Rotation....... -93.210448 deg
Image center... RA: +23 20 45.632  Dec:+61 11 44.619
Image bounds:
  TopLeft...... RA: +23 22 25.988 Dec: +60 57 59.086
  TopRight..... RA: +23 22 39.451 Dec: +61 23 57.829
  BottomLeft... RA: +23 18 53.281 Dec: +60 59 25.520
  BottomRight.. RA: +23 19 03.809 Dec: +61 25 25.446

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Image Plate Solve Script
« Reply #9 on: 2012 March 01 09:03:44 »
Brilliant work, Andrés! :)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: Image Plate Solve Script
« Reply #10 on: 2012 March 01 18:03:37 »
I have tested the script with the entries of this month contest. I have been able to solve all but one:

:'( :'(

Jaja, great script, thank you!

Saludos.
Alejandro.

Offline Alejandro Tombolini

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1267
    • Próxima Sur
Re: Image Plate Solve Script
« Reply #11 on: 2012 March 01 18:20:19 »
Hola Andrés,

Where can I find the Star Database?

Regards, Alejandro.

Offline Enzo De Bernardini

  • PTeam Member
  • PixInsight Addict
  • ***
  • Posts: 274
  • Resistance is futile.
    • Astronomí­a Sur
Re: Image Plate Solve Script
« Reply #12 on: 2012 March 01 21:33:41 »
Hola Andrés,

Where can I find the Star Database?

Regards, Alejandro.

Here:

http://pixinsight.com/download/

"PPMX Astrometric Catalog"

Greetings,

Enzo.

Offline johnrt

  • Newcomer
  • Posts: 22
    • My Flickr Page
Re: Image Plate Solve Script
« Reply #13 on: 2012 March 02 01:52:41 »
I'm using a Mac with stuffit expander - it will not open the PPMX.bin file. Any way to open this on Mac?

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Plate Solve Script
« Reply #14 on: 2012 March 02 01:55:39 »
Hola Andrés,

Where can I find the Star Database?

Regards, Alejandro.
Hi Alejandro,

Enzo has already responded, but the next version will have a tooltip with the download address.