Author Topic: PSFEstimation script  (Read 63391 times)

Offline derrickf

  • Newcomer
  • Posts: 24
Re: PSFEstimation script
« Reply #60 on: 2013 March 28 06:45:43 »
FWIW I have the same issue with PSFEstiation in 1.8RC5 (Win 7 64 bit).

The new aperture photometry script also fails with zero stars detected so maybe there is a common root cause.

Regards
Derrick

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: PSFEstimation script
« Reply #61 on: 2013 March 28 07:09:18 »
Hi Derrick,

Which are your configuration parameters for detecting stars?


Thanks,
Vicent.

Offline derrickf

  • Newcomer
  • Posts: 24
Re: PSFEstimation script
« Reply #62 on: 2013 March 28 07:42:46 »
Hi Vicent,
Thanks for responding, I have tried various settings witout success; here is a copy of the Process console output that includes the star detection parameters for a failed attempt:

Reading image:
D:/WIP/M81 Feb13/PI_Cal/calibrated/light/M81-003L_c.fit
Reading FITS: 32-bit floating point, 1 channel(s), 3362x2537 pixels: done

run --execute-mode=auto "C:/Program Files/PixInsight/src/scripts/PSFEstimator.0.33.js"

Processing script file: C:/Program Files/PixInsight/src/scripts/PSFEstimator.0.33.js

PSFEstimator 0.33:
Target view: M81_003L_c
Star detection layers: 5
Noise reduction layers: 2
Hot pixel filter radius: 1px
Log(detection sensitivity): -0.20
Star peak response: 0.90
Maximum star distortion: 0.50
Generate detected stars map: false
Model function: Moffat4
Circular point spread function: false
Scale mode: Pixels
Elongation mode: Aspect ratio
Generate fitted stars map: false
Mosaic size: 1
Generate visualization: false
Aggregate visualization: false
Generate tabulation: true

StarAlignment: Processing view: M81_003L_c_target
M81_003L_c_target:
521 stars found.
4.165 s

StarDetection: Processing view: M81_003L_c_target_stars
0 stars detected.
4.243 s

PixelMath: Processing view: M81_003L_c_target
Calculating view statistics...
Solved 1 invariant subexpression(s).
Executing PixelMath expression: combined RGB/K channels: abs($target - med($target)): done
0.687 s

DynamicPSF: Global context
1 view(s)
0 star(s)
0 PSF fittings
0.171 s

PSFEstimation: Processing view: M81_003L_c
Model function: Moffat4
Stars fitted: 0
0.000 s

Warning: One or more mosaic panel has fewer than 30 fitted stars.


I'm more than happy to try any suggestions you might have to help understand what might cause this problem.

Regards
Derrick


Offline Philippe B.

  • PixInsight Old Hand
  • ****
  • Posts: 399
    • CIEL AUSTRAL
Re: PSFEstimation script
« Reply #63 on: 2013 March 28 07:58:55 »
hi Derrick

I don't have any problem with this AperturePhotometry script. It seems working fine.


So, your problem could not be linked to the PSFEstimation script (not present in RC5).

Offline derrickf

  • Newcomer
  • Posts: 24
Re: PSFEstimation script
« Reply #64 on: 2013 March 28 08:14:38 »
Hi Philippe,
I resolved my issue with the Aperture photometry script by changing some parameters.

I downloaded the PSFEstimation script v0.33 from the first page of this thread and loaded it in RC5.

Derrick
« Last Edit: 2013 March 28 08:35:53 by derrickf »

Offline mcgillca

  • PixInsight Enthusiast
  • **
  • Posts: 77
    • Astrobin Website
Re: PSFEstimation script
« Reply #65 on: 2013 March 30 07:25:49 »
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

The issue is a change in  the StarAlignment module. The map now returns a value of 0.5 rather than 1.

As a work around, try editing the script and look for binarize. Set the value to 0.5 rather than 1, and it will work. There could be cases of false stars detected, but this will at least get you going.

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 mcgillca

  • PixInsight Enthusiast
  • **
  • Posts: 77
    • Astrobin Website
Re: PSFEstimation script
« Reply #66 on: 2013 April 01 09:05:08 »
Enclosed script with change to Binarize setting which makes it work with new star alignment 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 mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #67 on: 2013 April 01 21:38:37 »
Thanks Colin, the binarize may sometimes create false positives, many will be rejected out of hand by DPSF, and the script's median processing will usually eliminate the influence of the remainder.

Thanks,
Mike
« Last Edit: 2013 April 01 22:03:49 by mschuster »

Offline Philippe B.

  • PixInsight Old Hand
  • ****
  • Posts: 399
    • CIEL AUSTRAL
Re: PSFEstimation script
« Reply #68 on: 2013 April 02 00:38:09 »
Yeeeeeessssssss !!!!
Working again !!! thaaaaannnnnnnks

Maybe the SubFrameSelector will work too if we replace this script ?



Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PSFEstimation script
« Reply #69 on: 2013 April 02 17:36:26 »
Hi Mike,

As promised long time ago, attached to this post is a JavaScript version of the star detection routines used in the StarAlignment tool. With this code you no longer need StarAlignment for star detection, and your scripts will be more robust and independent.

The code is documented. The main object is StarDetector, whose constructor is:

new StarDetector( [int structureLayers[,
                  int noiseLayers[,
                  int hotPixelFilterRadius[,
                  Number sensitivity[,
                  Number peakResponse[,
                  Number maxDistortion[,
                  Boolean invert[,
                  Image mask]]]]]]] )


where the function parameters are similar to the corresponding StarAlignment parameters:

structureLayers
Number of wavelet layers for structure detection (default=5)

noiseLayers
Number of small-scale wavelet layers for noise suppression (default=1)

hotPixelFilterRadius
Half size in pixels of a morphological median filter used for hot pixel removal (default=1).

sensitivity
Sensitivity of the star detector device. Smaller values provide more sensitivity (default=0.1).

peakResponse
Peak response of the star detector device. Larger values are more tolerant with relatively flat structures (default=0.75)

maxDistortion
Maximum distortion allowed, relative to a perfect square. The distortion of a perfect circle is pi/4 (default=0.5)

invert
Detect dark structures over a bright background, instead of bright structures over a dark background (default=false)

mask
Optional mask image. If defined, star detection will be restricted to nonzero mask pixels (default=undefined)

StarDetector's main method is:

Array StarDetector.stars( Image image )

which returns an array of Star objects (also defined in StarDetector.js). Note that star coordinates are referred to a coordinate system where the center of the top-left pixel is {0.5,0.5}. This is different from StarAlignment's coordinate system, which refers coordinates to {0,0}.

If you uncomment the first line of StarDetector.js, you can execute the script on the active image to generate a copy with a red overlay where all detected stars are plotted as circles.

There's only one limitation: Unfortunately, the method Image.morphologicalTransformation() is unusable in versions 1.8.0 RCx, due to a regression bug. This means that the hot pixel removal functionality, which implements a median filter, is not available for now (see the relevant code at lines 170-179 of StarDetector.js). Of course this bug will be fixed in the final 1.8.0 release. Other than this problem, the star detector is fully operational and reasonably fast. Let me know if you find it useful.
« Last Edit: 2013 April 02 17:55:03 by Juan Conejero »
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #70 on: 2013 April 03 10:14:11 »
Thank you Juan! I am integrating now.
Mike

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PSFEstimation script
« Reply #71 on: 2013 April 06 12:57:46 »
Here's a new version of the StarDetector object:

- The structureLayers parameter has now a default value of 4 wavelet layers instead of 5. This is for coherence with the StarAlignment tool, and mainly because according to our experience, 4 layers seems the best option for most DS images.

- The StarDetector object has a new parameter: progressCallback. This is an optional function that will be invoked by the star detection task (the stars() method), so you can provide feedback to the user and make the task abortable. This is fully documented in the source code, and you have an example at the end of the StarDetector.js file, which you can see in action if you #define the __TEST__ macro.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #72 on: 2013 April 18 12:58:02 »
Hi Juan,

Sorry for the delay in replying.

StarDetector and StarAlignment differ on results and performance more than desired.

I will study your code and look for possible improvements.

Data for RC6 Win7 with and without hot pixel filter enabled.

Mike

All runs with the same parameters for both StarDetector and StarAlignment:

      var starDetector = new StarDetector(
         4, // structureLayers
         2, // noiseLayers,
         1, // hotPixelFilterRadius
         Math.pow(10.0, -1.0), // sensitivity
         0.8, // peakResponse
         0.5 // maxStarDistortion
      );
      var stars = starDetector.stars(imageWindow.mainView.image);

Subs are relatively small, 2 megapixels.

StarAlignment:
Sub #1, 1514 stars found, 1.6 seconds
Sub #2, 1632 stars found, 1.5 seconds

StarDetector script, hot pixel filter disabled:
Sub #1, 1108 stars found, 14.3 seconds
Sub #2, 1054 stars found, 13.4 seconds

StarDetector script, hot pixel filter enabled:
Sub #1, 808 stars found, 9.8 seconds
Sub #2, 865 stars found, 9.7 seconds

Note: The StarAlignment performance numbers do not include the time my old script requires to convolve and peak detect the star map (equals 3 seconds on these subs). With this overhead included, StarDetector is about 2-3x slower. This performance is loss is possibly OK, but I need to figure out why fewer stars are detected.


Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PSFEstimation script
« Reply #73 on: 2013 April 18 14:14:03 »
One more note:

Although StarDetector detects fewer stars overall, some of them were not detected by StarAlignment. So these schemes seem to be working "differently" somehow. By looking at which stars were detected by which, it is not clear to me what is going on.

Mike

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: PSFEstimation script
« Reply #74 on: 2013 May 01 21:40:10 »
does this script not yet exist for 1.8? or is my 1.8 installation broken? because i don't see PSFEstimation, or SubframeSelector in the scripts menu, and regenerating the scripts did not fix anything.

rob