jeffctaylor / astro2013

A centralized place for my code this spring and summer
2 stars 0 forks source link

pyraf / iraf tasks can now become obsolete #13

Closed sophiathl closed 11 years ago

sophiathl commented 11 years ago
#13.07.23 - Notes
# Pure Python registration using montage & montage-wrapper
# montage-wrapper is an astropy affiliated package, but: 
# montage from IPAC needs be installed separately from here: 
# http://montage.ipac.caltech.edu/
# montage-wrapper needs be installed separately from here: 
# http://www.astropy.org/montage-wrapper/
#
# all the following pyraf tasks (used in the registration & resampling steps) 
# can now become obsolete:
#
# iraf.unlearn()
# artdata.mkpattern()
# iraf.ccsetwcs()
# iraf.wregister()

import astropy
import montage_wrapper as montage

# making a header template - general use
# montage.commands.mHdr(object_or_location, width, out_file, system=None, equinox=None, height=None, pix_size=None, rotation=None)
# the "width" (and "height") is in degrees, and it is the angular size (given by 
# the user, and if in arcsecs then converted) in degrees
# the "pix_size" is the native pixelscale of each image in the registration step,
# while in the resampling step, the "pix_scale" is the same for all images, as before 
# example application of the above general use (with example values)
#
montage.commands.mHdr('67.7044117 64.8479444', 0.071666666666724, 'hdr_registration', system='eq', equinox=2000.0, height=0.071666666666724, pix_size=2., rotation=0.)
#
# note: 
# we can either use the target name, or specify ra-dec - in the former case, the 
# user let us know of the target name, 
# while in the latter case the user let us know of the ra-dec (best in degrees) - in 
# the former case we do as follows:
# montage.commands.mHdr('ngc1569', 0.071666666666724, 'hdr_registration', system='eq', equinox=2000.0, height=0.071666666666724, pix_size=2., rotation=0.)

# registering the images - general use
# montage.wrappers.reproject(in_images, out_images, header=None, bitpix=None, north_aligned=False, system=None, equinox=None, factor=None, common=False, exact_size=False, hdu=None, cleanup=True, silent_cleanup=False)[source]
# the in_images / out_images can be tuples - then, all of them are registered to the 
# header specified in the "hdr_registration"
# the rest of the arguments are either not needed or can be left at the default value
#
montage.wrappers.reproject('I1Jy.fits','I1Jy_pyreg.fits', header='hdr_registration')
#
# note 1:
# the above is equivalent to using the following:
# montage.commands.mProject('I1Jy.fits','I1Jy_pyreg.fits', header='hdr_registration')
# 
# note 2: 
# in the case of an image cube, then the following can be used instead:
# montage.wrappers.reproject_cube('input_cube.fits','output_cube.fits', header='hdr_registration')
# to bear in mind: the images are registered all with the same "pix_scale" -- ideal 
# to use in the resampling step
#
# note 3: selected header keywords are retained - all rest should be added by "hand"
jeffctaylor commented 11 years ago

That looks awesome. I'll start integrating it into the code now, unless there are any other issues that need to be taken care of first.

jeffctaylor commented 11 years ago

This has now been done.