Do you find yourself doing the same sequence of commands repeatedly in ds9
?
You can script your interactions with ds9 and invoke them using the Analysis menu.
This demo uses data for SDSSJ1030+0524, combined from multiple observations
find_chandra_obsid SDSSJ1030+0524 download=all
reproject_obs "*/primary/*evt2.fits.gz" outroot=SDSSJ1030+0524
cd Analysis
ds9 SDSSJ1030+0524_merged_evt.fits -scale log -bin factor 2 &
[1] 22726
import -window "SAOImage ds9" ds9_11_analysis_01.png
display < ds9_11_analysis_01.png
The Reference Manual contains a chapter on the Analysis command. Below is a very simple example:
cat kjg.ans
# # Custom Commands # Maximize Image * bind m simple.sh
Each command is a block of 4 lines in the analysis command file. The hash lines are comments.
The Maximize Image
is the name of the command I created.
The *
is a filter for which file-types, in this case all file types.
bind m
says that this command will be executed whenever I press the lowercase m
key.
The last line says run the simple.sh
executable script.
Now what does simple.sh
look like?
/bin/ls -l simple.sh | sed -e s,$USER,user, -e s,$GROUP,group,
-rwxrwxr-x 1 user group 170 Jan 2 08:08 simple.sh
cat simple.sh
#!/bin/bash xpaset -p ds9 view colorbar no xpaset -p ds9 view info no xpaset -p ds9 view panner no xpaset -p ds9 view magnifier no xpaset -p ds9 view buttons no exit 0
So we see that the script has execute permissions. It is a bash
shell script, that simply
run a set of xpa
commands to hide various parts of the UI: colorbar
, info
, panner
, magnifier
, and buttons
.
xpaset -p ds9 analysis load kjg.ans
# Press 'm'
sleep 5
import -window "SAOImage ds9" ds9_11_analysis_02.png
display < ds9_11_analysis_02.png
xpaset -p ds9 quit
[1]+ Done ds9 SDSSJ1030+0524_merged_evt.fits -scale log -bin factor 2