Thursday, July 28, 2011

Editing More Code...

This week has just been a major code-editing week.

Today I made a major change to the way I find point sources.

def findptsources(self,datalist,darkpix=0.95,adj=4,thresh=5): Finds a list of point sources (points brighter than their surrounding points where the number of adjacent pixels (adj) is brighter than thresh*sigma).

The new findptsources(...) function can be adjusted in sensitivity:

thresh gives the user the ability to specify how many deviations from the mean background noise the flux of a point has to be to note it as a potential point source. Thus, instead of only having 5*sigma, we can also ask the program to search for all potential point sources in which a point source is defined by any point greater than 3*sigma.

The new findptsources function can be adjusted in sensitivity by setting values for adj (0-4). It indicates how many of the neighboring points have to also be greater than thresh*sigma in order for the central point to be flagged as a point source.

You may note that the new findptsources(...) requires an array input, which seems kind of silly at first glance. However, this function is also being used to find the point sources in each annulus around a main point source, which means that it needs to be able to take the annulus array as an input, even though the main FITS file array might be different.

The new point source finder kind of already acts like a point source detector because it can look for point sources within annuli, which means that I don't need my old point source detector code I was working on earlier this week.

I tested this new point source finder, and these are the results:
>>>im=phot3.Image(arr)

>>> im.findptsources(im.data)
[(116, 22), (83, 40), (25, 53), (94, 72), (94, 76), (22, 100), (52, 128)]
>>>


As you can see, this is exactly the same array as before. I haven't had time to extensively test this yet, but I believe I'm at least on the right track. 

Learned:
-Neat way to use booleans as integers (0 and 1's) to meet threshold requirements.
To-Do:
-Debug more (I think you're seeing the trend by now...)

No comments:

Post a Comment