ds9_frame_view

View an image in a ds9 frame.

% 
% ds9_frame_view 

Usage: ds9_frame_view ./blah.fits 1 V
arg1 - image name (can be fullpath FITS name)
arg2 - ds9 frame number 


Actually, this is a fairly generic example of ds9 display commands using xpa. The script is short, so I reproduce (the March 2016 version) here as an example:
% 

#!/bin/bash

# Check command line arguments
if [ -z "$1" ]
  then
    printf "\nUsage: ds9_frame_view ./blah.fits 1 \n"
    printf "arg1 - image name (can be fullpath FITS name)\n"
    printf "arg2 - ds9 frame number \n"
    exit
fi
if [ -z "$2" ]
  then
    printf "arg2 - ds9 frame number \n"
    exit
fi

imgname="$1"
framenum="$2"

# Assume ds9 is open and frames established
xpaset -p ds9 frame frameno $framenum
xpaset -p ds9 file $imgname
xpaset -p ds9 scale mode zscale
xpaset -p ds9 zoom to fit


The last four lines are the most useful to see. We use these to put the image into the desired frame. We adjust the greyscale of the image using a nice, generic scaling algorithm that works well for lots of astronomical images, and then we zoom the spatial size so that the entire image fits optimally into the frame.




Back to SCO CODES page