# this is a glish script that needs to be included as # include 'aipsds9' # in a glish session, and makes the function "ds9" # available to load an AIPS++ image into the DS9 server # # History: 7-nov-2000 PJT Created # 10-jan-2001 PJT forced image.g inclusion # # Typical Usage: # include 'aipsds9.g' # # ds9('ngc1234.clean'); # # Todo: # add WCS (xpset doesn't currently support it yet) # can xpaset read from pipes? # See also: # mirds9 (a shell script that loads fits/miriad/.... images) # include 'image.g' function ds9 (file) { tmpname := sprintf("/tmp/ds9.tmp%s", shell('echo $$')); bitpix := -32; # IEEE real*4 (but some arrays may be -64 !!!) skip := 24; # determined emperically !!!! i := image(file); a := i.getchunk(); n := a::shape; i.done() write_value(a,tmpname); nx := n[1]; ny := n[2]; cmd := sprintf("cat %s | xpaset ds9 array %s[xdim=%d,ydim=%d,bitpix=%d,skip=%d]", tmpname,tmpname,nx,ny,bitpix,skip); print "Wrote ",tmpname, " shape=",n; print "Commmand: ",cmd; shell(cmd); shell(sprintf("rm -f %s",tmpname)); } # example # cat /tmp/ds9.tmp | xpaset ds9 array /tmp/ds9.tmp\[xdim=512,ydim=512,bitpix=-32,skip=24\] # but see new syntax at # http://hea-www.harvard.edu/RD/ds9/doc/ref/file.html#Data Array