In my workflow I always use the SubframeSelector script in PixInsight to analyse my frames and assign a weight to them in the Integration process. This is step 1.b in the basic DSLR workflow for PixInsight.
Why use the SubframeSelector script
I know many people just visually inspect their subs to see if they were good. Check for any clouds, deformed stars or other tracking errors. This might be good for the obvious errors, but the more subtle difference won’t be noticed quite frequently. Furthermore you run often into the question if you should use a certain sub that suffered from a bit worse sky transparency, or a bit of moon light or moist in the air. Should you use these frames or throw them out? Is it even visible to the naked eye in just one sub?
You might think the Integration process will take care of this; after all, it evaluates the noise of each sub right? Well, that might be true, but the problem is; what is noise and what is signal? If there is a thin cloud cover you will get more reflected light which often is interpreted as signal, not as noise!
So we always have to look at multiple factors/values when analyzing an image. Just noise evaluation is not enough. I always check the FWHM for star size and have a quick look at the star support to verify the frame is good.
This is where the SubframeSelector shines; it analyses each sub and gives you the hard numbers. Often I cannot tell the difference between two frames, but the quality in terms of the star size and noise might be significantly different and be well noticeable in the resulting stack when you add all these differences together.
Secondly, the SubframeSelector script allows you to assign a custom weight to each frame. By default the Integration process will take the noise evaluation to determine the weight of each frame in your stack. But personally I also want the most (sharp) details! So I want the Integration process to take the sharpness/star size into account as well. By using a custom expression in SubframeSelector you can do so. We’ll look into this further down in this article.
The basic usage of SubframeSelector
The SubframeSelector script basically works in two stages; first the analysis of the frames, then the exporting of the results.
First we need to analyse of course:
- Open up the script under Script->Batch Processing->SubframeSelector
- Load your calibrated subs that you want to analyse by clicking ‘Add Files…’
- Click ‘Measure’ at the bottom of the window
Now we have the subs analysed and the results are shown in a Table. To be honest, I hardly ever use this view, as the absolute values don’t tell me much. I want to see how the subs compare to each other, so I use the Plots section below the Tables.
In the Plots section you will see the values for your subs for any given metric plotted in a graph. You can interact with the graph by clicking any point (a single sub) in the graph.
A single click will lock that sub and exclude it from the export, meant to exclude it from your stack. A second click will include this sub again, but marks it so you can easily check the other values for this sub. Please see the section below on the meanings and definitions of all the different metrics.
When you are done inspecting and marking your subs for exclusion, you can output the results. Basically you have a view different ways of achieving the final collection of subs you want to stack;
you can either move the rejected frames or move or copy the approved ones. I recommend moving/copying the approved ones so you don’t throw away any data you might want to use later after all.
Choose the appropriate settings in the Output section.
Click ‘Output Subframes’ and you are done!
Assign custom weighing to your subs with SubframeSelector
As mentioned before, personally I want to achieve the best result in my image in terms of SNR AND sharpness. The ‘Expressions’ part of the SubframeSelector allows me to do just that: put in a custom formula that will calculate a ‘Weight’ factor I can add to the metadata of the subs and that the Integration script can use in the stacking process.
There are many topics and discussions on different formulas and I have sticked to using one of the following two;
SNRWeight/FWHM^2 or (2*SNRWeight)-FWHM
As you can see we take a combination of SNRWeight and the FWHM to ensure some balanced weighing that favors both signal-to-noise ratio and star size (which I interpret as a sign of sharpness).
I will have a more detailed analysis of the differences between these formula’s in a future article, but I can tell you I almost never can tell the difference between these to visually 😉
If you have specified the expression, you don’t need to re-measure the frames, the value will be updated automatically each time you change the expression. Now you will have the values of your expression available in the Table and the Plot under ‘Weight’.
To be able to use this custom weight in the Integration process, you need to add it to the metadata. This is done by specifying a keyword for it under ‘Output’; Weight keyword:
You then can tell the Integration process to check this keyword for the weight value.
If you are using the custom weight and want to add it to the metadata, you need to make sure your output ‘Approved action’ is set to ‘Copy’. Only then will it write the file with the metadata.
Automatic approval and exclusion of frames with SubframeSelector
In addition to assigning custom weights you can also automatically reject frames using a custom expression. You can specify this expression under ‘Expressions’ and then ‘Approval:’.
I’ve used the following expression in the past, which I found on the PixInsight forums.
FWHMSigma < 2 && SNRWeightSigma > -2 && WeightSigma > -2
Although this seems to work ok, I don’t like the fact that I don’t fully know why the threshold should be 2 deviations, so I’ve stopped using automatic rejection of frames.
Using an expression for automatic rejection will just mark the subs for exclusion that have certain values. You can re-include them by just clicking the frames again in the plot, or unlock them all.
Explanation of the metrics in SubframeSelector
The SubframeSelector script uses many metrics that you probably have seen before in different scripts and processes in PixInsight, but these might not always be clear as to what they mean and what would be good values for them. Also, the official documentation is not always (read: often) easy understandable.
So here is a brief overview of the different metrics and their definitions and explanations:
This is the value calculated based on the custom expression you specified under ‘Expressions’.
A higher value indicates a better quality subframe.
FWHM stands for ‘Full Width at Half Maximum’ and used in this context (within PixInsight) it is an indication of the star size. Basically it expresses the extend of difference of 2 points on a curve that lie at half maximum.
A lower value indicates a better quality subframe (smaller stars)
The eccentricity can be interpreted as a measure of the roundness of the stars. It measures the radius of a star on 2 axis (the smallest and the biggest) and expresses this difference in a formula.
A lower value indicates a rounder star. Please note that values below 0.42 are not perceptible to most people.
The SNRWeight value is an approximation of the NoiseEvalution that is used in the Integration Process. It is a relative measure and not an expression of the actual signal to noise ratio.
A higher value indicates a better quality subframe.
The median of the subframe in electrons. This basically is an expression of the amount of data each pixel holds. (signal + noise)
The mean absolute deviation from the median of the subframe in electrons.
Look for ‘outliers’ here, as they signal a significant difference in the subframe.
This it the indication/estimate of the amount of Noise in the subframe. It is an estimate of the standard deviation of Gaussian noise for the subframe in electrons.
A lower value indicates a better quality subframe.
This is the estimation of the amount of stars detected in the subframe. Check this metric to verify if there were no frames with ‘obstructions’ like clouds.
This is an estimate for the ‘consistency’ of the stars in your subframe. Residuals are currently measured as the mean absolute deviation between the fitted PSF model and the star image data in normalized units.
This might be an indication of tilt/focus/collimation problems that can be introduced during an imaging session because of weight shift for instance.
Lower values mean more consistent stars so better quality subframes.
The fractional number of pixels in the subframe deemed free of image structure and used to estimate Noise. Not sure how this should be interpreted in terms of subframe selection.
The deviation from the mean FWHM in a certain subframe.
The mean absolute deviation from the median star profile eccentricity estimate for the subframe.
The mean absolute deviation from the median residual of the star fitting process for the subframe.