Wednesday, June 22, 2011


Created my first class Image in
It's far from done, but I'll post up some stuff I've written so far.

Here's the "constructor". It takes a fits file and converts it into an Image instance.
class Image:
   """Class to be used with a FITS file image"""
   def __init__(self,filename):

def header(self): prints the header of the FITS file

def phot(self,xc,yc,rad=5,ann_in=8,ann_out=10): basically a remake of the aper_phot function I made yesterday. The data argument is simply replaced with (data of the FITS file)

def show(self): displays the fits file image on a graph

def histcol(self,col,bins=50,tite="",fig=1): takes one column (all rows in that column), and creates a histogram of all the values found in the elements in that column

def histrow(self,row,bins=50,tite="",fig=1): takes one row (all columns in that row), and creates a histogram of all the values found in the elements in that row

Some examples: (assuming I created an instance called im)
The original FITS file's data looks like this:

>>> a=im.phot(xc=94,yc=71)
>>> im.histcol(71)
I also created a nice file called so that I wouldn't have to import all the files by hand every time I opened up the command prompt. 

-Stuff about displaying an array as an image
-A little bit more about how classes work (bound, unbound methods, etc)
-a pretty cool numpy.argmax(array) function I haven't quite used yet
-Wow setfig(fig,title) is still causing problems =[
-How to manipulate/control what colors arrays display
-make a findptsource(self) function that finds possible point sources depending on the array values in

No comments:

Post a Comment