When to use median?  

  RSS

(@schurig)
Red Giant Customer
Joined: 1 year ago
Posts: 63
October 18, 2017 12:36  

Hi,

Median is recommended here as the integration setting when having less than 15-20 frames. But: As far as I know, Median also needs a minimum number of frames which is reasonably 5 or 7. When combining less frames you should again use average. Do you agree?

With more than 15-20 frames you can use outlier rejection via Kappa-Sigma. I would like know why average is recommend together with Kappa-Sigma? Average means that an outlier pixel is replaced by the average value of neighbouring pixels, right? So, why not use Median together with Kappa-Sigma, which should replace the outlier pixel with the median value of neighbouring pixels?

Cheers, Stephan

 


ReplyQuote
(@mabula-admin)
Quasar Admin
Joined: 2 years ago
Posts: 1844
October 18, 2017 13:40  

Hi Stephan,

A median can be calculated on only 2 datapoints/pixels. APP  does this , but in that case, internally, it will automatically be an average of the 2 pixels 😉 . It's the regular way of getting a median of 2 values.

Maybe if  you integrate only 3-7 frames, you can simply check which gives a more pleasing result, but median would be better in most cases I think, because any outliers in the pixelstacks will be better removed then.

With more than 15-20 frames you can use outlier rejection via Kappa-Sigma. I would like know why average is recommend together with Kappa-Sigma? Average means that an outlier pixel is replaced by the average value of neighbouring pixels, right? So, why not use Median together with Kappa-Sigma, which should replace the outlier pixel with the median value of neighbouring pixels?

No not really, let me explain: the integration setting of median and average is totally disconnected from how the outlier rejection filters work in APP.

The average and median values of a pixel stack are calculated after outlier rejection if enabled. So you get an average or median of a "cleaned" pixelstack. Zero values are removed as well form those pixelstacks if you integrate light frames.

The sigma clip outlier rejection filter itself is based on always calculating the median of the pixel stack (so does not depend on the integration setting average/median) as it's central value, because that's way more robust than using the average value. Then relative to this (median) "central value" the standard deviation is calculated for outlier rejection. Same holds for winsorized and linear fit clipping.

In regular sigma clipping, the outliers are simply removed from the pixel stack before the next iteration. In winsorized clipping, first a winsorized (median) central value and a winsorized standard deviation are calculated iteratively. The pixels that lie outside of the winsor thresholds are replaced by the thresholds to calculate these winsorized values. Then the outliers are rejected from the pixelstack before the next iteration.

For integration of light frames, it actually is a bit more complicated than this. The average and median integration values are weighted average and median values. In the outlier rejection fitler, a weighted median is used as central value and the standard deviations are "corrected weighted standard deviations". A correction is applied for only being able to sample part of a theoretical "mother" distribution of pixel values. This will give better standard deviations.

Why use average instead of median for more than 20 frames: median integration is very limited because it can only increase the bitdepth of your original data with a factor of 2. Average integration will keep increasing the bitdepth of you integration result if you keep adding frames to the integration. 16 bit data can become 26bit data. With median integration this will never be possible. So therefore, average integration is superior over median integration if you have more frames.

Let me know if this is clear and answers your question.

Mabula

 

Main developer of Astro Pixel Processor and owner of Aries Productions


ReplyQuote
(@schurig)
Red Giant Customer
Joined: 1 year ago
Posts: 63
October 18, 2017 14:28  

Thank you very much for the detailed explanation. I think I got it! 🙂

The reason why I somehow linked the integration stacking setting with outlier rejection algorithm is because I'm also using DSS where you can choose between "Kappa Sigma Clipping" and "Median Kappa Sigma Clipping". But now it's clear to me how APP works here.

Stephan


ReplyQuote
(@mabula-admin)
Quasar Admin
Joined: 2 years ago
Posts: 1844
October 22, 2017 12:54  

Excellent 😉

Main developer of Astro Pixel Processor and owner of Aries Productions


ReplyQuote
Share: