Friday, August 5, 2011

Saving Text Files and Figures

Today I finished a function that will allow me to save text files of some important data associated with the contrast curve plots I made.

When a user saves a figure, an associated text file will save the lists of data returned from phot3.contrastcurve(...). That is, it will save a list of points used in the creation of a contrast curve as well as any point sources the program may have found in the annuli of the main star. The text file will also save the center coordinates of that star.

The text file will save to the name of x-y_fitsfilename-results.txt, where x,y are the center coordinates, and fitsfilename is the name of the fits file.

Here's an example of the kind of text file it will save:

C:\[Your path here]>IPhot CK00012_snap_20110412.fits
CK00012_snap_20110412.fits
Press Q/q to quit, or any other key to load next image.

Clicking on point (22,100) and pressing W will save this picture... 
...as well as a .txt file containing this information:


Center Pts
(22, 100)
Coordiates (Radius,Contrast)
[(1.0310396072149, 1.2019494856629946), (1.2028795417507165, 1.8693450269793654), (1.3747194762865333, 2.1077248753625968), (1.5465594108223499, 2.3778325825061946), (1.718399345358167, 2.4598854750345436), (1.8902392798939833, 2.5393921380320639), (2.0620792144297999, 2.5689754466690302), (2.2339191489656169, 2.5851800258224134), (2.4057590835014335, 2.5950414542085398), (2.5775990180372501, 2.5998551889539634), (2.7494389525730667, 2.6055135477309928), (2.9212788871088833, 2.6096344474456359), (3.0931188216446999, 2.6104568644975972)]
Additional Point Sources at Each Radius (if any)
[[], [], [], [], [], [], [], [], [], [], [], [], []]


Saved to C:\Documents and Settings\Administrator\Desktop\CC22-100_CK00012_snap_2
0110412.png
Saved to C:\Documents and Settings\Administrator\Desktop\22-100_CK00012_snap_201
10412-results.txt
q
Quitting program...

C:\[Your path here]>

-----
Note that I also created a little compass on the lower right corner of each Image object. =]

To-Do:
-Somehow scale the axis ticks of the subplot images to arcseconds as opposed to pixels.
-Maybe at some point figure out how to load directories of FITS files into my command line as opposed to a list of file names (which are very tedious to type).

-----
EDIT:
I have changed the output of the text file so that it no longer returns a list of lists of point sources. It will simply return a list of point sources, or an empty list if there are none.

1 comment:

  1. This is an extremely powerful tool you've developed! It's great to see you and your project have progressed so far in such a short time. Very nice work, keep it up.

    ReplyDelete