PixInsight Forum (historical)
Software Development => New Scripts and Modules => Topic started 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:
- Geometry: The geometry of the image can be a copy of the geometry of the active window (only when it has been plate solved and has WCS coordinates) or can be defined by the user. The geometry of the image is defined by the coordinates of the center, the resolution or focal, size in pixels and rotation. It is also important to define the epoch when using a catalog with the proper motion of the stars.
- Catalog: The list shows all the catalogs available in AnnotateImage. Only the catalogs with stars should be used.
- Saturation magnitude: The stars with a magnitude less than this value will be saturated. This value is necessary to limit the dynamic range of the image.
- Maximum magnitude: This parameter limits the magnitude of the stars read from the catalog.
- Background magnitude: This is the magnitude of the sky background. This value is necessary to limit the dynamic range of the image.
- PSF model: The script has implemented Gauss and Moffat Point Spread Functions. For both it is possible to choose the FWHM of the distribution. For Moffat there is an additional beta parameter.
- Generate noise: When this option is selected, noise is added to the image using an uniform distribution.
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:
- Graphics scale: This slider modifies the size of all the elements in the image at the same time. It is useful for applying the same annotation to images of different size. If the image is very big, the annotation can be too small. Increasing the "graphics scale" parameter the texts and markers are drawn bigger.
- Preview: The preview button opens a window with a previsualization of the annotation. The preview window can be resized, zoomed (using the toolbar or with the mouse wheel), and scrolled dragging the cursor. The preview caches the data from the catalogs so doing several tries for adjusting the annotation parameters is faster with the preview than before.
Latest version
This message will be kept updated with the latest versions of the scripts:
- ImageSolver v1.7.2
- AnnotateImage v1.5
- CatalogStarGenerator v0.1.1
-
Thank you, very useful (and what I needed)
I will test it soon 8)
-
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
-
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.
-
I have fixed a few small errors in CatalogStarGenerator:
- The search coordinates button didn't work.
- The window ID when using user defined geometry was not correct.
- The FITS tags for the images with user defined geometry were wrong.
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.
-
Would it make sense to distribute this via Juan's update system?
-
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
-
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.
-
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
-
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
-
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
-
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.
-
Thanks Philippe and Andrés.
I finnaly reduced the max magnitude and it worked ok.
Regards
Geert
-
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
-
Hi Andres,
Is there any way to use colour catalogues and generate coloured stars?
-
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.
-
I see. Thanks for the reply.
-
Sorry mate. Just updated PI and seems to have broken the script? Got this error:
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 = ;
.................................^
-
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.