PixInsight Forum (historical)
PixInsight => Release Information => Topic started by: Juan Conejero on 2011 July 17 10:03:52
-
Hi all,
Today we have released a new tool: DynamicPSF. This long-awaited tool fills an important gap in the set of image analysis tools of PixInsight that we have been suffering during years.
While we write documentation[1], let me make a brief description and an overall introduction to the features and practical usage of this essential tool.
As its name suggests, DynamicPSF is a dynamic PixInsight tool for PSF (Point Spread Function) modelling. In a nutshell: you click on an image and DynamicPSF looks for a star (or a star-like object) around the coordinates you have clicked at. If something like a star can be found close to those coordinates, DynamicPSF tries to fit a three-dimensional function from a set of sampled image pixels. It then provides a number of useful parameters that describe the PSF in terms of the function fitted.
The practical usage of DynamicPSF is quite similar to that of DynamicAlignment. In fact, I have reused a number of routines and algorithms from DA to write DynamicPSF, although I have reformulated and improved all of them significantly (among other things, this means that you can expect a new version of DA after Summer, including an interactive mosaic building feature and improved accuracy).
This initial version of DynamicPSF can fit elliptical Gaussian and Moffat[2] functions. An elliptical Gaussian PSF fitting function is defined as:
(http://pixinsight.org/images/forum/20110717/Gaussian-PSF.png)
where the parameters are:
B - Average local background.
A - Amplitude, which is the maximum value of the fitted PSF, and also the function's value at the centroid coordinates.
x0,y0 - Centroid coordinates. This is the position of the center of symmetry of the fitted PSF.
sigmax, sigmay - Standard deviation of the Gaussian distribution on the horizontal and vertical axes, measured in pixels.
An elliptical Moffat function is given by:
(http://pixinsight.org/images/forum/20110717/Moffat-PSF.png)
where the parameters are as above and the beta exponent controls the overall shape of the fitting function. When beta = 1, the above equation corresponds to a Lorentzian distribution (http://en.wikipedia.org/wiki/Lorentzian_function).
In all cases the functions are fitted to ensure that sigmax >= sigmay.
DynamicPSF also supports rotated functions. When the difference between sigmax and sigmay is larger than or equal to 0.01 pixel (which is the nominal fitting resolution), DynamicPSF fits an additional theta parameter, which is the rotation angle of the X axis with respect to the centroid coordinates, in the range [0,180[ degrees. For a rotated PSF fit, the x and y coordinates in the equations above must be replaced by their rotated counterparts x' and y', respectively:
(http://pixinsight.org/images/forum/20110717/rotated-coordinates.png)
Rotation angles are measured in counter-clockwise direction.
For those users more technically inclined, DynamicPSF implements the Levenberg-Marquadt (http://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm) algorithm as a model trust region (http://en.wikipedia.org/wiki/Trust_region) minimization procedure (the algorithm minimizes the mean absolute deviation of the fitted function from the sampled data). The underlying implementation is a custom adaptation of the CMINPACK library (http://devernay.free.fr/hacks/cminpack/cminpack.html) to the PixInsight/PCL framework.
For all fitted PSFs DynamicAlignment computes a set of additional parameters:
FWHMx - The full width at half maximum on the X axis. FWHM is a well-known, simple and easy to understand measurement of the size of a star as seen on the image.
FWHMy - The full width at half maximum on the Y axis. For circular functions, we have FWHMy = FWHMx.
MAD - The mean absolute deviation of the function fitted with respect to the actual sampled pixel values. This parameter is a robust estimate of the goodness of fit, or in other words, it tells you how well a star can be represented by the fitted function. Higher MAD values denote comparatively poorer fitting quality.
DynamicPSF can also search for the function that best represents the sampled image data in terms of minimizing MAD. Finally, instead of fitting elliptical PSFs you can tell DynamicPSF to fit circular functions, where sigmax = sigmay and theta = 0. For raw images with high noise levels and/or strongly undersampled images circular functions can usually be more robust and hence preferable (robustness is an extremely desirable property in the PSF modelling problem). The uncertainty introduced by additional parameters (two axes and a rotation angle) can lead to meaningless results for these images.
Now the obvious question is: what is DynamicPSF useful for? This question has many and interesting answers. Modelling the PSF of an image or a set of images allows us to make quantitative assertions on important acquisition and instrumental conditions, such as seeing, tracking quality, focus quality, optics performance and focal plane geometry, among others.
There are much more details and practical usage considerations than this introduction, which we'll try to cover in the documentation. I just hope these notes will help you start using this new tool, which is the result of an intense development work we've been undertaking for several months. Please feel free to ask anything related to this tool in this thread and we'll try to do our best to solve your doubts. As is customary in all PixInsight implementations, DynamicPSF is the high-precision and highly versatile image analysis tool that our users need and deserve.
Enjoy!
__________________
[1] You can rest assured that we'll write documentation for this tool. These release notes will be reused to write the documentation, so this text is not a waste. So it is really not necessary that you insist in this regard :)
[2] Moffat, A. F. J., A Theoretical Investigation of Focal Stellar Images in the Photographic Emulsion and Application to Photographic Photometry, Astronomy and Astrophysics, Vol. 3, p. 455 (1969)
-
Completely over the top in typical PI style but very impressive! ;)
-
Hi,
I've done the update but can't find this tool.
Dave
-
It's under 'Image'.
-
Hi Dave,
Sorry, I forgot to mention this. You'll find DynamicPSF under the Image category on the Process Explorer window.
-
Hi Juan
Thats great and thanks for the explanation , I really understood all of that :o ??? ::)
But I will suss it out with the tried and trusted harry method , consisting of fumbling around in the dark till I find the light switch ;D
Harry
-
It would be really terrific if the updater could remember by user name and password for the distro site. A minor inconvenience for the wonderful auto update but really a licensed copy of PI should know how to update itself without requiring uid/passwd.
Harry: watch for bed posts while fumbling in the dark.
-
Juan,
How do you use this tool? When I drag the New Instance icon over an image, it states the following "DynamicPSF can only be executed in the global context". Unfortunately, there is no Apply Global icon available and F6 doesn't seem to work.
Wade
-
The error message is a bit misleading and I'm not sure why there is an instance icon in this case but Juan did describe the basic usage quite well above:
"In a nutshell: you click on an image and DynamicPSF looks for a star (or a star-like object) around the coordinates you have clicked at."
-
Sander,
Thanks! I missed that part. I saw all the mathematical formulas and my eyes glazed over. :)
I'll make sure I read everything next time.
Wade
-
No problem. I did the same thing the first time. Then I figured Juan probably wrote how to use it besides slamming us with nifty formulas so I took a closer look at the post :)
-
Sander and Juan,
Thank you, I've found it. It's greyed out though how do I make it active?
Thanks in anticipation.
Dave
Right. I've updated PI, I've checked the installed updates which indicates that it's been done successfully, there's a mention of Dynamic PSF. But in actual fact the tool is not in the image menu. What I thought was it, is in fact, Mode>Dynamic operation.
I'm using the Mac 32 and 64 bit version.
Dave
Forget this now. There's been another update which resolves my problem.
Thanks
Dave
-
Juan, you are the best of the best :-*
-
Hi Dave,
there are indeed two updates. Are you now able to use the new process? If not, could you clarify where it's grey'd out? I didn't know a process could be disabled in the process explorer.
-
Great addition, thanks a lot!
Couple of special "wishes" related to DynamicPSF
1) is it possible to add PSF info to the data shown in "preview window" of the Readout Mode? So that when cursor will be placed over the star on the image PSD statistics will be shown?
This will be real "dynamic" way of examining image...
2) easy way to auto select stars and generate some "average" FWHM for the whole frame will be great.
-
Hi Dave,
there are indeed two updates. Are you now able to use the new process? If not, could you clarify where it's grey'd out? I didn't know a process could be disabled in the process explorer.
Hi Sander,
After the second update it appears to be working, thank you. All I have to do now is understand it :)
Dave
-
Hi
Nobody had a go with the range selection tool , very simple but I think will be very handy 8)
Harry
-
I have no idea what RangeSelection does. There is no help and searching the forums shows no hits. Could you summarize please?
-
Hi
It only came yesterday with the update 8)
Basically you select the brightness to create a mask , Ie great for selecting stars there is a real time preview to see what you are doing ;D
Of course it can be for more than stars if you set the sliders correctly , and use fuzziness to fade the selection
If you look under updates / view installed updates there is a bit of info
harry
-
Oh, that's handy. I forgot to check under the update log, thanks for the reminder.
-
This Dynamic PSF tool has been a bit of a long time coming, but as with many things in PI when it arrived it is spectacular!
-
Thanks guys for your nice words.
The two arrow buttons are to regenerate (recalculate) PSFs. The single arrow button will regenerate the currently selected stars (you can select stars either on the list or by clicking them on the image). The double arrow button regenerates all stars. PSFs are recalculated for the current "PSF Model Functions".
Some tips:
- PSFs can only be (meaningfully) measured on linear images.
- Use the STF tool with automatic screen stretch to work with DynamicPSF.
- Normally, our goal is to determine the "average PSF" of an image. This task involves some "art" and requires some experience to be done properly. Not all stars are valid for this task:
* Saturated stars are useless. Avoid stars for which the amplitude parameter (A) is close to or larger than one. Ideally, A should not be larger than 0.3 or 0.5.
* Too dim stars cannot be fitted properly. This happens mainly because for too dim stars the wings of the fitting function (Gaussian or Moffat) are undistinguishable from the local background.
- If the rotation angle (theta) and/or the aspect ratio (r) don't stabilize for a set of 5 - 10 good star fittings, then you should fit circular functions. This happens with undersampled images and also under high noise levels.
- Click the Sort button (down arrow) to sort the set of fitted stars by mean absolute deviation (MAD). If the stars at the bottom have comparatively poor fitting quality (for example, you get 1.0e-04 at the top of the list and 1.0e-02 at the bottom), remove the worst fittings and, if necessary, choose different stars for which the fitting quality improves.
- Watch out for round and little objects of stellar appearance that may not be stars. This happens very frequently on deep images with small background galaxies. Normally these objects can be detected because they tend to be fitted with much larger functions (watch the sx and sy parameters) as they usually have much larger dispersion than true stars.
- Once you have a sufficiently large set of reasonable PSF fittings (say from 10 to 50, depending on the image), click the Export button (little blue sphere) to generate an average PSF as a new image window. The generated PSF is normalized, that is, it uses the whole [0,1] range and is suitable to be used with the Deconvolution tool (in External PSF mode).
- If you want to compare FWHM estimates between images, you probably need to use the same fitting function in all cases: either Gaussian or a fixed beta Moffat. Bear in mind that each function will provide a different FWHM even for the same star. Or you can compare average PSFs obtained as above; you can fit a PSF for an average PSF :)
Hope this helps.
-
An additional word of caution. If you want to compare FWHM or other fitted parameters for images generated with different applications, please compute all the PSF models with one of the applications. When it comes to compare image quality, don't use PSF models computed by different applications, as such comparisons are mostly meaningless due to radically different function fitting algorithms and implementations. For the sake of accuracy and robustness, I strongly recommend you use the new DynamicPSF tool in PixInsight.
-
Thanks for the tips, Juan. They are really very helpful.
With regards to using the information with the Decon tool, would you choose the exported synthetic PSF image in the View Identifier window on the External PSF tab of the Decon tool?
Also, would you please expand on your explanation of MAD? I'm not a mathematician and way too many years removed from my meager math education so could you briefly explain the MAD number and what number constitutes a good fit versus a poor fit.
Steve
-
Hi
I tested this new function, mainly for PSF extraction
1 example :
First, linear image, manually select 63 stars
(http://ccd1024.free.fr/images/PI1.jpg)
average FWHM is X=1.92 pix en x Y=1.80 pix
Generate PSF
Deconvolution with the PSF option
(http://ccd1024.free.fr/images/dec1.jpg)
Be sure there is no interfacts problems on result image (deringing,...)
Then reapply the DynamicPSF process (recalculate values)
Select 63 lines
Average button (but 1 star is not conform and must be deleted because it choose "gaussian" instead of moffat)
(http://ccd1024.free.fr/images/PI2.jpg)
average FWHM is x=1.04 pix and y=0.96 pix ! almost factor of 2 :D
Result : ANIMATED GIF to see deconvolution process with no change on noise or adding strange effect :
(http://ccd1024.free.fr/images/deconv1.gif)
ZOOM by 2
(http://ccd1024.free.fr/images/big.gif)
Thanks again for this waited function !!! it is usefull ;)
-
Nice work!
-
Hi Philippe,
Very nice example :)
Just a few tips to help you improve your results:
- Instead of generating a PSF image from the Average Star Data dialog, use the Export Synthetic PSF feature (the blue ball to the left of the Sigma button). These routines use very different approaches to generate an average PSF:
* The Average Star Data dialog computes the average PSF parameters, then uses them to generate the corresponding PSF model image.
* The Export Synthetic PSF feature generates all the PSF model images for the selected star(s) and then averages them. This is more like an empirical PSF because it doesn't assume an underlying PSF model function. In theory this approach is more accurate and more adaptable to the particularities of the image.
- On the first screenshot we can see that all the selected stars (at least those that can be seen on the DynamicPSF window) have fitted rotation angles around 170 degrees (the theta parameter) except one that has 4.12 degrees. This star is clearly an outlier and should be either removed or fitted using a different function that provides a more consistent result. Also, chances are that this object is not a star, but perhaps a background galaxy. To detect outliers more easily, use the Sort feature with different sorting criteria.
-
Hi Steve,
With regards to using the information with the Decon tool, would you choose the exported synthetic PSF image in the View Identifier window on the External PSF tab of the Decon tool?
That's correct. Select the synthetic PSF from the drop down list below 'view identifier'.
Also, would you please expand on your explanation of MAD?
MAD stands for Mean Absolute Deviation. It is a very simple and robust statistic that, in the case of DynamicPSF, we use to measure the difference between a mathematical model (the PSF model for a star) and the actual data (the pixels sampled from the star image). For each sampled pixel:
- The model function is used to compute a pixel value. Call it f.
- The difference between the computed value f and the actual pixel value v on the image is calculated: f β v
- The absolute value of the difference is calculated: |f β v|
Now if we add all the absolute differences and take the mean of the N sampled pixels, we have the MAD:
MAD = Sum( |f β v| )/N
Computed this way, MAD is a very good estimate of the suitability of the model function to reproduce the observed data.
However, bear in mind that MAD values are always relative estimates. The computed PSF model functions can never reproduce the actual image data exactly for two main reasons: (1) the uncertainty due to the noise, and (2) the fact that the observed data does not follow the model function. In other words, observed stars are neither Gaussians nor Moffats; we use these functions just because they usually are good to approximate stars on CCD images. So we never get zero MAD values for real images, and MAD values always depend on the characteristics of each image.
could you briefly explain the MAD number and what number constitutes a good fit versus a poor fit.
Use MAD numbers as the relative estimates that they are; never take them as absolute quality estimates. For example, if you have MAD=10-4 for some stars and MAD=10-2 for other stars, then you know that the first set is being fitted better than the second set by two orders of magnitude. Two orders of magnitude is a BIG difference (100 times), so you'd better remove the second set of star measurements, or maybe regenerate them using different parameters and see if the fitting quality improves.
Why have we included the MAD parameter in DynamicPSF? Because we don't like image analysis tools that don't tell you how good or bad are the analyses being made. Such tools are useless toys because they don't let you know what you are doing; using them is like shooting in the dark. In PixInsight you always know what you are shooting at βor that's the intent ;)
-
It would be really terrific if the updater could remember by user name and password for the distro site. A minor inconvenience for the wonderful auto update but really a licensed copy of PI should know how to update itself without requiring uid/passwd.
Harry: watch for bed posts while fumbling in the dark.
Good idea!
-
The error message is a bit misleading and I'm not sure why there is an instance icon in this case ...
For instance, it allows you to create a process icon. If you have data in the DPSF dialog when you create the process icon, of course, the images will need to be open when you re-invoke the process icon in order for the DPSF tool to calculate the values. Otherwise you could have/save a process icon with your favorite "default" parameters...
-
By the way, congratulations for a long-awaited tool. So far the implementation looks impeccable to me, and I can see it as a great foundation for other more high-level tools developed on top of it.
I do have some questions but I'll hold until the documentation is available, as most of the questions will probably be answered there.
Again, congratulations, and THANKS!
-
Excellent work Pix team, 8)
Ran the dynamic_psf with deconV on a couple of images last night, really impressive results.
Range selection tool works well too. Made a mask for the above Decon very quick.
Darren
-
Congratulations and thank you very much for this great tool Juan :D
It was really needed and indeed looks very, very promising.
Regards
Jordi
-
Juan,
Thanks for taking the time to explain MAD. I do believe I understand. Just don't spring a quiz on me. :D
Steve
-
But I will suss it out with the tried and trusted harry method , consisting of fumbling around in the dark till I find the light switch ;D
Happy to know that I'm not alone ??? I got the bit about a new tool - after that :o
-
But I will suss it out with the tried and trusted harry method , consisting of fumbling around in the dark till I find the light switch ;D
Happy to know that I'm not alone ??? I got the bit about a new tool - after that :o
Don't get dizzy with the equations. I would expect that the documentation being written will also explain things in a more empirical way, so in the end it's all about understanding the suitability for the different functions being offered, the "art" Juan described when selecting candidate stars, and of course, the values returned by DPSF. Most of the data DSPF returns is not that hard to understand, and for those values that might be, take your time to read Juan's descriptions.
Many of us "aesthetic astroimagers" don't rely on many of these measurements for what we do, but eventually, it's a good call to start looking at the data we're capturing in a different way, and eventually use that knowledge to our advantage for "what we do". The way I see it, and after using it for a bit, DPSF is probably the most enticing tool you can find to do just that.
-
Dear Juan:
I am a little late to the DynamicPSF party, but hope I can get in a few questions about the algorithm, in addition to exclaiming a huge "Thank You!" for another extraordinary PixInsight tool ;D!
DynamicPSF returned two clusters of fit angles in my first trial, what looks to be a situation somewhat similar to the data in Philippe B.'s very helpful example. The clustering in my case is somewhat tighter, within about 5 degrees of zero+, and within about 5 degrees of 180-. You suggested to Philippe that he discard the stars with small angles, but could this be indicative of the degeneracy associated with an ellipse whose major axis is close to zero degrees? This seems likely to happen for example when the ellipticity is produced by random guiding errors of different amplitude in RA and Dec, assuming that the camera is similarly oriented (which happened to me with the frames I'm working on now, shot on two very windy nights). Does this seem like a reasonable expectation? Is there a way to force theta=0 in the fit?
Two followup questions: when I regenerated the fit after Deconvolution, the angles for individual stars seemed fairly randomly distributed from zero to 180 (this may also be the case in Philippe's example). Is this a sign that the PSF provided the Deconvolution with the necessary kernel to reduce the ellipticity in the initial data? On the other hand, I was surprised that the aspect ratios were not significantly improved. Perhaps I have not used one of the tools correctly, or am incorrectly interpreting the results?
Finally, regarding the regeneration of the parameters of the fit: for a fixed image, the parameters tend to wander around a bit with repeated regeneration. I gather this reflects the inevitable "soft landing" in the iterative Levenberg-Marquardt method (though very slight with this data)? Do you have any recommendations for appropriate use of regeneration in this context?
Many thanks,
Howard.
-
Hi Howard,
Thank you.
DynamicPSF returned two clusters of fit angles in my first trial, what looks to be a situation somewhat similar to the data in Philippe B.'s very helpful example. The clustering in my case is somewhat tighter, within about 5 degrees of zero+, and within about 5 degrees of 180-. You suggested to Philippe that he discard the stars with small angles, but could this be indicative of the degeneracy associated with an ellipse whose major axis is close to zero degrees? This seems likely to happen for example when the ellipticity is produced by random guiding errors of different amplitude in RA and Dec, assuming that the camera is similarly oriented (which happened to me with the frames I'm working on now, shot on two very windy nights). Does this seem like a reasonable expectation? Is there a way to force theta=0 in the fit?
It seems pretty reasonable to me. You can force circular functions by checking the Circular PSF check box on the PSF Model Functions section.
If I've understood it well, your case doesn't seem similar to Philippe's example. In his example he was getting a quite coherent set of measurements except a few ones that were clearly outliers (nonstellar objects, probably). In your case it seems that you're getting two sets as a result of uncertainty in the fitted rotation angles. Are you getting aspect ratio values very close to one? When the stars are nearly circular, fitting elliptical PSF functions becomes an unstable process and the fitted rotation angles tend to be meaningless. This situation can get much worse for low SNR data (noisy raw frames for example). You know that this is happening when the fitted rotation angles are disperse and don't follow any spatial distribution pattern. In these cases circular functions are more meaningful and tend to be more accurate.
when I regenerated the fit after Deconvolution, the angles for individual stars seemed fairly randomly distributed from zero to 180 (this may also be the case in Philippe's example). Is this a sign that the PSF provided the Deconvolution with the necessary kernel to reduce the ellipticity in the initial data?
I think so. If the angles become randomly distributed this means that the angles are not meaningful at all, and hence that the stars are closer to circular, following the discussion in the preceding paragraphs.
On the other hand, I was surprised that the aspect ratios were not significantly improved.
Well, it seems that your stars were already quite circular. The aspect ratio is a relatively uncertain parameter. Rotation angle is more sensitive.
Finally, regarding the regeneration of the parameters of the fit: for a fixed image, the parameters tend to wander around a bit with repeated regeneration. I gather this reflects the inevitable "soft landing" in the iterative Levenberg-Marquardt method (though very slight with this data)? Do you have any recommendations for appropriate use of regeneration in this context?
This happens because the initial set of parameters for a fitted PSF function is slightly dependent on the initial point chosen to detect the star, or search location. For each star, the search location defined when you manually click on the image is not the same, in general, as the location automatically selected by the regeneration routine. For slightly different initial values, the L-M algorithm may choose one among several valid solutions, due to uncertainty in the data (different paths on the solutions space). With high SNR data this is usually unnoticeable, but noisy data are more prone to make these variations noticeable. The variations should always be very small, though. What are the magnitudes of the differences that you are observing? Do the fitted parameters stabilize after the first regeneration?
(9:24 - Edited to clarify the last paragraph)
-
Hi Juan:
Thank you very much for your very detailed and informative reply.
The stars in my initial image have an average aspect ratio of about 0.88 (I typically get roughly 7% deviation from roundness, but gusty winds played havoc with auto-guiding this time), and the ellipticity in the stars is quite apparent to a visual inspection. The ellipses look very closely aligned with one axis of the frame, corresponding to the Dec axis which had a much larger amplitude of random guiding errors than in RA on those gusty nights. In this case, using the elliptical fitting functions with the constraint theta=0 might be more efficient, though now that I think about it again, imposing that constraint isn't really necessary in actual practice, since one can average over so many stars that one will anyway end up extremely close to the expected orientation. In fact, DynamicPSF returned an average theta=178 degrees using about 20 stars!
I wondered if the fitted aspect ratio might show a noticeable improvement in the deconvolved image using the exported PSF, but the average actually decreased slightly, to 0.83. But as you suggest, this doesn't appear to be as significant a number for the final image, since the stars actually look appreciably more circular than in the original :D.
About the variations in fit parameters with regeneration, this is surely the sensitivity to initial conditions that you pointed out. The variations are very small, as expected for a good extremum. (Out of curiosity, when regenerating, does the algorithm start from the last estimate of the parameters?)
Many thanks again,
Howard.
-
Dear Juan:
I hope I can trouble you with one more go at the problem of improving the aspect ratio in Deconvolution using DynamicPSF.
I was wrong that my stars showed an improvement. Their "football" aspect is actually quite severe (due to those very gusty winds), and shows no improvement in either visual appearance or in the fitted parameters after Decon using the exported PSF. In case I've goofed in the use of these tools, or if only a miracle could save this poor data, I hope you might take a look at the two attached screenshots of a small portion of the image, viewed at 200%, before and after the Decon.
The screenshots include a portion of the DynamicPSF dialog, along with the average parameter values. The screenshot after Decon also includes the exported PSF, and a part of the Deconvolution dialog. Please forgive these very busy screenshots, as I tried to pack in as much useful information as possible ;).
The football shape is readily apparent at this magnification, and one can see that there is essentially no change in the aspect ratio, or the orientation of the ellipses, although the FWHMs do happily decrease by about a factor of 2.
The ellipse angle is consistent with a small rotation of the camera axes relative to the telescope axes, as can be seen from the diffraction spikes of the bright star near the lower left, which makes sense since the gusty winds caused a greater amplitude of random guiding errors in Dec than in RA.
Any advice would be greatly appreciated :-[!
Howard.
-
Hi
I tested this new function, mainly for PSF extraction
I finally got around to trying the recipe that Phillipe posted. Unfortunately I don't get anywhere near those results. Extracting the PSF is easy enough, thanks for showing how to do that. I used the method that Juan advised we use. Perhaps my starmask is problematic again but I also noticed that the preview size has a -huge- impact on the effect of deconvolution. Same process applied to a larger preview gives a completely different result to a small sub section of that preview. This is surprising to me as deconvolution (little as I understand it) works on the local scale and does not involve extracting wavelet layers which change with the size of the image. Looks like experimenting with previews isn't really possible with deconv.
In any case, I either get a completely snowed out image or one that has larger stars with snowy edges. Neither effect is very desirable.
Still, extracting the PSF is neat. I wish I could use it for something.
-
Some personal observations on the Dynamic PSF tool:
- a gradient in the frame is not helpful for the dynamic-psf-process. Better loose it in advance by applying bckgrnd-extraction or (better:) flatframes;
- When I deconvolute images with the artificially generated PSF I see relatively fast results with simple starfields. However low-signal frames with non-star-objects in the field require more work; I experience snowy results now and then;
- on my macbook I have to draw a little box around each star and then click the star before dynamic-PSF picks it up; a simple mouseclick on a star is not enough.
- that said, I like this tool a lot because it gives me a <<scientific>> basis to justify my poor image-quality.
gracias muchos.
HP
-
Hi Hans,
gradients and flattening aren't necessarily related. Even a well flattened image can still have gradients from LP for example. DBE subtraction can not solve flattening issues. I have not tried to use DBE in multiplicative mode, perhaps it works.
I have to say I think both multiplicative (flattening related) and additive (DBE/gradient related) should not affect star statistics. Multiplication will make a star brighter but won't change the shape. Subtraction presumably removes the same values from all pixels in the star unless the gradient is very very very steep in that spot.
I look forward to hearing from Juan about this.
I'm glad to hear you also got the snow effect. Doconv works fine on planetary images for me but for DSO not so much.
-
Hi Howard,
The key to evaluate these PSFs is the beta parameter. Note that before deconvolution you had beta values around 6, which is typical for well sampled images. After deconvolution, beta has decreased to 1.6 - 1.8. The beta parameter controls the overall shape of the Moffat fitting function; lower beta values lead to narrower function profiles (leptokurtic distributions).
The following figure shows the difference between two Moffat functions for beta values of 6 and 1.5, respectively.
(http://pixinsight.org/images/forum/20110822/moffat-functions.png)
To generate these plots, use the following script:
#include <pjsr/UndoFlag.jsh>
#define MOFFAT_BETA 1.5
var M = Matrix.moffatFilterBySize( 64, MOFFAT_BETA );
var w = new ImageWindow( M.cols, // width px
M.rows, // height px
1, // numberOfChannels
32, // bitsPerSample
true, // floatSample
false, // color
"Moffat" + format( "_%.1f", MOFFAT_BETA ).replace( '.', '_' ) // identifier
);
var v = w.mainView;
v.beginProcess( UndoFlag_NoSwapFile );
v.image.apply( M.toImage() );
v.endProcess();
w.show();
w.zoomToFit();
Change the value of MOFFAT_BETA to render different function shapes. The script generates a new image window where you can apply the 3DPlot script to generate the 3D renditions. Note that you can also define a small preview covering a star in your image and use 3DPlot with it.
So you have achieved narrower star profiles with deconvolution. This result --as long as you don't get objectionable ringing artifacts-- denotes a nice deblurring effect.
Now let's think of the r PSF parameter. The r parameter measures the aspect ratio (sy/sx), or the ellipticity of a star. It's true that aspect ratios have not decreased significantly after deconvolution, as you probably expected. However, take into account that the aspect ratio is a relative measurement. So although their ellipticity has not varied significantly, in absolute terms (in pixels) your stars are much closer to their ideal shapes. After heavily stretching the image in a nonlinear way, star halos may still show slightly elliptic shapes, but this can be fixed with star masks and morphological operations.
-
Hans, Sander,
Relatively slight gradients don't degrade DynamicPSF performance, in general. For each star, DPSF computes a mean local background (the B parameter), which is a constant signal level added as a pedestal. The A parameter (peak value) takes this pedestal into account, as do the rest of fitted parameters.
However, a very steep gradient can lead to less accurately fitted PSFs. All fitting functions assume a flat, horizontal base plane and a strong/steep gradient violates this condition. A steep gradient acts like an inclined plane, on top of which the PSF fitting routines have to find average B values and approximate function parameters as a compromise. Note that the same problem arises when fitting a star over a steep 'natural' gradient, such as a nebula. For this reason the best PSF fitting candidates are isolated stars over free sky background areas.
I have not tried to use DBE in multiplicative mode, perhaps it works.
As long as the gradients are multiplicative, It does work very well. An incoming video shows precisely an example of this type of correction. The problems begin when gradients have mixed additive and multiplicative origins, as usual.
- When I deconvolute images with the artificially generated PSF I see relatively fast results with simple starfields. However low-signal frames with non-star-objects in the field require more work; I experience snowy results now and then;
This is normal. Deconvolution only works for high SNR data. Low SNR regions should always be protected with suitable masks. When deconvolving low SNR data, the uncertainty to differentiate between noise and signal can invalidate all premises of the deconvolution process. When this happens you get noise structures enhanced, which is probably what you identify as 'snow'.
- on my macbook I have to draw a little box around each star and then click the star before dynamic-PSF picks it up; a simple mouseclick on a star is not enough.
This is very strange and should not happen. Can you upload one of the images where you're getting this behavior?
- that said, I like this tool a lot because it gives me a <<scientific>> basis to....
I'm glad to read this. With PixInsight I try to provide a scientific approach to image processing. Only through a scientific approach to the data can one grow personally and technically as an astrophotographer. If more people understood this, astrophotography wouldn't be so plagued of the pseudo-magical approaches and retouching tricks that are restraining its development.
-
Juan wrote:
//In a nutshell: you click on an image and DynamicPSF looks for a star (or a star-like object) around the coordinates you have clicked at.//
On a macbook this translates to a double-click on the trackpad and that is what came back to me 2 seconds ago.
Juan, please disregard this issue.
HP
-
I just moved this from elsewhere to this New Tool: DynamicPSF thread since I see the subject of rotation angles 180 deg apart is being discussed. I don't I agree with the conclusion above that this just concerns a a few outliers at least for my data that may not be the highest SNR. IMO, the problem is the fundamental degeneracy in the elliptical representation that is causing my population of stars to split roughly equally between near zero and near 180 degrees rotation angle. Perhaps it would help for DynamicPSF to also report (with any noncircular option) the 'relative rotation angle' for each fit WITH RESPECT TO THE MAJOR AXIS OF THE ELLIPSE which would then be a more consistent and meaningful measure with which to discard outliers, even in the context of the 180 degree ambiguity in the rotation angle of the major axis itself. But I think some scheme might also be devised to resolve the 180 degree ambiguity (due presumably, as Juan suggests, to the randomness in the initial star detection location) in the major axis. That would probably be more complicated; perhaps, some kind of clustering algorithm to identify a single major axis (same sign rotation angle) out of all the reported axes from the individual fits.
The following probably belongs on the wish list topic, but what I'd really like beyond fixing this degenerate sign-of-the-rotation angle problem is another layer that would analyze subs (better, multiple subs) to generate maps of FWHM (curvature), aspect ratio, etc. to provide detailed analysis of image quality -- plus maybe a sorter that ranks subs in terms of those qualities. That would be a very useful addition, IMHO.
Clear skies,
-Jeff
-
Hi Jeff,
IMO, the problem is the fundamental degeneracy in the elliptical representation that is causing my population of stars to split roughly equally between near zero and near 180 degrees rotation angle.
As noted in your bug report (http://pixinsight.com/forum/index.php?topic=3352.msg23195#new), the solution to this problem is to represent PSF rotation angles in the ]-90,+90] range, instead of [0,180[. This will be available as an optional feature (enabled by default) in the next version of DynamicPSF (due this week, along with other updates).
another layer that would analyze subs (better, multiple subs) to generate maps of FWHM (curvature), aspect ratio, etc. to provide detailed analysis of image quality -- plus maybe a sorter that ranks subs in terms of those qualities. That would be a very useful addition, IMHO.
I agree completely, and in fact I had all of these tasks in mind when I wrote DPSF. This is a nice work to be implemented as a script (or a collection of scripts). It is quite easy because since PI version 1.7.0 processes provide output data that can be retrieved from JavaScript code. I'll explain this on the software development board.
-
Hi, Juan-
Just great.
And thanks.
-Jeff
-
Hi, Juan-
A question on interpretation of star FWHM (again for image characterization rather than PSF generation): On my subs, the FWHM's from the Moffat form tend to be an arcsecond or so larger than those using the Gaussian form, Since the Moffat gives a better fit (lower average MAD), am I right to assume that it is also providing a more accurate measurement of FWHM? I'm presuming the FWHM calculation is, in both cases, finding the width of the region where the fitted function falls to half-height, but wonder if the longer tails on the Moffat function (beta~2) are just "pinching in" the fits above half-height but that shouldn't really be considered the FWHM because of the longer tail. I anticipate your response to just use the same form as a relative measure from sub to sub, but wonder if there is an absolute interpretation as to which is more accurate.
Thanks.
-Jeff
-
I've just started trying to use this tool and am getting nowhere fast. I have a single 20 minute image of M31 open and it has been calibrated and a histogram stretch applied. With the DynamicPSF tool open I can't get any stars selected. I'm clicking on stars but nothing shows in the tool. What am I doing wrong?
-
Hi Steve,
how about if you look at the image in 1:1 mode and click right on a star? The first click will identify the view DPSF will work with. If that doesn't work then I recommend cropping a small section of your image and attaching it here in 32b format.
-
Well that beats all. I remoted to my office computer and used the same image and that worked. I ended that session and tried it again on the laptop and again it worked. I have no idea what was different. It was done each time at full resolution. Oh well, it's not the first time I've stumbled!
Thanks again.