Friday, July 15, 2011

Beta Testing of IPhot?

I sent my program to Tim, who will test it over the weekend. I hope there won't be any serious bugs...

Anyways, IPhot now *ideally* comes with mac os compatability, the ability to upload multiple FITS files, and quick contrast curve plotting with a single click (or two)!


C:\>cd [your path here]

C:\[your path here]>IPhot CK00012_snap_20110412.fits CK00350_snap_20110524.fits -d 0.95 -w 70 -h 40 -s 0
Press Q/q to quit, or any other key to load next image.

The two lines starting with CK... indicate the FITS files that are loaded. At this point, this image pops up:

Clicking near point (93, 72) gives:

To go to the next image and close the current figure, I just press any key:

...loading next image
This image loads:
Clicking near the center gives me this:

Press Q/q to quit, or any other key to load next image.

I pressed n again, but as it doesn't have another Image to load, it automatically quits the program:


C:\[your path here]>


So there you have it! There are probably a few kinks I haven't worked out yet with the program, but hopefully nothing major. 

I haven't yet added a save function either as I couldn't easily figure out how to best add a save button without making the process of plotting contrast curves and loading images too slow. I'm trying to aim for a streamlined process of saving images, but at the same time, I don't want the user to feel rushed or confused while using my program.  

Thursday, July 14, 2011

Command Line Program - v 1.0!

I finally finished coding (previously called, but I got sick of typing it into command line every time). So here's the long-awaited example:

Opening up my Windows command line... (not Python's command line)
C:\>cd [my path here]

C:\[my path here]>IPhot CK00012_snap_20110412.fits -d 0.95 --width=74 -h 60 -s 3
Press enter to exit.

The FITS image will pop up:

Upon clicking, I'll get this:

Notice that I actually have the name of the image on the second figure now =]

Also, users can specify as many or as few of the options as they want in any order they want. So:

C:\[my path here]>IPhot CK00012_snap_20110412.fits -h 60 -s 3 -w 74
Press enter to exit.

will give the exact same thing as the image above. (Note that -d or darkpix has a default value of 0.95)

To reiterate:
-d, --darkpix darkest x percentage of pixels
-w, --width = width of sub image (xsz variable in my python code)
-h, --height = height of sub image (ysz variable)
-s, --ann_space = annulus spacing, or the space between the aperture and innermost annulus radius (ann_space variable)

I also created a file called that is just a list of global variables with default values. A user can then edit the values in that file to quickly set the default values of darkpix, ann_space, etc without having to dig through the actual code.

-More about RE
-A bit about setting paths
-Make an option to save the contrast curves
-Allow the program to sequentially load multiple FITS files; another will open once the user presses enter (or some other button)
-Start thinking about making the program mc os compatible.

Wednesday, July 13, 2011

Command Line Program II

More command line coding!

Today I learned about this function called getopt(), which will hopefully allow me to enter arguments (optional arguments) that will specify things such as the spacing between an annulus and aperture, the size of a cropped image, etc.

I've received another challenge: To make my program accept an arbitrary number of fits files in the command line window. Basically, we're hoping the input will look something like this:

C:\[your directory to saved InteractivePhot file]> InteractivePhot file1.fits file2.fits -d 0.95 -w 40 -h 40 -s 0

-d = darkpix percentage
-w = width of sub image (xsz variable in my python code)
-h = height of sub image (ysz variable)
-s = annulus spacing, or the space between the aperture and innermost annulus radius (ann_space variable)

If these are not specified, the program will run them with default values and create graphs of all the fits files entered preceding these arguments.

I haven't quite completely finished coding yet, so I won't be putting an example here today; however, I hope to get it done by tomorrow and have something more interesting to blog about. =]

I also learned about this neat thing called regular expressions. Not the Perl kind, but the Python kind. Basically regular expressions is a pretty powerful tool used to search for strings. You can set all sorts of restrictions to make sure that you are searching for the string that you want. I'm hoping to use regular expressions to create a list of all the .fits files the user has entered in command line so that I can make those graphs one by one.

-Regular expressions
-How to use getopt(...)
-Finish program

Tuesday, July 12, 2011

Command Line Program

I've been working on making the contrast curve program into a program that can be executed directly from the command line.

Yesterday I attempted to at first to make a rectangle selector that allowed users to make a subplot and contrast curve by creating a rectangle on the FITS image. Unfortunately... the code was difficult for me to understand and since I couldn't find the source code, it ended up being easier to just abandon the whole idea.

But today I'm definitely making much more progress! This morning I read up on some different command line functions and how to write Python files that required input from a command line. The current problem I have is that it's hard for me to load the actual FITS file onto command line, so I can't show you any examples just yet (since I can't actually make my code work on a file).

Tim has been kind enough to teach me a bit about exception handling and the such. I'm assuming I'm doing something simple wrong and will continue to figure out why my fits file directories are "never found".

The fits file load now so that the programs will execute without error. However, I barely even have a chance to see anything load up before the program terminates again. Huh. I need to figure out how to make the program "pause".

-Loading Python scripts in command line
-Using functions in Python that allows users to input info from command line
-Exception Handling
-Finish up the program.
-Figure out how to "pause" it.
-Test my contrast curve program against other contrast curves!