Developer Tips and Tricks

Adding third_party tarballs

Scenario: You want to add a new third_party lib tarball, however you don't have a full checkout of 'trunk/third_party'. You can use the following to just checkout the root directory w/o any files:

svn checkout  svn+ssh:// --depth empty

Than add & commit. This is also useful for adding new data tarballs

Searching for CLI Commands

From outside of visit's cli

When franticly writing python code for VisIt, I often need to browse the list of functions available. But, output from 'dir()' from within a VisIt cli session is hard to sort through. The command below lists them in alphabetical order, one per line so it is much easier to find a method.

echo "dir()" | visit -cli -nowin -forceinteractivecli | tr ',' '\n' | tr -d " '" | sort

You can pipe it through grep if you're looking for something specific...

echo "dir()" | visit -cli -nowin -forceinteractivecli | tr ',' '\n' | tr -d " '" | grep Material


Also, if you need help on a specific CLI command but either are not currently running the cli or don't plan to keep it running...

echo "help(TurnMaterialsOff)" | visit -cli -nowin -forceinteractivecli


Place this function in ~/.visit/visitrc

def lsearch(pattern,echo=True,lst=globals()):
    rvals = None
    if not echo:
        rvals = []
    for v in lst:
        if not v.find(pattern) == -1:
            if echo:
                print v
    return rvals

And with in VisIt's cli you can simply type:


And any substring match is printed.

The function also returns a python list of all strings that matched:

for r in lsearch("Substring"):
   # do something

Getting help from within the CLI

To get help on a specific CLI function from within the CLI, just type help(<command-name>). For example...

>>> help(SetSaveWindowAttributes)
Help on built-in function SetSaveWindowAttributes in module visit:

    -Set the attributes used to save windows.
    A SaveWindowAttributes object.
    The SetSaveWindowAttributes object does not return a value.
    The SetSaveWindowAttributes function sets the format and filename that are
    used to save windows when the SaveWindow function is called. The contents
    of the active visualization window can be saved as TIFF, JPEG, RGB, PPM,
    PNG images or they can be saved as curve, Alias Wavefront Obj, or VTK
    geometry files. To set the SaveWindowAttributes, create a
    SaveWindowAttributes object using the SaveWindowAttributes function and
    assign it into a variable. Set the fields in the object and pass it to the
    SetSaveWindowAttributes function.
    % visit -cli
    AddPlot("Pseudocolor", "d")
    # Set the save window attributes
    s = SaveWindowAttributes()
    s.fileName = "test"
    s.format = s.JPEG = 1
    s.fileName = "test"
    # Save the window

Re-Baselining test results using images posted to the nightly web pages

Having an account on the actual machine where the tests are run is not necessarily required in order to re-baseline test results. You can do it by grabbing the actual png files posted to the nightly web pages and then copying them to the appropriate place in the test/baseline dir. That said, there is a bit of a trick to it too. The procedure is outlined here.

Go to the | nightly regression testing site and then navigate to the test that is failing and you want to re-baseline. Navigate all the way down to the individual test case that is failing, such as the example below.

Failed visit test example.png

Note that it will show the baseline image at the top, the image that VisIt is currently generating in the middle and the difference between them at the bottom. All you need to do is save the current image to your local system (e.g. right-click on the image and pull down to Save As…).

But wait! Be aware that VisIt's test web pages are designed with rollover actions. When the cursor enters the baseline image, a rollover action causes it to display the current image there. These rollover actions can wind up confusing which image you need to do the Save As… operation from.

To get the current image, you can either rollover the baseline image (causing it to switch to current) or you can just move over the current image, right click and then the Save As… operation will save it.

The image will be named with a leading c_ as in this example, c_exodus_01.png. Now, copy the image to overwrite the baseline image in the appropriate place in the test/baseline directory. But, when you do, be sure to remove the leading c_.

Now, if you have a lot of failed tests to re-baseline, the browser navigation you'll have to engage in to get all the images may wind up being a bit tedious. Maybe we should write a python script to do this?

Here is the sequence of steps

  1. In your browser, navigate to your failed test result from the | nightly regression testing site.
  2. Navigate all the way down to the bottom of the page hierarchy for the individual test. It should look like the image above.
  3. Move the cursor over the baseline image at the top of that page. A rollover action will cause the current image to get displayed there.
  4. Select Save As… operation from your browser to save the image to your local machine.
  5. Copy the image from wherever you saved it on your local machine to overwrite the appropriate image in the test/baseline directory.
  6. Note that the image file will have a leading c_ you will need to remove in the aforementioned copy operation.
  7. Commit the changes.