› Forums › General Discussion › Doing stats with pixel values › Reply To: Doing stats with pixel values
James,
Nice to see Mercury being treated as a comet!
Indeed, as Dominic says, Python is a great way of doing this. Once you’ve understood the basics of the language you can do almost anything and there is a huge amount of existing code in libraries that make even complex tasks very simple. It is definitely worth the time spent learning it and it will open up many interesting areas of study on digital images.
With regard to your questions, it depends a bit on how flat your sky background is (or how flat you can make it). I generally estimate the sky background using an initial median to reject outliers and then a mean but this only works when (a) the sky is reasonably flat and (b) you have a lot more sky pixels than non-sky ones. That is usually the case with 2D images containing stars but may not be for a 1D slice depending on how you do things. For one thing I would make your slice quite wide and integrate up all of the pixels in the PA of the tail. This will improve the SNR significantly. This is a bit like the way that spectroscopists integrate pixels normal to the slit direction.
Regarding thresholds I compute the RMS offset of “sky” pixels relative to the calculated mean sky value and then set the detection threshold at something reasonable like 1 or 2 sigma.
My comphot software does this for comet magnitudes as described on page 23 of Comet’s Tale 40:
