NRAO Home > CASA > CASA Cookbook and User Reference Manual

6.2 Image Header Manipulation (imhead)

To summarize and change keywords and values in the “header” of your image, use the imhead task. Its inputs are:

#  imhead :: Lists, gets and puts image header parameters  
imagename      =         ’’   #   Name of input image file  
mode           =  ’summary’   #   Options: get, put, summary, list, stats  
async          =      False

The mode parameter controls the operation of imhead.

Setting mode=’summary’ will print out a summary of the image properties and the header to the logger.

Setting mode=’list’ prints out a list of the header keywords and values to the terminal.

The mode=’get’ allows the user to retrieve the current value for a specified keyword hdkey:

mode           =      ’get’   #  imhead options: list, summary, get, put  
   hdkey       =         ’’   #  The FITS keyword

Note that to catch this value, you need to assign it to a Python variable. See § 1.4.3 for more on return values.

The mode=’put’ allows the user to replace the current value for a given keyword hditem with that specified in hdvalue. There are two sub-parameters that are opened by this option:

mode           =      ’put’   #  imhead options: list, summary, get, put  
   hdkey       =         ’’   #  The FITS keyword  
   hdvalue     =         ’’   #  Value of hdkey  
   hdtype      =         ’’   #  Data type of the header keyword.  
   hdcomment   =         ’’   #  Comment associated with the header keyword  

WARNING: Be careful when using mode=’put’. This task does no checking on whether the values you specify (e.g. for the axes types) are valid, and you can render your image invalid. Make sure you know what you are doing when using this option!

  6.2.1 Examples for imhead


More information about CASA may be found at the CASA web page

Copyright © 2010 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search