### IRAF Support

> DS9 is a fully functional IRAF image display server. IRAF uses the IIS protocol to communicate with a valid image display server, such as DS9, ximtool, saoimage, and saotng. With DS9, no special scripts are needed. If you have one of the above currently working, DS9 works right out of the box. And DS9 now supports IRAF's new IIS image display protocol that supports up to 16 display frames.

> All native DS9 functions may be used with images load with IRAF display except for the `Scale` menu items. Values displayed may the the true values, if a linear scale is specified with the `display` command. Otherwise, the value is a scaled value. DS9 supports IRAF in all display visuals including `Truecolor`. Support full postscript printing of images loaded from IRAF is provided.

> Command Line Arguments

> As with ximtool, the follow command line arguments may be used to specify the communication parameters:

> > `fifo
> > fifo_only
> > inet_only
> > port
> > port_only
> > unix
> > unix_only`

> The default parameters are:

> > `fifo /dev/imt1
> > port 5137
> > unix /tmp/.IMT%d`

> Configuration

> An IRAF image server uses a configuration file to specify the number of available buffers and their sizes. What actually passes from IRAF is not the buffer size, but an index number into this file.

> So when an image server starts (DS9), it will attempt to locate this file as `$HOME/.imtoolrc` and /`usr/local/lib/imtoolrc`. If not found, it will look for shell environment variables `IMTOOLRC` and `imtoolrc`, that contains the name of the configuration file.

> If no configuration file is found, DS9 will assume the following default configuration:

> > `1 2 512 512 # imt1|imt512
> > 2 2 800 800 # imt2|imt800
> > 3 2 1024 1024 # imt3|imt1024
> > 4 1 1600 1600 # imt4|imt1600
> > 5 1 2048 2048 # imt5|imt2048
> > 6 1 4096 4096 # imt6|imt4096
> > 7 1 8192 8192 # imt7|imt8192
> > 8 1 1024 4096 # imt8|imt1x4
> > 9 2 1144 880 # imt9|imtfs full screen (1152x900 minus frame)
> > 10 2 1144 764 # imt10|imtfs35 full screen at 35mm film aspect ratio
> > 11 2 128 128 # imt11|imt128
> > 12 2 256 256 # imt12|imt256
> > 13 2 128 1056 # imt13|imttall128 tall & narrow for spectro.
> > 14 2 256 1056 # imt14|imttall256 tall & wider for spectro.
> > 15 2 1056 128 # imt15|imtwide128 wide & thin for spectro.
> > 16 2 1056 256 # imt16|imtwide256 wide & fatter for spectro.
> > 17 2 1008 648 # imt17|imtssy Solitaire fmt w/ imtool border
> > 18 2 1024 680 # imt18|imtssn Solitaire fmt w/out imtool border
> > 19 1 4096 1024 # imt19|imt4x1`

> If on the other hand, IRAF assumes a different buffer size, the image will appear corrupted and DS9 may issue a number of error messages.

> Another problem is that this file must be in sync with `dev$graphcap`. If your system administrator has made changes to `graphcap`, they must also be implemented in `imtoolrc`.

> Here is a note from NOAO:

> > `The messages means that there is no /usr/local/lib/imtoolrc file on the machine. This is created as a symlink to dev$imtoolrc by the iraf install script but only if the /usr/local/lib dir already exists on the machine. The fix is the create the dir and rerun the install script or else make the link by hand. Users can also just copy dev$imtoolrc to $HOME/.imtoolrc and restart the server to also workaround it. Note that an existing .imtoolrc might define old frame buffer configs which might confuse things, so if the system file exists check for a private copy screwing things up.`

> Windows DS9 and IRAF

> To direct image output from IRAF to DS9 running under windows, use the `IMTDEV` environment variable. For example, if the windows machine is named 'foo.bar.edu', define `IMTDEV` to the follow value before entering IRAF.

> > `$ setenv IMTDEV inet:5137:foo.bar.edu
> > $ cl
> > cl> display dev$pix`

> Scale Menu Disabled

> When you display an image from IRAF into DS9, IRAF actually does the color scale distribution. In `Display`, use the `ztrans` and `z1`,`z2` `zscale` parameter to auto determine `z1,z2. Here` are the `DISPLAY` parameters in question: parameters to set the upper/lower bounds and distribution. You can also use the

> > `ztrans=[linear|log|none|user]
> > z1=min
> > z2=max
> > zscale=[yes|no]`

> What actually is sent from IRAF to DS9 is one byte per pixel, values 0-200, which already has applied both the upper and lower clipping bounds and the distribution. So this is why, the `SCALE` menu is disabled in DS9 when it receives a image from IRAF.

> MSCRED/MSCZERO

> DS9 now supports IRAF's new IIS image display protocol. However, there is one minor problem with the mscred task msczero. Before using msczero, issue the following command in the cl:

> > `cl> set disable_wcs_maps=""
> > cl> flpr`

> IMEXAMINE

> Due to the unique relationship between DS9 and IRAF, if you use the imexamine task, you can take advantage of a special feature of DS9. Instead of loading the image from IRAF with the display task, load the image directly into DS9. Then, from the cl prompt, invoke imexamine without a filename. IRAF will ask DS9 for the current filename and use it for analysis. This approach provides several advantages over previous methods. First, it will work with compound fits images such as mosaics, data cubes, and rgb images. Second, the image displays includes true image data and WCS information, not the approximated data from IRAF.