Author Topic: PSFEstimation script  (Read 63377 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #45 on: 2012 November 12 10:52:07 »
Here is a new version of the script with some of pfile's and Vicent's suggestions. Install it like before, use Feature Scripts to remove the old version. pfile, you can move or copy files to different directories. Vicent, you can specify a rectangular measurement area, plot legibility is better, no watch dog.

Note: All subframes should be observations of the same target. Small variations in targeting are acceptable, such as those due to dithering and meridian flipping. Larger variations in targeting will result in incomparable property measurements. Add at most several hundred subframes. Adding more than that may result in poor performance of the script.

Thanks,
Mike

https://dl.dropbox.com/u/109232477/SubframeSelector.0.5.zip

A variation: Rather than replacing a ringing pixel with its bilinear equivalent, it seems better to blend the two pixels. This maintains more "sharpness". With this tweak FWHM is even smaller.
« Last Edit: 2012 November 28 17:38:50 by mschuster »

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: PSFEstimation script
« Reply #46 on: 2012 November 14 11:44:02 »
Hi Mike,

Just tested the latest version and it worked flawlessly, thank you very much. I've noted that cropping the images to 0.15 megapixels is not faster than cropping to 1.5; anyway, it's much faster than working with 16 mp images!

I tested also how the registering process affects the FWHM values. In the image set the stars where always 2 - 5 pixel wide. The graph below shows the relation of FWHM values between the images before and after the registering process:



The result is very good. The green line represents the 1 to 1 ratio. The red line is a quadratic fit of the FWHM value data set. As you see, the registering process increases the FWHM values when the images are sharper. IMO, this weighting must be calculated after the registering if your typical FWHM are below 2 pixels.


Best regards,
Vicent.

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: PSFEstimation script
« Reply #47 on: 2012 November 14 14:58:25 »
Hi again,

Another graph to compare Lanczos-3 vs Bicubic Spline. In this one I compare the FWHM of the original images versus the FWHM values after registering with Bicubic Spline interpolation:




Regards,
Vicent.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: PSFEstimation script
« Reply #48 on: 2012 November 14 17:27:05 »
thanks so much for hacking in my suggestion, i appreciate it.

i am debugging collimation issues so this script is timely.

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #49 on: 2012 November 15 10:13:02 »
Thanks pfile and Vicent.

Vicent, here are data for my 4.2 arcsec/pixel subs. The increase in FWHM is about 0.6/0.9 arcsec. MRSNoise of registered subs whose FWHM approaches 1 pixel is a problem. Basically NoiseEvaluation weights of registered subs in ImageIntegration are random numbers. This is the reason why I prefer non-registered measurements. As a workaround I record NoiseEvaluation weights of calibrated, non-registered subs in FITS headers, carry these values through registration and use them in ImageIntegration.

Thanks,
Mike




« Last Edit: 2012 November 15 10:24:50 by mschuster »

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: PSFEstimation script
« Reply #50 on: 2012 November 15 11:26:33 »
Hi,

Yes, of course, the noise weighting is far more accurate if done before registration. This is specially true if there is a slight rotation of the images because of moire effects, even with Lanczos.

One suggestion: Try Lanczos 4 or 5 to see what happens with your FWHM values.

In your system seeing effects are negligible (if not under very poor conditions). So, once you include the watch dog, this could be useful for focus monitoring while acquiring data.


Regards,
Vicent.

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #51 on: 2012 November 15 15:29:12 »
Lanczos 4 rings worse than Lanczos 3, FWHMs are nearly equal. I didn't try 5, IMO it will be even worse.
Mike

Offline mwasilew

  • Newcomer
  • Posts: 7
Re: PSFEstimation script
« Reply #52 on: 2013 January 03 10:55:12 »
Hi,

I was trying to run the script and generate the text output. The output I got contained somehow strange values, so I tried to run DynamicPSF manually using the same stars. It appears, that manual run gave different output than script. Any idea what happened? The values are totally different. For example script gave Sx=9.89 and manual run Sx=1.46 (see screenshot).

milosz

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #53 on: 2013 January 03 17:16:56 »
Hi milosz,

Yes, I understand what has happened. I believe you ran the script a second time with the fitted star map as target rather than the original image as target. The fitted star map image contains the cross marks, and trying to fit those marks gives the completely nonsensical results. Please make sure that your original image is the active target and rerun the script. This is an easy mistake to make, running with the wrong target, when there are many open windows in the workspace.

You might also try the batch version of the script. It runs on a set of files and so it is much less likely that mistakes like this happen.

Thanks for posting, sorry for the trouble,
Mike

Offline mwasilew

  • Newcomer
  • Posts: 7
Re: PSFEstimation script
« Reply #54 on: 2013 January 04 02:39:26 »
Mike,
You are perfectly right. My mistake. The name of the image is incorporated in the file name with the results :) I ran it again and it gave good results.

There is one improvement you can do in the script. Please add the column names on top of the results. It helps reading it. I had to dig into the code to learn which columns represents which value.

milosz

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #55 on: 2013 January 04 10:39:21 »
Hi Milosz,
Column names are there just above Star #1. But probably too terse and too easy to miss.
Mike

Offline mwasilew

  • Newcomer
  • Posts: 7
Re: PSFEstimation script
« Reply #56 on: 2013 January 04 11:55:44 »
Mike,

I don't see the column names there:
Code: [Select]
Target view,broom_ha_600s2
Star detection layers,4
Noise reduction layers,2
Hot pixel filter radius (px),1
Log(detection sensitivity),0.00
Star peak response,0.80
Maximum star distortion,0.50
Generate detected stars map,false
Model function,Moffat4
Circular point spread function,false
Scale mode,Pixels
Elongation mode,Eccentricity
Generate fitted stars map,false
Mosaic size,1
Generate visualization,false
Aggregate visualization,false
Generate tabulation,true
Stars fitted,829
Star,1,0.018834,1.387844,5.21,315.79,1.30,1.22,0.933,16.33,1.346e-003
...

Do I have an outdated version of the script? I'm using 0.33.

I also don't see them in the code itself:
Code: [Select]
         file.outTextLn("Stars fitted," +
            rowColumn + format("%d", psfEstimates[0][i][PSFEstimate_StarsFitted]));
         if (psfEstimates[0][i][PSFEstimate_StarsFitted] != 0) {
            if (parameters.circularPSF) {
               for (var j = 0; j != psfEstimates[1][i][Barycenters_Points].length; ++j) {
                  file.outTextLn(
                     "Star," +
                     rowColumn +
                     format("%d,", j + 1) +
                     format("%.6f,", psfEstimates[1][i][Barycenters_Points][j][PSF_B]) +
                     format("%.6f,", psfEstimates[1][i][Barycenters_Points][j][PSF_A]) +
                     format("%.2f,", psfEstimates[1][i][Barycenters_Points][j][PSF_X]) +
                     format("%.2f,", psfEstimates[1][i][Barycenters_Points][j][PSF_Y]) +
                     format("%.2f,", scaleModeUnits[0] * FWHMPerStdDev[parameters.modelFunction] *
                        psfEstimates[1][i][Barycenters_Points][j][PSF_Sx]) +
                     format("%.3e", psfEstimates[1][i][Barycenters_Points][j][PSF_MAD])
                  );
               }

I mean something like
Code: [Select]
         file.outTextLn("Stars fitted," +
            rowColumn + format("%d", psfEstimates[0][i][PSFEstimate_StarsFitted]));
         if (psfEstimates[0][i][PSFEstimate_StarsFitted] != 0) {
            if (parameters.circularPSF) {
               file.outTextLn("Name,No,B,A,X,Y,Sx,MAD");
               for (var j = 0; j != psfEstimates[1][i][Barycenters_Points].length; ++j) {
                  file.outTextLn(
                     "Star," +
                     rowColumn +
                     format("%d,", j + 1) +
                     format("%.6f,", psfEstimates[1][i][Barycenters_Points][j][PSF_B]) +
                     format("%.6f,", psfEstimates[1][i][Barycenters_Points][j][PSF_A]) +
                     format("%.2f,", psfEstimates[1][i][Barycenters_Points][j][PSF_X]) +
                     format("%.2f,", psfEstimates[1][i][Barycenters_Points][j][PSF_Y]) +
                     format("%.2f,", scaleModeUnits[0] * FWHMPerStdDev[parameters.modelFunction] *
                        psfEstimates[1][i][Barycenters_Points][j][PSF_Sx]) +
                     format("%.3e", psfEstimates[1][i][Barycenters_Points][j][PSF_MAD])
                  );
               }


I would also remove all the summaries from the CSV. IMO CSV should contain only the data for the fitter stars + column names.

milosz

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #57 on: 2013 January 04 14:52:38 »
Oh, sorry. I added the column labels in the batch script output and forgot that I had not in this script. 0.33 is the latest. I like having the summary to help document the data, but please go ahead and delete that code if you wish.
Mike

Offline mcgillca

  • PixInsight Enthusiast
  • **
  • Posts: 77
    • Astrobin Website
Re: PSFEstimation script
« Reply #58 on: 2013 February 08 10:28:55 »
Dear Mike,

Hi - I have been using both your PSFEstimator and Subframeselector scripts for some time - they are fantastic.

I've just upgraded to Ripley RC3, and find that both produce the same error. The scripts run, identify a number of stars using the star alignment module, but then were unable to detect the stars in the StarDetection part of the algorithm.

I had a play with the PSFEstimator script. Very ingenious - you convolved the cross pattern that the StarAlignment uses with the same pattern, and where you get a 1, that's the star centre.

I took a look at the images generated by the StarAlignment map - they now generate the cross pattern with a value of 0.5. so you now get a 0.5, rather than a 1 post convolution, and hence the binarize(1.0) does not pick out the stars.

I set the binarize threshold to 0.5, and this does now work, but I can see cases where you might get eroneous stars (if the value was > 0.5 over a space of 11 pixels). Not sure if there is a work around, other than to ask Juan to set the value to 1.0 from the cross from the StarAlignment module?

Colin
Paramount MX
Ikharos 8" Carbon Truss RC
Atik 460ex
Atik EFW2 with Baader LRGB and HA SII OIII
ONAG with Atik 314L+
http://www.astrobin.com/users/mcgillca/

Offline Philippe B.

  • PixInsight Old Hand
  • ****
  • Posts: 399
    • CIEL AUSTRAL
Re: PSFEstimation script
« Reply #59 on: 2013 March 25 07:36:03 »
Hi Mike

Your PSFEstimation was really nice under PI 1.7
I used it many time and most when you have launch SubFrameSelector.

Under PI 1.8, the PSFEstimator returns ZERO because it doesn't find stars.

If you could work on it or see if Juan can help you
Also our member BITLI could help you too !

 ;)