##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Lance Simms, Stanford University 2009
#! /usr/bin/env python

##This script will attempt to run DAOFIND on a file and return the values
##That I want in a reasonable fashion

import sys,os
from pyraf import iraf
import pyfits
from numarray import *
from pylab import *

#Import the good packages from IRAF
iraf.digiphot(_doprint=0)
iraf.daophot(_doprint=0)

#PYRAF uses same template and uparm parameter files as IRAF
#They can be held in memory.
#Three types of files
#	_defaultParList=default (after task is unlearned this remains)
#	_runningPartList=set used when task is run
#	_currentParList=contains updates after running a task
#	                generally agrees with uparm file
#
#If task is updated using Python syntax, the uparm copy will not be updated
#unless keyword _save=1 was specifiedi

#Two simple ways to get entire parameter list updated in uparm copy
#	1-Run epar and click on "SAVE"
#	2-in script mode saveParList() method for the task

#Four methods for getting and setting params
#	1-getParam()		2-setParam()
#	3-
#
print iraf.daofind.getParam('image',prompt=0)
iraf.daofind.setParam('image','hr5132a_001_raw.fits')
print iraf.daofind.getParam('image')
iraf.daofind.saveParList(filename='daofind.par')
iraf.daofind.getParam('verify',prompt=1)
iraf.daofind(ParList="daofind.par")
#iraf.daofind(mode="h")
