Science With the Virtual Observatory
2006 Summer School

Exercise 10: Making a VO-Aware Tool

Part 1: Startup the system

The first thing we need to do is startup the IRAF system with the VO Client interface. Since this requires (for the moment) that a working 'voclientd' be running let's start that in a separate window using the command

    % voclientd
Note that here we assume you've built the voclient code from earlier in the school (so the command is in your default path), and that the 'voclient.jar' file is current. Leave this running in one window, in another window (eiter an XTerm or XGterm), issue the command:
    % cl -vo
If all went well you should see the prompt "vo-cl> "

Part 2: Download the Sample Script

A stub program we'll be using is available from http://iraf.net/nvoss/chart.cl. You can download this using your web browser, but let's just do it directly from within IRAF.

Let's create a scratch directory first:

    vo-cl> mkdir test
    vo-cl> cd test
    vo-cl> copy getData("http://iraf.net/nvoss/chart.cl") chart.cl
    vo-cl> dir
    chart.cl

Now that we've copied over the stub file, declare it as a task so we can work with it. The task has arguments and so has parameters:

    vo-cl> task chart = chart.cl
    vo-cl> lpar chart
           object =                 Object to plot
            (size = 0.2)            Size (degrees)
          (fields = "G_Lens,Xray,Radio,QSO") Objects to mark
            (grid = yes)            Overlay coordinate grid?
            (mode = "ql")           

So we know the task was declared properly and we see our task has parameters and apparently requires an object name

Part 3: Edit the Script

The script here contains a lot of boilerplate code and things we don't need to discuss here, instead we'll concentrate on simply adding the VO code needed to make the task work:

    vo-cl> nvo                      # load the NVO package
    vo-cl> edit chart.cl	    # Edit the script

Search down to about line 35 where we see the comment "Resolve the object to coordinates". The local variable containing the object we were passed is in the local variable 'obj', we want to use the SESAME task to convert this into the position we need.

    # Resolve the Abell number to coordinates.
    sesame (obj)
    lra    = sesame.ra			# set the size/position variables
    ldec   = sesame.dec
    lsz   = size

Next is the code the get an image of the field. For simplicity let's use the DSS siap service since it is all-sky. Remember that we need to find the ServiceUrl of this before we can call the service. Also, because we're using VO Client for the network access, we need to be sure to specify a host path and not an IRAF logical path:

    # Get an image of the field if the user didn't supply one.
    siap  = dalSiapSvc(regResolver("DSS2R","siap"), lra, ldec, lsz, lsz)
    
    count = dalRecordCount(siap)
    if (count <= 0)
        error ("No optical images found")
    else
        printf ("Found %d images at (%H,%h)\n", count, lra, ldec)

    s1 = dalGetData(siap, 0, osfn(imname))

Lastly, we want to overlay a catalog of things found in the field. NED provides all-sky data and some extra information we can use. However, in this case we want the entire table that gets returned, and in a format we can use easily.

    # Get NED sources
    conecaller (regResolver("NED","cone"), lra, ldec, lsz, output="ned.txt")

Part 4: Run the Task

    nvo>  chart abell2235	# QSO's in field
    nvo>  chart abell2255	# lotsa galaxies
    nvo>  chart abell1689	# has gravitational lenses

Exercise:

Modify the script to:

Epilogue:

  http://iraf.net/nvoss/chart.cl          # stub script
  http://iraf.net/nvoss/chart_soln.cl	  # edited solution
  http://iraf.net/nvoss/fchart.cl         # fully featured version

The NVO Summer School is made possible through the support of the National Science Foundation and the National Aeronautics and Space Administration.