Thursday, July 7, 2011

Interactive Photometry

Nothing interesting happened yesterday. I read up a lot on how make methods that register mouse events. I also started to pseudo-code functions needed to make an interactive photometry program. Today I got a little farther.
-----
The object of this program is (as I briefly stated in my previous post) to create a simple photometry program that will plot contrast curves. More specifically, I will create a program that will allow the user to 'upload' a FITS file image. The user will then be able to click around on the FITS file. One the program registers a click, it will look around for the nearest point source and plot a contrast curve centered on that point source.

To achieve this, I have created two methods in the file InteractivePhot.py
def start(image): This method takes an Image object as an argument. It will plot the FITS image, and ask the user to specify parameters such as darkpix and ann_space. This method will be the basic startup function that the Interactive Photometry program will use.

The second method takes care of what happens when a user clicks on the FITS image.
def onclick(event): This function will (eventually) create a contrast curve centered on the closest point source. The user will be able to specify the size of the subplot image. The default size will be 40x40 pixels.

To allow these methods to use Image objects, I've created global variables to hold attributes of Image objects. (There might be better ways to do this since apparently global variables are a little iffy to work with)
-----
A lot of errors in my code relate to the way the coordinates are defined in the picture and the indices of the FITS array. Because of the way 2-D arrays work in python, the first index is actually the "y-coordinate" of the picture, and the second is the "x-coordinate". I switched some things around in my contrast curve codes to align everything with the image's coordinate system as opposed to the array system. This makes it easier for user to set arguments when they call a function.

Learned:
-How to use global variables
-More about events/handling in python
To-Do/Problems:
-Finish up my two methods in InteracticePhot.py.

1 comment:

  1. I like the idea of using user interaction to pick out point sources. This will likely be the best method for the complicated guider-snap fields. It'll take some work to sift through every image, but it'll only need to be done once.

    ReplyDelete