PixInsight Forum (historical)

Software Development => New Scripts and Modules => Topic started by: Andres.Pozo on 2013 March 05 04:01:08

Title: CatalogStarGenerator
Post by: Andres.Pozo on 2013 March 05 04:01:08
I wrote the script CatalogStarGenerator the last year to generate a "copy" of an image without imperfections (geometric distortions, gradients, etc) using data from a catalog . A few weeks ago there was a request for an script with similar functionality so I have decided to publish it. For this, I had to modify it to implement a configuration dialog and allow setting manually the geometry.

The script tries to simulate an star field where the brightest stars are saturated and the dimmest are drown out in the sky background. The following parameters can be configured:
Since the script has not the limitations of a CCD camera (especially the well capacity or dynamic range) it is possible to generate very high dynamic range images. In this case ScreenTransferFunction has not enough precision to stretch the image. This happens when the difference between the background and saturation magnitudes is more than 10. The script warns when this happens. In this case if it is necessary to stretch the image for visualizing it, the best method is to open STF, apply the autostretch, drag the STF to the HistogramTransformation, apply the HT to the image and reset the STF. This method is useful for any HDR image.

I have also a couple of improvements in AnnotateImage:
Latest version
This message will be kept updated with the latest versions of the scripts:
Title: Re: CatalogStarGenerator
Post by: Philippe B. on 2013 March 05 07:40:45
Thank you, very useful (and what I needed)
I will test it soon  8)
Title: Re: CatalogStarGenerator
Post by: oldwexi on 2013 March 05 12:33:21
Thank You Andres!
again a great gift.

Before i install the scripts  a question:
Do they run only in PI 1.8  or only PI 1.7
or in both ?

Thanks
Gerald
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2013 March 05 13:23:11
Before i install the scripts  a question:
Do they run only in PI 1.8  or only PI 1.7
or in both ?
I have only tested them in PI 1.8RC3. I think that they should run in 1.7, but I don't know.
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2013 March 07 02:21:26
I have fixed a few small errors in CatalogStarGenerator:

This version also fixes an small error in ImageSolver: It had a half pixel error in RA reading the coordinates from the FITS tags.

The new version can be downloaded from the first post in this thread.
Title: Re: CatalogStarGenerator
Post by: georg.viehoever on 2013 March 07 03:34:56
Would it make sense to distribute this via Juan's update system?
Title: Re: CatalogStarGenerator
Post by: Philippe B. on 2013 March 13 07:36:59
Hello
I made some tests and it seems to work fine (but we have to think about several values  8) which can be wrong )

If you have time to improve thsi script, I would suggest :

- choice of local PPMX catalog (like you have in Image Solver script, where you can choose local or internet catalog)
- in "user define geometry" choice, could you read the RA and DEC of the image (solved by "imagesolver" for example). Then put the values in the cases. Sometimes, I want to use the default image parameter but put a bigger star map with an angle. So if by default the RA and Dec values are filled like you have in Annotate script, it should be fine !!!!

Many thanks for your script. It was what I needed to preprocess all my images with my newest method.

Cheers
Philippe
 
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2013 March 13 08:02:47
Hi Philippe,

- choice of local PPMX catalog (like you have in Image Solver script, where you can choose local or internet catalog)
I don't know if this is possible. I don't know the format of PPMX.bin and if it is possible to read it using Javascript. Perhaps I could use the process StarGenerato to write in a file the position and flux of the stars and then read this file and draw the stars.
I will think about it.
- in "user define geometry" choice, could you read the RA and DEC of the image (solved by "imagesolver" for example). Then put the values in the cases. Sometimes, I want to use the default image parameter but put a bigger star map with an angle. So if by default the RA and Dec values are filled like you have in Annotate script, it should be fine !!!!
This should be easy. I can add a new button that copies the values of the current window to the "user defined" fields.

The configuration dialog has tooltips in all the fields describing the function of each parameter. If there is any not clear enough please report it to me. Thanks.

Andrés.
Title: Re: CatalogStarGenerator
Post by: Philippe B. on 2013 March 13 08:17:18
Hi andres
Many thanks !


For PPMX.bin, look at your IMAGE SOLVER script
You already have this option in the Model Parameter option (local or VizieR star catalogs)
On local, you can choose PPMX.bin on the hard drive and it seems to be OK

Cheers
Philippe

Title: Re: CatalogStarGenerator
Post by: gvanhau on 2013 March 13 08:48:02
Hello Andres
Las night I tried the scrip in order to generate a starfield as base for a big mosaic I'm building.
I selected an area of 10000x10000 pixels, and used focal lenght and pixels size option for scale.

The script ended normally, buy it only generated few stars in a horisontal band at the center of the image (about 1/3 of image).
I tried this with two different catalogs getting same result.

What could be wrong?

Regards
Geert
Title: Re: CatalogStarGenerator
Post by: Philippe B. on 2013 March 13 09:06:20
Hi Geert
I got the same result bu I think (but I'm not sure) it is limited by the download size from the servers.
If you ask for a mag 19 stars with 10000x10000, maybe it is more than 100,000 stars and it cannot accept and reduce the size to an R.A. range ?
Try lower the max magnitude 
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2013 March 13 09:46:48
Hello Andres
Las night I tried the scrip in order to generate a starfield as base for a big mosaic I'm building.
I selected an area of 10000x10000 pixels, and used focal lenght and pixels size option for scale.

The script ended normally, buy it only generated few stars in a horisontal band at the center of the image (about 1/3 of image).
I tried this with two different catalogs getting same result.

What could be wrong?

Regards
Geert
When a query to a VizieR server produces a large result, the server only returns the first X rows, where X is a quite large value (>100.000).

The solution is to generate the image by tiles or to reduce the maximum magnitude.
Title: Re: CatalogStarGenerator
Post by: gvanhau on 2013 March 14 08:56:25
Thanks Philippe and Andrés.
I finnaly reduced the max magnitude and it worked ok.

Regards
Geert
Title: Re: CatalogStarGenerator
Post by: Alejandro Tombolini on 2013 March 17 16:36:48
Would it make sense to distribute this via Juan's update system?
+1

Hi Andres, thanks for all your scripts!!! :)

I am not sure if I have the latest version of the script, but in this version I noticed that the Reset button do not works as I expected when the windows comes from an icon. It reset to the values of the original icon when I was expected to erase all values.
There is no problem when it comes from Script>Render>CatalogStarGenerator.

Saludos. Alejandro

Title: Re: CatalogStarGenerator
Post by: troypiggo on 2015 July 23 22:30:52
Hi Andres,

Is there any way to use colour catalogues and generate coloured stars?
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2015 July 24 02:03:34
Some of the catalogs have several filters. You could generate separate images with different filters to combine in a color image.

However, I don't know of any catalog with RGB filters that could be used for generating "real color" images. Most of the star catalogs are made with photometric filters that are not designed for RGB images. Moreover, in most catalogs there are many stars which don't have magnitude for one or more filters.
Title: Re: CatalogStarGenerator
Post by: troypiggo on 2015 July 24 02:10:23
I see.  Thanks for the reply.
Title: Re: CatalogStarGenerator
Post by: troypiggo on 2015 August 02 01:08:48
Sorry mate.  Just updated PI and seems to have broken the script?  Got this error:

Code: [Select]
run --execute-mode=auto "C:/Program Files/PixInsight/src/scripts/AdP/CatalogStarGenerator.js"

Processing script file: C:/Program Files/PixInsight/src/scripts/AdP/CatalogStarGenerator.js
*** Error [133]: C:/Program Files/PixInsight/src/scripts/AdP/CatalogStarGenerator.js, line 530: SyntaxError: syntax error
this.projection_Combo.minWidth = ;
.................................^
Title: Re: CatalogStarGenerator
Post by: Andres.Pozo on 2015 August 02 01:25:57
There are several problems in PI 1.8.4 in my scripts. I am testing them now and also waiting for a bug fix in PI.

The released version of the scripts is a beta with known problems. I also couldn't test them in PI 1.8.4.

Hopefully I'll have them fixed today and will be released shortly after that.