[Numpy-discussion] Finding Star Images on a Photo (Video chip) Plate?

Wayne Watson sierra_mtnview at sbcglobal.net
Sat May 29 14:29:56 EDT 2010


I managed to find some FORTRAN code that is relevant. Algorithms for CCD 
Stellar Photometry,K. Mighell, Kitt Peak, 
<http://www.adass.org/adass/proceedings/adass98/mighellkj/>. He 
discusses PSF and provides a few "starter" programs, centroid and peak 
determination. He discusses sky background (, correction, cleanup?) and 
points to his photometry package).

My chip is not big at all, about 1/2". No large chips for what I'm 
doing. I don't mind starting with simple  methods to see how far they 
get me. That's a learning experience that often provides a better 
understanding of the whole process. At this point, this is about 
exploration to see how setting up an image to analyze can be 
accomplished. Once done, then well known methods are available for my 
purpose.

Where this is going at the moment is to do source extraction. Towards 
that end I found an interesting source that does a good job of 
summarizing how one does it. Here's an excerpt.
=====================================
Star-Extraction Algorithms
The conventional star-extraction algorithms[4,5] widely used for 
ground-based data reductions are comprised of two basic steps. The first 
step is to fit the sky background in order to detect the star pixels 
from the background. The second is to search for pixels that belong to 
the same star, and group them together to compute the center coordinates 
of the star. A typical implementation of such an algorithm is described 
as below.
1)
Background Estimation
First, the sky background in each pixel is estimated in order to 
seperate the object signal from the background signal[4]. The image is 
divided into many grid cells, each including a number of pixels. In each 
grid cell, an estimate of the background level is made and is assigned 
to the center pixel as its nominal value. A relatively "coarse" mesh of 
the sky background distribution is thus constructed. The value at any 
other pixel can be obtained from 2-dimensional spline-fitting 
interpolation of the mesh.
2)
Searching for Star Pixels
After the interpolated sky background is subtracted from the image, the 
sky contribution to any star pixel becomes negligible. Only small 
residues remain in the sky pixels and the mean residue value can be 
taken as the standard deviation of the background. After convolution 
with a Gaussian filter, the image is traversed to search for pixels 
whose values are N times higher than the background standard deviation. 
Each group of connected high-value pixels are joined together to form an 
extracted star.
The conventional algorithms described above are time-consuming, although 
they have the advantage of detecting sources with very low 
signal-to-noise ratios (SNRs). They are not suitable for satellite 
onboard data reductions since the onboard computers are usually several 
hundred times slower than even a normal personal computer available on 
the ground.

SciPy. Hmm, this looks reasonable. <http://scipy.org/Getting_Started>.  
Somehow I missed it and instead landed on 
<http://www.scipy.org/wikis/topical_software/Tutorial>, which looks 
fairly imposing. Those are tar and gzip files. In any case, the whole 
page looks  quite imposing. Where did you find the simple one below?
===============================


On 5/28/2010 8:31 PM, Anne Archibald wrote:
> On 28 May 2010 23:59, Wayne Watson<sierra_mtnview at sbcglobal.net>  wrote:
>    
>> That opened a few avenues. After reading this, I went on a merry search with
>> Google. I hit upon one interesting book, Handbook of CCD astronomy (Steve B.
>> Howell), that discusses PSFs. A Amazon Look Inside suggests this is mostly
>> about h/w. I tried to figure out how to reach the scipy mail list, but, as
>> once a year ago, couldn't figure out the newsgroup GMANE connection. This
>> search recalled to mind my Handbook of Astro Image  Processing by Berry and
>> Burnell. It has a few pages on the PSF. In the ref section for that
>> material(PSFs) there's another ref to Steve Howell that may be of use: Astro
>> CCD Observing and Reduction Techniques, ASP, Pacific Conf. Series, vol. 23,
>> 1992. There are further Berry and Burnell refs that may be applicable.
>>      
> Ah, sorry, I've been at an astro conference all week, I should have
> expanded that acronym. PSF is short for "Point Spread Function"; the
> idea is that with an optically good telescope, a point source anywhere
> in the field of view produces a blob of characteristic shape (often
> roughly a two-dimensional Gaussian) in your detector. The shape and
> size of this blob is set by your optics (including diffraction) and
> the atmospheric seeing. A star, being intrinsically a point source,
> produces a brighter or less bright version of this blob centered on
> the star's true position. To accurately measure the star's position
> (and often brightness) one usually fits a model blob to the noisy blob
> coming from the star of interest.
>
> I should note that this requires you to have more pixels than you
> "need", so that even a point source is spread over many pixels;
> without this it's impossible to get subpixel positioning (among other
> things). Older consumer digital cameras often lacked this, since it
> was difficult to put enough pixels on a CCD, but fortunately megapixel
> mania has helpfully ensured that no matter how sharp the focus, every
> feature in your image is smeared over many pixels.
>
>    
>> I probed IRAF, SciPy, and Python, but it looks like a steep learning curve.
>> The SciPy tutorial page looks like overkill. They have what looks like very
>> large tutorials. Perhaps daunting. I did a quick shot at pyraf, a tutorial
>> page, but note it has a prereq of IRAF. Another daunting path.
>>      
> Wait, you think SciPy has too many tutorials? Or that they're too
> detailed? Just pick a short, easy, or sketchy one then. Here's one
> that's all three:
>
>    
>>>> import scipy.stats
>>>> scipy.stats.norm.cdf(3)
>>>>          
> 0.9986501019683699
>
> That's the value of the CDF of a standard normal at three sigma, i.e.,
> one minus the false positive probability for a one-sided three sigma
> detection.
>
>    
>> Well, maybe a DIY approach will do the trick for me.
>>      
> I haven't used IRAF yet (though I have data sets waiting), and I do
> understand the urge to write your own code rather than understanding
> someone else's, but let me point out that reliably extracting source
> parameters from astronomical images is *hard* and requires cleverness,
> attention to countless special cases, troubleshooting, and experience.
> But it's an old problem, and astronomers have taken all of the needed
> things listed above and built them into IRAF. Do consider using it.
>
> Anne
>
>    
>> On 5/28/2010 5:41 PM, Anne Archibald wrote:
>>
>> On 28 May 2010 21:09, Charles R Harris<charlesr.harris at gmail.com>  wrote:
>>
>>
>> On Fri, May 28, 2010 at 5:45 PM, Wayne Watson<sierra_mtnview at sbcglobal.net>
>> wrote:
>>
>>
>> Suppose I have a 640x480 pixel video chip and would like to find star
>> images on it, possible planets and the moon. A possibility of noise
>> exits, or bright pixels. Is there a known method for finding the
>> centroids of these astro objects?
>>
>>
>>
>> You can threshold the image and then cluster the pixels in objects. I've
>> done this on occasion using my own software, but I think there might be
>> something in scipy/ndimage that does the same. Someone here will know.
>>
>>
>> There are sort of two passes here - the first is to find all the
>> stars, and the second is to fine down their positions, ideally to less
>> than a pixel. For the former, thresholding and clumping is probably
>> the way to go.
>>
>> For the latter I think a standard approach is PSF fitting - that is,
>> you fit (say) a two-dimensional Gaussian to the pixels near your star.
>> You'll fit for at least central (subpixel) position, probably radius,
>> and maybe eccentricity and orientation. You might even fit for a more
>> sophisticated PSF (doughnuts are natural for Schmidt-Cassegrain
>> telescopes, or the diffraction pattern of your spider). Any spot whose
>> best-fit PSF is just one pixel wide is noise or a cosmic ray hit or a
>> hotpixel; any spot whose best-fit PSF is huge is a detector splodge or
>> a planet or galaxy.
>>
>> All this assumes that your CCD has more resolution than your optics;
>> if this is not the case you're more or less stuck, since a star is
>> then just a bright pixel. In this case your problem is one of
>> combining multiple offset images, dark skies, and dome flats to try to
>> distinguish detector crud and cosmic ray hits from actual stars. It
>> can be done, but it will be a colossal pain if your pointing accuracy
>> is not subpixel (which it probably won't be).
>>
>> In any case, my optical friends tell me that the Right Way to do all
>> this is to use all the code built into IRAF (or its python wrapper,
>> pyraf) that does all this difficult work for you.
>>
>> Anne
>> P.S. if your images have been fed through JPEG or some other lossy
>> compression the process will become an utter nightmare. -A
>>
>>
>>
>> Chuck
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>>
>> --
>>             Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>>
>>               (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>>                Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
>>
>>                 There are no statues or memorials dedicated to
>>                 Thomas Paine for his substantial part in the
>>                 American Revolution.
>>
>>                  -- An observation in The Science of Liberty
>>                        by Timothy Ferris
>>
>>
>>                      Web Page:<www.speckledwithstars.net/>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>>      
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>    

-- 
            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                There are no statues or memorials dedicated to
                Thomas Paine for his substantial part in the
                American Revolution.

                 -- An observation in The Science of Liberty
                       by Timothy Ferris


                     Web Page:<www.speckledwithstars.net/>




More information about the NumPy-Discussion mailing list