Friday, July 22, 2011

Refined: findptsources(...)

I finished the refined version of findptsources(...). Unfortunately, there are a lot of cases to take care of, and I'm not sure I accounted for all of them. I tested my code with the two FITS file images I had, and the code worked well for both of those images. Hopefully the code works well for all FITS files, though I'm currently not 100% sure. I'm trying to get some more FITS files to work with at the moment.

Anyways, here's some examples:


>>> from startup import*
>>> im=phot2.Image(arr)
>>> im.findptsources()
[(115, 22), (116, 22), (83, 40), (25, 53), (90, 72), (91, 72), (92, 72), (93, 72), (94, 72), (92, 76), (93, 76), (94, 76), (18, 100), (19, 100), (20, 100), (21, 100), (22, 100), (51, 128), (52, 128)]


[(115, 22), (83, 40), (25, 53), (92, 72), (93, 76), (20, 100), (52, 128)]

As you can see, the second list of point sources is much shorter!
In case I haven't explained what my edited code does clearly, here's another attempt.

As you can see, the lists contain a bunch of tuples that represent coordinates of pixels in the FITS image. In the first list, many of these tuples have the same 'y-coordinate' (second number in each tuple), meaning that the pixels are aligned in a horizontal line (excuse my handwriting):
It's easy to see now that the second list of tuples takes the 'midpoint' of a line of pixels. By midpoint I mean that for any line of odd pixel length, it takes the mid point, but for any line of even pixel length, it picks one of the two middle most points. For a single point, the program still includes it, even though it might just be a cosmic ray. You can check that this is true with the second FITS image as well:

>>> im2=phot2.Image(arr2)
>>> im2.findptsources()
[(42, 64), (43, 64), (91, 72), (92, 72), (93, 72), (94, 73), (95, 73), (94, 76), (95, 76), (91, 77), (92, 77), (93, 77), (37, 79), (52, 95), (98, 100)]


[(42, 64), (92, 72), (95, 73), (95, 76), (92, 77), (37, 79), (52, 95), (98, 100)]


Obviously a lot of these points could be cosmic rays or point sources we are not concerned with (as in they don't affect the total flux of the main point source we are looking at). But my program includes these points as well because I don't want to make it rule out anything potentially interesting. 


On Monday I'll start working on the point source detector code, and perhaps the point source simulator as well.

Learned:
- How to write complicated if statements.
- How to follow complicated if statements.
To-Do:
- Write the point source detector code
- Create the point source simulator to test my code

No comments:

Post a Comment