II. Interacting with the CL

TOC | previous | next

A) UNIX Commands and IRAF Tasks

Several basic UNIX commands also exist within IRAF: ls, mkdir, mv, cd, grep, and many more.

Note that rm does not work within IRAF, however there are two tasks which take it's place: imdel and del.

Most interactions you have with IRAF will be through the various tasks. Tasks are grouped into packages of similar tasks. Several packages with the basic tasks are already loaded for you. Once you are in IRAF, type ? at the CL.

cl> ?
      dataio.     language.   noao.       proto.      utilities. 
      dbms.       lists.      obsolete.   softools.  
      images.     mscred.     plot.       system.    

This is a list of the packages available to you (note some of these may already be loaded, some may not). Some packages can be contained within others, this is usually specified by a dot in between the package names (i.e. images.imutil). To get a list of tasks available type ?? at the CL

cl> ??
      dataio.     language.   noao.       proto.      utilities. 
      dbms.       lists.      obsolete.   softools.  
      images.     mscred.     plot.       system.    
      access      clear       eparam      jobs        print       set
      back        defpac      error       keep        printf      show
      beep        defpar      flprcache   kill        putlog      sleep
      bye         deftask     fprint      logout      radix       stty
      cache       defvar      fscan       lparam      redefine    task
      cd          dparam      gflush      mktemp      reset       time
      chdir       edit        hidetask    osfn        scan        unlearn
      cl.         ehistory    history     package     scanf       update
      clbye       envget      imaccess    prcache     service     wait
      artdata.      digiphot.     nobsolete.    onedspec.    
      astcat.       focas.        nproto.       rv.          
      astrometry.   imred.        observatory   surfphot.    
      astutil.      mtlocal.      obsutil.      twodspec.    
      curfit    entab     polyfit   surfit    ucase    
      detab     lcase     split     translit  urand    
      binfil            hfix              irafil            rskysub
      bscale            imcntr            joinlines         suntoiraf
      epix              imextensions      mimstatistics     text2mask
      fields            imscale           mskexpr          
      fixpix            interp            mskregions       
      display     iis.        imedit      imexamine   tvmark      wcslab
      bintxt      mtexamine   rfits       txtbin      wtextimage 
      export      rcardimage  rtextimage  wcardimage 
      import      reblock     t2d         wfits      
      calcomp     gkidir      imdkern     phistogram  sgidecode   surface
      contour     gkiextract  implot      pradprof    sgikern     velvect
      crtpict     gkimosaic   nsppkern    prow        showcap    
      gdevices    graph       pcol        prows       stdgraph   
      gkidecode   hafton      pcols       pvector     stdplot    
      chpixtype     imdelete      imheader      imslice       listpixels
      hedit         imdivide      imhistogram   imstack       minmax
      hselect       imexpr        imjoin        imstatistics  sections
      imarith       imfunction    imrename      imsum        
      imcopy        imgets        imreplace     imtile       
      geomap      gregister   imcombine   skymap      wcscopy     wregister
      geotran     imalign     linmatch    skyxymatch  wcsmap      xregister
      geoxytran   imcentroid  psfmatch    sregister   wcsxymatch  xyxymatch
      blkavg        im3dtran      imshift       magnify       shiftlines
      blkrep        imlintran     imtranspose   rotate       
      fit1d       imsurfit    lineclean  
      boxcar    fmedian   frmedian  gauss     laplace   mode      rmode
      convolve  fmode     frmode    gradient  median    rmedian  
      ccfind      ccsetwcs    ccxymatch   starfind    wcsreset   
      ccget       ccstd       imcctran    wcsctran   
      ccmap       cctran      skyctran    wcsedit    
      imcoords.   imfit.      immatch.    tv.        
      imfilter.   imgeom.     imutil.    
      adb      cp       fc       lpq      mv       rlogin   sps      vi
      bc       csh      find     lprm     nbugs    rsh      strings  w
      buglog   date     finger   ls       nm       rtar     su       wc
      cal      dbx      ftp      mail     od       ruptime  sync     wtar
      cat      df       gdb      make     pg       rusers   telnet   xc
      cls      diff     generic  man      ps       rwho     tip     
      clw      du       grep     mkpkg    pwd      sh       top     
      comm     emacs    less     mon      rcp      spell    touch   
      allocate      devstatus     lprint        page          sort
      concatenate   directory     match         pathnames     spy
      copy          diskspace     mkdir         phelp         tail
      count         files         mkscript      protect       tee
      deallocate    gripes        movefiles     references    type
      delete        head          netstatus     rename        unprotect
      devices       help          news          rewind       
      average     lintran     rimcursor   tokens      words      
      columns     rgcursor    table       unique     

As you can see this is usually a long list.

B) Working with Tasks

Now lets try working with some of the tasks. At this point I am assuming that you have a few images to play with. If you are working with images for ASTR 3510/3520 your images are probably from SBO. If so, be sure to convert them into the proper format. From now on I will use imagename to represent the name of whatever image you are working with, sometimes I will append a descriptive tag on the end of imagename, such as imagename_V to represent the V filter.

As an example of how we will use IRAF tasks, I will use the task imstat as an example. Try using the imstat task:

cl> imstat imagename
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
      030_n2392_300_V    173400    33556.     574.5      253.    63567.

Note that when typing the image filename into IRAF, we can leave off the .fits extension. Because we set imtype to fits in our login.cl, IRAF will assume any imagename is a .fits extension.

imstat returns some of the basic image statistics as you can see.

C) Changing Task Parameters at the CL

Each IRAF task has a set of parameters which control the behavior of the task. These are essentially the inputs, outputs, and options you can invoke with a task. To view the parameters as currently set for a task, use the lpar command.

cl> lpar imstat
       images = "030_n2392_300_V" List of input images
      (fields = "image,npix,mean,stddev,min,max") Fields to be printed
       (lower = INDEF)          Lower limit for pixel values
       (upper = INDEF)          Upper limit for pixel values
       (nclip = 0)              Number of clipping iterations
      (lsigma = 3.)            Lower side clipping factor in sigma
      (usigma = 3.)            Upper side clipping factor in sigma
    (binwidth = 0.1)           Bin width of histogram in sigma
      (format = yes)           Format output and print column labels ?
       (cache = no)            Cache image in memory ?
        (mode = "ql")          

There are two types of parameters, those that are required to be input when you invoke a task and those which have defaults which you do not need to specify (hidden parameters). The required parameters are those which are not enclosed by parenthesis in the lpar list. In the case of imstat, the only required parameter input is the image name (or list of image names) for which you want statistics. If you omit one of these parameters, IRAF will prompt you for input.

The second type of parameter is enclosed in parenthesis in the lpar list. These do not need to be set when you invoke the task, if you do not specify them, then the default value listed by lpar will be used.

To see what each of the parameters controls, we can look at the help page for that task:

cl> help imstat

IMSTATISTICS (Feb01)         images.imutil        IMSTATISTICS (Feb01)

    imstatistics -- compute and print image pixel statistics
    imstatistics images
        The input images or image sections for  which  pixel  statistics
        are to be computed.
    fields = "image,npix,mean,stddev,min,max"
        The statistical quantities to be computed and printed.
    lower = INDEF
        The  minimum  good data limit.  All pixels are above the default
        value of INDEF.
    upper = INDEF
        The maximum good data limit.  All pixels are above  the  default
        value of INDEF.

There is more of the help page, but I won't reproduce the rest here. The top line tells us the task name, the package in which it is found. The USAGE section specifies the cl command and order of the inputs (in this case just one). The PARAMETERS section describes all the parameters and inputs.

To specify an optional (hidden) parameter at the cl, use the parametername=value format. For example:

cl> imstat imagename binwidth=0.4
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
      030_n2392_300_V    173400    33556.     574.5      253.    63567.

Notice that I specified the required inputs first, in the order described in the help page, then I specified the optional (hidden) parameter. Some hidden parameters are boolean (they have only two values, yes or no). To specify them we can type parametername=yes or parametername=no at the cl, a convenient shortcut is to use type parametername+ or parametername- which are shorthand for yes and no respectively.

I should mention another convenient shortcut here: IRAF does not require that you type the full name of the task or parameter, as long as you type enough so that there is only one possible completion of the word. I've already been using this: the full name for the task I described as imstat is imstatistics. An example, using all of these shortcuts:

cl> imstat imagename binw=0.4 format- 
030_n2392_300_V  173400  33556.36  574.462 253.  63567.

D) Changing Task Parameters Using epar

The parameter editing method we used in the last section is useful for a single invocation of a task, but if we want to use that same parameter every time we invoke a task, we would like to change the parameter permanently. We do this using the epar task. If we invoke epar, we are able to edit each of the parameters, when we exit the editor, the changes are saved, so that even if we exit IRAF and come back later, the changes to the parameters will still be there.

Running epar imstat will bring up a page similar to what we saw with lpar imstat, however we can now interact with the parameter list. Use the arrow keys to move up and down in the list, when you get to the parameter you want to edit, start typing, when you're done hit enter, the move to the next parameter you want to edit. Once you're done editing the parameter values, you can exit two ways: CTRL-c will exit and cancel all your changes, CTRL-d will exit saving your changes.

Try this: use epar to edit imstat. Change the line which initially reads

      (fields = "image,npix,mean,stddev,min,max") Fields to be printed

to read

      (fields = "image,npix,mode,mean,stddev,min,max") Fields to be printed

this simply adds a field to the output which contains the mode of the image.

cl> imstat imagename
#               IMAGE      NPIX      MODE      MEAN    STDDEV       MIN       MAX
      030_n2392_300_V    173400    33487.    33556.     574.5      253.    63567.

Now imstat will always print the mode of the image (a useful statistic to be discussed later).

TOC | previous | next

Copyright © Josh Walawender