[AstroPy] photometry in pyraf

Taro Sato taro@ap.smu...
Sat Jan 7 09:39:00 CST 2012


On Sat, Jan 7, 2012 at 3:23 AM, Joe Philip Ninan <indiajoe@gmail.com> wrote:
> Hi,
> I have been recently rewriting to pyraf all my photometry iraf scripts.
> For using the daofind and then phot task in noan.digiphot.daophot we
> first have to set the parameter files.
> Following is that section from my code.
> #--------------------(all the variables fwhm psfradi sigma datamin
> aperture etc. have been defined before in code)---------
>     iraf.daopar(matchra=fwhm, psfrad=psfradi, fitrad=fwhm)
>     iraf.datapar(fwhmpsf=fwhm, sigma=sigma, datamin=datamin,
> datamax=65000 , readnoi=4.8 , epadu=1.22 ,itime=intime,
> ifilter=filterr)
>     iraf.fitskypar(annulus=270, dannulu=12 )
>     iraf.photpar(apertur=aperture)
>     iraf.daofind(image=img)
>     #Going forward to do phot
>     iraf.phot(image=img)
> #----------------------------------------------------
> Now , when I run this code. It does displays the epar daopar, datapar
> etc in the GUI epar window of the pyraf with all correct values set.
> But when I press "Save & Quit" button and reaches the daofind or phot
> task. It is executing without all the seted parameters.
> It looks like inspite of me clicking on "Save & Quit" button. It is
> not getting saved. and the phot and daofind task are using some
> default setting in my uparm/
> In iraf, I had the same problem if i gave :wq in epar. But if I gave
> :w and then :q separately it used to work.
> There is no :w equivalent button in pyraf's GUI epar window.
>
> Can somebody point out some workaround for this problem? Is it
> possible in pyraf to get the non GUI epar window of iraf?
> Thanking you
> Joe
>
> --
> /---------------------------------------------------------------
> "GNU/Linux: because a PC is a terrible thing to waste" -  GNU Generation
> _______________________________________________
> AstroPy mailing list
> AstroPy@scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy


Not sure if this is the type of thing you wish to do, but since I
don't trust (or remember) the exact behavior of which set of
parameters gets actually used, my approach is to reset all parameters
to default and override those I need to change.  The following is my
template for using an IRAF task with PyRAF.  This won't prompt you to
edit parameters on GUI though, if that's what you need to do...

Hope this helps a tiny bit.



####### BEGIN ##########

#!/usr/bin/env python
from pyraf import iraf
from pyraf.irafpar import IrafParList

def default_irafpar(task):
   # Return the IrafParList object for default parameters.
   return IrafParList(task.getName(), parlist=task.getDefaultParList())

def main():
   # Load IRAF packages.
   iraf.gemini(_doprint=0)
   iraf.gmos(_doprint=0)

   # Get default parameters and override some.
   yes, no = 'yes', 'no'
   plist = default_irafpar(iraf.gprepare)
   plist.setParList(inimages = 'someimage.fits',
                    rawpath = '/astro/data/',
                    fl_addmdf = yes,
                    mdfdir = '../mdf/',
                    logfile = '',
                    verbose = yes)

   # Run the task.
   iraf.gsprepare(ParList=plist)

   return

if __name__ == '__main__':
   main()

######### END ###############




--
Taro Sato
Department of Astronomy & Physics
Saint Mary's University             email: taro@ap.smu.ca
Halifax, NS B3H 3C3                 phone: (902)420-5018
Canada                                web: http://ap.smu.ca/~taro


More information about the AstroPy mailing list