up to IPP Workshop May 2009

DVO Language and Display Tools

This is a general introduction to the DVO shell and some of its graphics functionality. The dvo commands are taken from the transcript of Gene Magnier's dvo demo at the IPP Workshop, 18 May, 2009.

* dvo is a shell environment, like bash or csh * command line editing is emacs-like

Getting help

** three commands : 'help' '?' '??' ** 'help' gives a list of help topics. The 'help' output is incomplete/nonexistant for many commands ** '?' - brief description of commands, generated automatically from comments in the code *** (Use 'which' to get '?' like help for a single command) ** '??' - shows currently defined variables

Useful help topics

Some help items provide an overview of major functions, instead of a specific command. Try these:

dvo: help Variables
dvo: help Math
dvo: help Graphics
dvo: help Kii

Variables

  • set and access scalar variables with $ prefix
  • Enclose math expressions in { }
dvo: $a = 5
dvo: $b = "hello there"
dvo: echo $a
dvo: echo $b
dvo: echo {6*$a} {-2.5*log(10000)} ; echo $a
dvo: echo $a; $a = 10; echo $a

Shell Escapes

  • Do shell escapes with "bang" (!) or 'exec'
  • exec is necessary for macro files b/c '!' is a comment char
  • use backticks (`) to store the results of a command line execution in a dvo variable
dvo: !ls
dvo: exec ls
dvo: $word = `ls`
dvo: echo $word

Lists :

Lists are collections of scalar variables. Can contain a mix of types. Start a list definition with the 'list' command, end it with a line containing only 'end'. Use 'help list' for more info

dvo: list fooList
>> 5.6
>> tada 
>> 19
>> end

The contents of a list are accessible as scalar variables with names derived from the list name.

dvo: ??
fooList:0 = 5.6
fooList:1 = tada 
fooList:2 = 19
fooList:n = 3

You can collect the output of a command line expression directly into a list by using the '-x' option

dvo: list files -x "ls"
dvo: echo $files:n
12
dvo: for i 0 $files:n
>> echo $files:$i
>> end

You can break a string into substrings, using whitespace delimiters:

dvo: $test = adaopdaow aeiaoiepoa fsdp eaoeap
dvo: list word -split 
>> $test adaopdaow aeiaoiepoa fsdp eaoeap
dvo: for i 0 $word:n
>> echo $word:$i
>> end

for loops

  • for <iterator> <start> <end> <incr>
  • close the loop with 'end'
dvo: for i 0 10 2 
>> echo $i
>> end
0
2
4
6
8
dvo: for i 0 $fooList:n
>> echo $fooList:$i
>> end
5.6
tada
19

Macros

  • see 'help macro'
  • warning : scope is not restricted

** variables defined in macros can conflict with variables

set at higher levels if they have the same name

  • flow control functions are available (for, if, break,
dvo: macro example
> for i 0 $0
> echo $i
> end
> end
dvo: example a b c
0
1
2
3

Vectors

  • the command to make an index vector is 'create'
  • see 'help create'
  • build vectors from other vectors using 'set'
dvo: create x 0 1000
dvo: echo x[0]
dvo: echo x[200]
dvo: echo {4*x[5]}
dvo: set y = x^2
dvo: echo x[5] y[5]

Image display

  • device -n <name> : instantiate a device with name <name> ** any graphics command will accept -n <name> to send output to that window (as opposed to the current window)
  • set style options to adjust line width, color, point size, etc.
  • see 'help style' for gory details.
  • use 'label' to put labels on the +x +y -x or -y axes.
  • Text commands can have sub- or superscript with '_' and '',

where the subscript is terminated by '|'

* Read an image:

rd image simtest.fits 

* image interaction tools : ** cursor: see 'help cursor' ** star : get stats from the position where the cursor is,

Plotting in a Graphics Window

* region : define a region on the sky for plotting in. ** see 'help region'

* plot vs cplot : ** plot just plots in the x-y coord system ** cplot plots in the currently defined coord system

* csystem : convert vectors between coordinate systems

 dev -n 1
 region 
 create R 0 360 1 
 set D = zero(R)
 csystem G C R D
 cplot R D

Read vectors from a file

* for reading from an Ascii file see 'help read' * for reading from a fits table use 'read -fits'

interactive work with a cmf and fits file

* plotting vector data on top of an image * vload : load x,y vectors as an overlay onto a graphics window (can set plot styles) * vzload : load x,y vectors into an overlay with point sizes set by a z vector * available overlays: red, green, blue, yellow (can be toggled on and off with buttons in the Kapa window)