Author Topic: At last ... the ultimate FWHM-tool ...... not.  (Read 18199 times)

Hans Pleijsier

  • Guest
At last ... the ultimate FWHM-tool ...... not.
« on: 2011 February 23 09:51:48 »
This is a script to investigate starshapes.
Just for the fun of it so that we can kill the time waiting for a better tool made by Juan & Team.
Before you start the script you should create a preview window around one star with ample background in a one-channel image.
For the best result: width = height = about 7 times the diameter of the starimage.
Please do not try the tool on saturated stars or on stretched images, the script will not work.

First the Backgroundlevel is established in a conditional routine:
The histogram is clipped within 3 sigma's of the median.
That way the bright pixels are thrown out until the consecutive mean values of the remaining pixels is changing by only 2 %.
Why? Because I think I read something like that in the documentation of SourceExtractor.

The backgroundlevel is then subtracted from all pixels.
Then the script selects the row and column with the maximum total pixel brightness and the standard deviation for the row and column is calculated in pixels.
FWHM in pixels is obtained by: FWHM = 2 * Sqrt(2*Ln(2)) * stdDEV.
FWHM in arcseconds is calculated with the focal lenght and the pixelsize of your CCD.

I used three scripts to shop around and copy and paste:
* the Polarcoordinates script from Juan Conejero (PTeam)
* the BatchDeBayer script by Ken Pendlebury and Juan Conejero
* and the Canon Debanding script from Georg Viehoever.
Many thanks to them.

Made on a Macbook/snow leopard.
I tested it - on MonoChrome and linear fitfiles - and compared the readings with
ImagesPlus under Windows: IP is a bit more optimistic about FWHM ... and gives you smaller values.

Disclaimer: this is my personal learning project. It will contain idiotic programming.
But if you get the wrong results,
please rewrite it or ... just crank up the sliders until you are happy with the output ;-)


regards, HP.


Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #1 on: 2011 February 23 19:18:20 »
Have you compared the results with the module I wrote?
Regards,

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

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #2 on: 2011 February 23 23:54:16 »
Carlos,

That is a good idea.
I will set up a scientific :P  test and publish the results so that you can verify.
I will compare 4 FWHM-tools: your module, ImagesPlus, SourceExtractor and my script.

Hans

PS: what if I win  ;)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #3 on: 2011 February 24 04:53:22 »
;)
It is suppused that given the same sky level, your calculation and mine shold be pretty much the same. Statiscaly, the std dev of the data corresponds to the sigma (also std dev) of a normal (gaussian) distribution. It can be proved by maximum likelyhood parameters. In two dimensions it is quite the same.

Before furthet analysis, I would investigate which PSF are IP and SExtractor using. If it is not a gaussian curve, we should also implement other fittings. I've been working with a non linear least squares minimization algorithm that I may incorporate into the StarStatistics class, and then, perform more clomplex modelizations. Let me know what you find :)
(I'm in the middle of moving to a new house, so my free time is almost non existant :D).
Regards,

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

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #4 on: 2011 February 24 08:11:12 »
Carlos,
This is round 1 in the test for FWHM-tools.
The target is an artificial star.
See the attachment: it is a jpeg-copy of a fit-file that contains a <<perfect star>>.
The star is a cross-shape with one column and one row. Pixelvalues are:
0.343 / 0.5651 / 0.7585757 / 0.89899998 / 0.7585757 / 0.5651 / 0.343.
I choose these values because the FWHM equals 3.9999 in pixels. You can verify this in the attached excel-file.
In this test I use a FL of 660mm and a CCDpixelsize of 6.45. That is app. 2.02 arcsec per pixel.

Ok the results sofar in pixels and arcseconds
ImagesPlus: 3.0 and 6.06  // Remark: based on the very specific pixvalues I can NOT understand this; it is too optimistic.
Sextractor: 5.22 -> 10.54 // Sextractor reports that it assumes a gaussian core and that is what we want here.
Stareval: 4.00 and 8.06    // No surprise for me.
CarlosModule: unknown and unknown!!!

Carlos, as I am running MacOSX I can not use your module. We need help!

Round 2 will be on real data ....

The score sofar:
number 1: Stareval.
number 2: Sextractor.
number 3: IP.
number 4: CarlosModule (did not finish).

I know it is unfair but this is how it goes  :police:

your testdriver, Hans

PS: Hope your new home will be good for you.





Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #5 on: 2011 February 24 08:13:13 »
and the artificial star jpeg:

HP

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #6 on: 2011 February 24 09:01:07 »
Here are the results with my module (in pixels):
Code: [Select]
*** PSF results ***

Sigma...........: 1.4007
FWHM............: 3.2984
Total Flux......: 12.1476
Peak Intensity..: 0.985462
Center..........: 123.97 , 123.964

*** Distribution data ***
Sigma X.........: 1.39639
Sigma Y.........: 1.40501
Correlation.....: 0.00800831
0.150 s

I'm not surprised that the results are more optimistic. What we are calculating here is not 1D dispersion, but 2D. You need to build a sinthetic, radially symmetric star. You may use this file: http://pteam.pixinsight.com/pcldev/starstatistics/startest.zip
It has a 16bit fits file with lots of sinthetic stars. The parameters I used are in the rtf and xpsm files.
Regards,

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

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #7 on: 2011 February 25 06:59:56 »
Like you say and my script is based on a 2d-approach.

But on the other hand ... when the PSF is radially symetric bell-shaped, you can absolutely model it as a 2d gaussian curve with the pixels as x-axis and the pixelvalues as y-axis.

Anyway, I was always very surprised and sceptic when I measured my own starimages, taken with a 4-inch refractor on a wobbly and older Losmandy gm-8 and from a very heavy light poluted area (close to Amsterdam and the airfield) that some software told me I had FWHMs of 3 or 4 arcseconds.

I will not buy that, whatever model is working.

The test will continue soon!


Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #8 on: 2011 February 25 07:29:25 »
Hi guys,

just a little idea. Use StarGenerator to generate stars of a known FWHM. ;)


Regards,
Vicent.

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #9 on: 2011 February 25 07:55:41 »
It can be done with a PixelMath expression too... It is on the xpsm in the zip file.
Regards,

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

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #10 on: 2011 February 27 10:42:54 »
This is part two of the FWHM-test. I took 9 random stars from a fitfile of mine and measured fwhm with IP, stareval and Sextractor.
Rather close finish sofar.
Bear in mind that Sextractor is designed for a special purpose: reduction of large scale galaxy-survey data. Its FWHM-tool is a plus.

Carlos, please add your values so we can make up the score ... I can send you the fitfile.


            1      2      3      4      5      6      7      8      9
ImagesPlus      4,54   5,55   4,04   7,07   4,04   7,07   8,08   4,54   6,06   
Stareval      4,98   4,99   4,7   6,72   4,29   6,94   6,86   4,79   6,04   
Sextractor      8,53   4,8   4,98   7,48   4,23   7,62   7,08   4,68   5,91   
CarlosModule                                 

A jpg-file is attached.
 

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #11 on: 2011 February 28 05:15:23 »
1: 3.29
2: 3.3
3: 3.18
4: 3.41
5: 2.75
6: 3.50
7: 3.40
8: 2.90
9: 3.28

Reading the fits file should get more accurate results, but despite the fact that my results are more optimistic (could it be a scale factor? Are you measuring in arcsecs?), I'm happy with them, since they show very little dispersion, and this is the "ideal" case for any astronomical image.
Regards,

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

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #12 on: 2011 February 28 08:40:37 »
Ideally (ignoring optical distortions such as coma, diffraction spikes), I would assume that the FWHM for all stars in one picture would be identical (is this correct?). I wonder why ImagesPlus,Stareval,Sextractor show so strongly varying values.

If you look at the attached screenshot, it appears that the first 3 at least measure something similar, while Carlos module does something else...

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

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #13 on: 2011 February 28 09:34:44 »
Georg, Carlos,

1. The results of Carlos are in pixels; the other three are in arcseconds. Multiply Carlos' results by 2.016 and we can compare the four sets.
2. Carlos measured fwhm from a jpeg-file; the other three from a fit-file.
3. I will forward the fitfile asap.

Hans

Hans Pleijsier

  • Guest
Re: At last ... the ultimate FWHM-tool ...... not.
« Reply #14 on: 2011 February 28 10:00:43 »
you can downlaod the file  << zeta_cephei_test_FWHM.fit >> at:  https://public.me.com/hp58.