Author Topic: Annotation script  (Read 88286 times)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #15 on: 2012 March 14 21:06:30 »
I have ready a first version of the script. It is still not finished, but it can be used for testing.

The attached .zip has four files:
  • Annotation script
  • Shared code
  • New version of plate-solve script
  • NGC-IC catalog for the NGC layer in the script.
The script still needs a lot work. In the following days (¿weeks?) I plan to write the following functionality:
  • SVG output
  • Proper motion for stars in catalogs with this data
  • More catalogs. I accept suggestions.
  • Reordering of layers.
  • Saving the settings to a file.
  • Better layout of the configuration dialog and cleanup of the code
Feedback will be welcome.

Edited for removing an obsolete version of the script. Please, use the last version.
« Last Edit: 2012 March 14 23:16:42 by Andres.Pozo »

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Re: Annotation script
« Reply #16 on: 2012 March 14 22:46:38 »
Excellent.  Been eagerly waiting this.

One minor comment.  Line 332 of script gives and error, because you've hard-coded the path to ngc2000.txt.  I manually changed it to my path and the script seems to be working fine.  Still running as I type this, the USNO catalog annotation seems to be taking a while to download and have a think about.

So you have to use ImageSolver first to get the WCS coords into image, then run AnnotateImage?

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #17 on: 2012 March 14 23:15:48 »
Excellent.  Been eagerly waiting this.

One minor comment.  Line 332 of script gives and error, because you've hard-coded the path to ngc2000.txt.  I manually changed it to my path and the script seems to be working fine.  Still running as I type this, the USNO catalog annotation seems to be taking a while to download and have a think about.

So you have to use ImageSolver first to get the WCS coords into image, then run AnnotateImage?

Thank you for pointing me to this error. I have fixed it.

Regarding the USNO catalog, you should try to find which mirror of VizieR works better for you. From Spain, both Strasbourg and Cambridge (UK) work very well and it takes only a few seconds to download the stars. The duplicates removing can be slow when there are lots of stars.

This script uses the WCS coords. You can get them using ImageSolver but also with PinPoint or even Astrometry.net.


Edited for removing an obsolete version of the script. Please, use the last version.
« Last Edit: 2012 March 18 21:34:03 by Andres.Pozo »

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 967
    • View Profile
    • http://www.astrofoto.es/
Re: Annotation script
« Reply #18 on: 2012 March 14 23:26:22 »
Hi Andrés,

It would be very nice if you can just type the CDS catalog code. This would allow to identify sources of interest. For example, I have a deep photo of M51and want to locate the planetary nebulae in this galaxy. First, I go to Vizier and do a search for catalogs containing PNe in M51. Then I go to PI and in the options of your script I put the catalog code that Vizier gives. The result is my image in which only the sources I'm interested on are marked.

Another important option is, IMO, to be able to select a magnitude range, with both lower and upper limits.

And another wonderful option would be to select a list of files so it annotates all of them in a single action.


Congratulations. Best regards,
Vicent.

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Re: Annotation script
« Reply #19 on: 2012 March 14 23:33:37 »
Excellent.  Been eagerly waiting this.

One minor comment.  Line 332 of script gives and error, because you've hard-coded the path to ngc2000.txt.  I manually changed it to my path and the script seems to be working fine.  Still running as I type this, the USNO catalog annotation seems to be taking a while to download and have a think about.

So you have to use ImageSolver first to get the WCS coords into image, then run AnnotateImage?

Thank you for pointing me to this error. I have fixed it.

Regarding the USNO catalog, you should try to find which mirror of VizieR works better for you. From Spain, both Strasbourg and Cambridge (UK) work very well and it takes only a few seconds to download the stars. The duplicates removing can be slow when there are lots of stars.

This script uses the WCS coords. You can get them using ImageSolver but also with PinPoint or even Astrometry.net.

Sorry mate.  Got this error:

Code: [Select]
run --execute-mode=auto "/Users/troy/Applications/pixinsight/AnnotateImage.js"

Processing script file: /Users/troy/Applications/pixinsight/AnnotateImage.js
*** Error [000]: /Users/troy/Applications/pixinsight/AnnotateImage.js, line 341: Error: File.openForReading(): invalid argument type: String expected.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #20 on: 2012 March 14 23:39:52 »
It would be very nice if you can just type the CDS catalog code.
I also thought of that but it is not easy. Each catalog has different fields for the id of the object and the coordinates. For example, the Tycho catalog uses three fields for storing the object id and the RA is stored in degrees. PGC only needs one field for the id and the RA is in hours. Also, not every catalog has a magnitude field.
Perhaps I could write a generic VizieR layer, but it would be quite involved to use.

Quote
Another important option is, IMO, to be able to select a magnitude range, with both lower and upper limits.
This is easy.

Quote
And another wonderful option would be to select a list of files so it annotates all of them in a single action.
I have to think about what is the bet way for adding this functionality.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #21 on: 2012 March 14 23:42:51 »
Excellent.  Been eagerly waiting this.

One minor comment.  Line 332 of script gives and error, because you've hard-coded the path to ngc2000.txt.  I manually changed it to my path and the script seems to be working fine.  Still running as I type this, the USNO catalog annotation seems to be taking a while to download and have a think about.

So you have to use ImageSolver first to get the WCS coords into image, then run AnnotateImage?

Thank you for pointing me to this error. I have fixed it.

Regarding the USNO catalog, you should try to find which mirror of VizieR works better for you. From Spain, both Strasbourg and Cambridge (UK) work very well and it takes only a few seconds to download the stars. The duplicates removing can be slow when there are lots of stars.

This script uses the WCS coords. You can get them using ImageSolver but also with PinPoint or even Astrometry.net.

Sorry mate.  Got this error:

Code: [Select]
run --execute-mode=auto "/Users/troy/Applications/pixinsight/AnnotateImage.js"

Processing script file: /Users/troy/Applications/pixinsight/AnnotateImage.js
*** Error [000]: /Users/troy/Applications/pixinsight/AnnotateImage.js, line 341: Error: File.openForReading(): invalid argument type: String expected.

You have to select the NGC layer and fill the path of the catalog. I will add a check for an empty path and warn the user.

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Re: Annotation script
« Reply #22 on: 2012 March 15 00:01:03 »
Aah, I see now.  Thanks.  Must've worked first time around because I had hardcoded in my path.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2116
    • View Profile
Re: Annotation script
« Reply #23 on: 2012 March 15 01:01:27 »
Andres,

solver and annotation worked nicely for me. Remarks:

- also ran into the line 341 problem. Maybe the path can default to the path where the script is stored??
- worked nicely on a 85mm image, despite of distortions and a wrongly specified 5.6um pixel size. Loaded the DSLR images with SuperPixels debayering, which joins 4 bayer pixels into one super pixel. Script compensated for this by adjusting focal length to 41.3mm, see screenshot
- I would like to see the ability to change the size of object labels. Currently I can do it only for the grid labels.
- There is a strange cluster of labels at the upper left.
- Spectacular work!  8)

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

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Re: Annotation script
« Reply #24 on: 2012 March 15 01:21:37 »
Georg,

I only realised after Andres' last post.  In the window with the different catalogues, by default it seems the grid lines one is highlighted.  If you click on the NGC one for example and look down the bottom, you can change the colours and fonts for that catalogue now.  And hit the down arrow next to the cat path and point it to your ngc2000.txt file will solve the line 341 problem.  ;)

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 967
    • View Profile
    • http://www.astrofoto.es/
Re: Annotation script
« Reply #25 on: 2012 March 15 01:22:09 »
It would be very nice if you can just type the CDS catalog code.
I also thought of that but it is not easy. Each catalog has different fields for the id of the object and the coordinates. For example, the Tycho catalog uses three fields for storing the object id and the RA is stored in degrees. PGC only needs one field for the id and the RA is in hours. Also, not every catalog has a magnitude field.
Perhaps I could write a generic VizieR layer, but it would be quite involved to use.

Then let the user import his own catalogs as text files with a format imposed by you. It is very easy to import CDS catalogs into a spreadsheet page and modify the original format (if they are not too big).


V.

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 967
    • View Profile
    • http://www.astrofoto.es/
Re: Annotation script
« Reply #26 on: 2012 March 15 01:57:20 »
One example more. This is a 10x1 min exposure with a 105 mm lens closed to f/16 and R filter:



It would be very nice if we have:

- Constellation names and lines.
- Bright star catalogs and constellation stars with greek designations.

Regards,
Vicent.

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 252
    • View Profile
Re: Annotation script
« Reply #27 on: 2012 March 15 07:50:44 »
Sorry to be a pain, Andres.  Been playing around with it this afternoon.  All seems to work fine as long as the output mode is "annotate image".  When I changed it to overlay, there was something funny in the background.  If I then change output mode back to annotate image, there are strange colours all over the image - despite it being a monochrome Ha image!  See image below.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #28 on: 2012 March 15 09:28:18 »
Sorry to be a pain, Andres.  Been playing around with it this afternoon.  All seems to work fine as long as the output mode is "annotate image".  When I changed it to overlay, there was something funny in the background.  If I then change output mode back to annotate image, there are strange colours all over the image - despite it being a monochrome Ha image!  See image below.
You are not a pain  ;). Instead, you are helping me to finding bugs and problems in the script.

The "Overlay mode" generates a transparent image with the annotation drawn over it. The "something funny in the background" is the chessboard that Pixinsight shows by default in the background of the transparent images. This pattern can be changed at "Edit | Global Preferences | Default Transparency Settings". The overlay mode is intended for generating an image that can be overlapped on the original image using other applications with different capabilities (MS Word, PS, ...).

Both modes generate RGB images in order to be able to use different colors for the annotation. I haven't been able to replicate the strange behavior when you change the mode back to "Annotate image".

Quote
I only realised after Andres' last post.  In the window with the different catalogues, by default it seems the grid lines one is highlighted.  If you click on the NGC one for example and look down the bottom, you can change the colours and fonts for that catalogue now.  And hit the down arrow next to the cat path and point it to your ngc2000.txt file will solve the line 341 problem. 
When I designed the dialog I thought that this behavior would be intuitive. Clearly it doesn't. I have to re-think it and make a few changes for adding clues so that the user can discover this more easily.


Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 818
    • View Profile
Re: Annotation script
« Reply #29 on: 2012 March 15 09:42:09 »
Then let the user import his own catalogs as text files with a format imposed by you. It is very easy to import CDS catalogs into a spreadsheet page and modify the original format (if they are not too big).

I will add this to the TODO list. I used this path for generating the ngc2000.txt file. I imported in Excel a few catalogs from Vizier, joined them and then saved as a text file.

The format will be very simple:
   RA(deg) <tab> Dec(deg) <tab> Diameter(arcmin) <tab> Name

The user will be responsible of any filtering that he needs.