Friday, June 24, 2011

Hey Look I found Point Sources! ...Oh wait that's a little bit too many.

The first prototype of findptsources(...) is now done. How does it work?
Great! In fact, too great. Though findptsources(...) lists a lot of tuples as coordinates, there seems to be way too many points. I suppose at some point I didn't filter out the cosmic rays well enough and received some false results.

Anyways, here's some methods I finished today:

def potptsources(self,dataarr,darkpix=0.95): Finds potential point sources and returns a list of tuples of "coordinates"

def findpeak(self, datalist): Returns a list of points brighter than their surrounding points. I actually rewrote this function and completed it without using recursion. This function still needs to be modified, as I haven't really told it what to do if it gets an index out of bound error. 

def findptsources(self, dataarr, darkpix=0.95): Finds the point sources, taking into account background radiation and cosmic rays that might skew results. 

This function is really simple; it uses the two functions above to first find a list of potential sources, and then find the brightest pixels in that list. 

For example:

>>> from startup import*  #imports numpy, phot, etc...
>>> im=phot.Image(f)
>>> im.findptsources(
[(21, 5), (22, 114), (22, 115), (22, 116), (25, 132), (25, 133), (40, 82), (40, 83), (53, 24), (53, 25), (72, 88), (72, 89), (72, 90), (72, 91), (72, 92), (72, 93), (72, 94), (76, 90), (76, 91), (76, 92), (76, 93), (76, 94), (80, 69), (100, 17), (100, 18), (100, 19), (100, 20), (100, 21), (100, 22), (128, 50), (128, 51), (128, 52)]

Unfortunately, this seems like WAY too many coordinates for potential point sources. Clearly my code is not picky enough. One good thing to note is that the brightest pixel in the whole picture, at position (72,94), is picked up. However, it seems to also have picked up some false data. One possibility of why this happened is that I only checked the pixels adjacent to a "point source" to check if they were "bright" enough. However, a cosmic ray could have "spilled" electrons into neighboring wells, as Professor Johnson kindly pointed out. I will probably have to check pixels farther away or check for a Point Spread Function (PSF) characteristic of stars. I shall continue to work on this next week. 

-Little bit more about lists
-Fix up my code so it doesn't give me an overwhelming number of point sources.

No comments:

Post a Comment