Reuse and Templates


We have seen how to do many things in the SWIFTVis system, and some might complain that while SWIFTVis has a significant amount of power, that it simply takes too long or involves too many clicks and too much typing to do anything significant. One of the inevitable problems with configurability and flexibility and that you have to take more time and effort to set things up. SWIFTVis has defaults that attempt to anticipate what people will use them for, but these aren't always appropriate. The alternative, however, is typically to write your own code, which also takes significant effort to set up the first time. To make SWIFTVis usable for daily data analysis, it has been set up to allow you to reuse work from one day to the next. Much of the time, you perform the same analysis on many different data sets. To make this easier, SWIFTVis allows you to save off entire graphs with all the data so that you can load them back in at a future time. This is accomplished with the Save and Open options on the File menu.

A full save of a SWIFTVis graph is done to a file with the extension .svf. These files are saved using the Serialization abilities of Java and produce binary files that are not human readable. The exact format of these files changes as new data elements are added to or removed from different parts of the SWIFTVis system. While this behavior only makes sense, it also means that when you upgrade from one version of SWIFTVis to a newer version, your saved files might become invalid. For this reason, we recommend that you keep your earlier JAR file around to use with old saved files until you are certain you don't need them. The saved file contain everything that is in the memory of the machine that is needed for SWIFTVis to recover where it left off. So one way or reusing your work is to save the full graph once you have things set up properly and later load it back in, then select different files for the Data Sources that feel the rest of the graph. As you read in the new files, the changes will propogate through the full graph and you shouldn't have to change many other settings if you have to change any at all.

You can also save parts of a graph as a template and load that template back in at a later time (in a .svt file). The template files are smaller as they don't include that data that is in the elements. When you click "Save as Template" from the save menu, it will save only the elements of the graph that are currently selected. This can be helpful for saving off sections that are their own analysis tools that you can put in later with different combinations. To see how this might work, we could go back to the tutorial on using Movies to see system evolution which had a fairly large number of elements in the graph. The subsection that included the Movie Filter, a Binned Filter, two Selection Filters, and a Plot would make a good template so that you don't have to recreate it again in the future. You could draw a box around all of those elements to select them all and do "Save as Template" from the File menu. Later you could quickly reproduce that same functionality during another SWIFTVis session by inserting that template using Insert > Template or Ctrl-T. If you have a collaborator who is using the same version of SWIFTVis you could also send them the template file to allow them to quickly add the same analysis into their SWIFTVis session.

The real power of templates comes in when we put together more complex analysis tools and plots that we don't want to have to reconstruct every time we are doing that particular analysis. This type of analysis tool is explored in the next tutorial on clickable tools. These are filters that take input from user clicks or key strokes in a plot. They can be very helpful for making analysis tools that can allow you to quickly view your data in the ways you find most helpful.

It turns out that normal save files and templates actually use the same format. The difference is in what exactly is saved and how it is handled when you load back in. As mentioned above, saving something as a template removes all of the data from the elements so the save size is much smaller and the data is regenerated when it is connected to sources later. When the File > Open option is selected, the current graph is completely replaced with what is read in. When you do Insert > Template, the elements that are read are added to your current graph.