PixInsight Forum

PixInsight => General => Topic started by: hvb356 on 2019 June 17 23:59:01

Title: MaskGen
Post by: hvb356 on 2019 June 17 23:59:01
Visitors of Herbert's wonderful www.skypixels.at know my new mask generator MaskGen. This tool needs an astrometric distortion corrected solution. One can create masks with variable diameter for stars up to mag 21.


Sent from my HUAWEI P20
Title: Re: MaskGen
Post by: oldwexi on 2019 June 18 10:15:38
Thank You Hartmut for this excellent tool!

I think its the only one available which REALLY creates "STAR"masks.
Because you are using the GAIA Catalog for creationg the stars.
All other so called "starmasktools" i know only create starmasks out of bright pixels in the image, 
no matter if they are stars, small galaxies, asteroids, hot pixels etc....

And ther possibility of creating/selecting  a starmask based on original star Magnitude is also a great help!

So, when creating a starmask -  if i want to keep the tiny galaxies and other nonstar objects i use your tool!

Again a great work.
Title: Re: MaskGen
Post by: Herbert_W on 2019 June 18 23:08:49

it is indeed a great script - I have tried it and am excited.

The image must be calculated astrometrically (ImageSolver) and after loading a catalog (Button Load catalog) you can create different masks.
A big advantage is that you can determine the number of stars the mask should contain (Mask magnitude range min/max).
You can also set the diameter of the stars in the mask (Star radii).
And as Gerald already mentioned, no problems with small galaxies, bright object areas, etc. - only stars!


Hartmut, you'll get special praise for that.  ;)

Best regards!
Herbert, Austria


The script is included in the Hartmut Repository and can be downloaded here - https://www.skypixels.at/pixinsight_scripts.html#MaskGen (https://www.skypixels.at/pixinsight_scripts.html#MaskGen)

Title: Re: MaskGen
Post by: Juan Conejero on 2019 June 19 05:00:16
An interesting and well designed and implemented script. I see several potential issues for its practical application, but very nice work!

Some of these scripts deserve their inclusion in the official PixInsight distribution for sure. I don't know why this has not happened before—probably my fault. I have just invited Hartmut to join our team of collaborators at our official GitLab open-source repositories.
Title: Re: MaskGen
Post by: rbotero on 2019 June 19 05:39:04
This is an excellent tool!  It takes me sometimes 3+ masks before I am happy that I have included all the stars I wanted in my stark mask.  For areas with nebulosity and small galaxies in the background (that look like stars), it is sent from heaven!  >:D
Thank you!

Title: Re: MaskGen
Post by: hvb356 on 2019 June 19 23:42:51
Thanks all for comments on my latest work and thank you Juan for your invitation. I followed the link and joined GitLab. At next, I need some further guidance there.


Title: Re: MaskGen
Post by: Russ on 2019 June 21 12:38:18
What an interesting tool! I've tried it on several images: about half the time, it works exactly as expected. With the other half, the script freezes and I get this message. Do you have an insight on what is happening?

*** Error [000]: /Applications/PixInsight/src/scripts/MaskGen.js, line 763: Error: Critical signal caught (11): Segmentation violation
PixInsight - Critical Signal Backtrace
Received signal 11 (SIGSEGV)
Module: 0   PixInsight                          0x000000010deb2382 InitializePixInsightModule + 1868482
  2: 1   libsystem_platform.dylib            0x00007fff5ed79b5d _sigtramp + 29
  1: 2   PixInsight                          0x000000010e1cd01c _ZTS6QBrush + 192
Title: Re: MaskGen
Post by: hvb356 on 2019 June 21 14:43:33
 Sorry, this kind of errors is beyond my scope. I do not want to rule out that the error lies in the method getPixels, which could be replaced by getSamples. Before doing so, I will try to find out the difference.
Title: Re: MaskGen
Post by: FrankW on 2019 June 22 02:11:01
I suspected that there is a problem with the current PI version. With I get the same error message. Running the script with the same picture on 01.08.061457 everything works fine.
Title: Re: MaskGen
Post by: freed on 2019 September 04 11:52:27

I used Imagesolver with success. However, when I click download, the text file downloaded is empty and the script shows zero stars. Any clues what is going on ? I'm on Mac OS.
Reading 1 image(s):
/Users/fredericdrevon/Astro/PI/Project/2019/NGC7331  Stefan's Quintet/Master/L.xisf
Loading image: w=3800 h=2925 n=1 Gray Float32
7 image properties
44 FITS keyword(s) extracted.
* Loaded astrometric solution:
Reference matrix (world[ra,dec] = matrix * image[x,y]):
 -7.90500000e-06  +2.91219108e-04  -4.10882879e-01
 -2.91217157e-04  -7.89759218e-06  +5.64868183e-01
WCS transformation ...... linear
Projection .............. Stereographic
Projection origin ....... [1900.018900 1462.481400]px -> [RA: 22 36 36.503  Dec: +34 13 55.29]
Resolution .............. 1.049 arcsec/px
Rotation ................ -88.446 deg
Transformation errors ... ex=5.48e-11 ey=3.27e-11 px
Focal distance .......... 590.02 mm
Pixel size .............. 3.00 um
Field of view ........... 1d 6' 25.3" x 51' 7.7"
Image center ............ RA: 22 36 36.505  Dec: +34 13 55.31
Image bounds:
   top-left ............. RA: 22 34 36.422  Dec: +34 47 45.14
   top-right ............ RA: 22 34 29.326  Dec: +33 41 20.88
   bottom-left .......... RA: 22 38 45.330  Dec: +34 46 21.43
   bottom-right ......... RA: 22 38 34.987  Dec: +33 39 58.26

run --execute-mode=auto "/Applications/PixInsight/src/scripts/MaskGen.js"

Processing script file: /Applications/PixInsight/src/scripts/MaskGen.js
Create a mask from    L
Dimensions    3800   2925
Pixel / Grad 3432.5889
Rotate by 88.4458
Frame around rotated image rectangle: [0.000000,0.000000,3026.987216,3798.602108]
Rect area pix^2 11498320.018862804
Frame rows of equal declination span: 2
Find 034.232026+339.152096
File: /Users/fredericdrevon/Downloads/034.232026+339.152096[2].txt
Open error or size = 0: /Users/fredericdrevon/Downloads/034.232026+339.152096[2].txt
JulianDay 2458711.5
Catalog filename: /Users/fredericdrevon/Downloads/034.232026+339.152096[1].txt
boxFile , remove /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
boxFile , remove /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
downloadCatalogBox , remove /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
Download /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
654 bytes transferred in 0.56 s @ 1.13 KiB/s
Download completed: /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
cc.progress 0.5
downloadCatalogBox , remove /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
Download /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
654 bytes transferred in 0.57 s @ 1.12 KiB/s
Download completed: /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
cc.progress 1
aggregateBoxes , remove /var/folders/6_/qbt7mdy52g51sw2s_lg2c9sh0000gn/T/MaxGenAggregat.txt
Bad table, reader closed
Bad table, reader closed
File header   {"columns":["_RAJ2000","_DEJ2000","Gmag","pmRA","pmDE","Plx"],"records":0,"minMag":99,"maxMag":-99}
Aggreate file /Users/fredericdrevon/Downloads/034.232026+339.152096[1].txt
Temp aggregat is empty: /var/folders/6_/qbt7mdy52g51sw2s_lg2c9sh0000gn/T/MaxGenAggregat.txt
Delete /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
aggregateBoxes , remove /Users/fredericdrevon/Downloads/MaskGenBox_0.txt
Delete /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
aggregateBoxes , remove /Users/fredericdrevon/Downloads/MaskGenBox_1.txt
Open error or size = 0: /Users/fredericdrevon/Downloads/034.232026+339.152096[1].txt
File created  /Users/fredericdrevon/Downloads/034.232026+339.152096[1].txt
Years since 2000: 19.62
# of catalogs:    0
Mask id created:  L_mask
Stars painted:    0
Stars within mag: 0
JulianDay 2458711.5
Script MaskGen end
Title: Re: MaskGen
Post by: Andres.Pozo on 2019 September 04 12:03:32
I don't know what is the problem with MaskGen, but ... why are you using the StereographicProjection in ImageSolver?
Title: Re: MaskGen
Post by: freed on 2019 September 04 14:03:52
Thank you very much for picking that up. Switching to Gnomonic resolved the issue.