Batch Processing


SwiftVis now has features that allow you to do batch processing without bringing up the GUI. There are a few steps for doing this and a few options that you should be aware of. This tutorial shows you how to use the batch processing options in SwiftVis so that you can process multiple files without bringing up the GUI. Similar functionality using the GUI is provided by the Auto Process functionality and some of this documentation refers back to that.

Batch processing requires a few different steps. First, one most build a graph in SwiftVis to do the processing on. You need to give a unique name to each of the sources or plots that you want to be involved in the batch processing. For example, if you have two or more Swift Binary Position sources, you need to change the labels in them. This is because the label names are used in the batch files to determine what sources read from and what plots you are outputing. Do not use colons in the lables as those are significant separators in the batch files. Once you have done this, save it either as a normal saved file or as a template. (If you save it as a template make sure that all the graph elements are selected when you save.) Now go to the file menu and select the "Create Batch File" option. This will bring up a dialog asking what type of batch file you want to build followed by a dialog for you to pick the name. SwiftVis batch files should have the extension ".svb". If that is given it will be added. The two modes are described below.

After you have saved the SwiftVis file and the batch file the remaining steps are to edit the batch file and run a batch from command line. The batch file is just a text file that can be edited with any standard text editor. The details of these steps are described for each of the two different versions.

Full Version

This version of batch processing is very similar to auto processing, but it doesn't require the GUI and it can output multiple plot files. If you look at the batch file that is saved when you save a full batch file you will get something similar to what is shown below.

TYPE=full
SOURCE=General Data:C:\Documents and Settings\mlewis\My Documents\workspace\SWIFTVis\in0.txt
PLOT=General Plot:plot.0:500x400

The first line simply tells SwiftVis that this batch file is using the full batch style. Don't change this line. Below that you will find lines of text that start either with SOURCE= or PLOT=. There will be one for each source that uses a data file or plot in your SwiftVis graph. By default the sources will have the name of the source as specified in the label followed by a colon and the name of the file to read from. The name of the graph element needs to match what is in the saved file. You can edit the file specification in the same way as you would for auto processing by inserting either a # or a formula involving p[0] inside of curly braces.

The plot lines are similar. They first have the name of the plot followed by a colon and the file prefix. By default the file name will be plot.? where ? is replaced by a number. Feel free to change this to whatever suits your needs. This prefix will have a number and .png appended to it. After the second colon is the size of image that should be exported in pixels with the format widthxheight. The default is 500x400, but that can be changed to fit your needs.

Once you have edited the input file specifications, image file names, and image sizes you can use this to run SwiftVis in batch mode. To run a batch file you begin as you would to run SwiftVis with a saved file. This should be followed by the name of the batch file and then, in the case of the full format, three numbers. These are the start, end, and step size numbers as used in auto processing. For example, to process files with numbers between 0 and 100 by fives on a SwiftVis file called test.svf using a batch file called testFull.svb I might enter the following.

java -Xmx1000M -jar SwiftVis.jar test.svf testFull.svb 0 100 5

The SwiftVis file needs to preceed the batch file. Running SwiftVis with the -help option will show you the usage.

Simple Version

If you only need to change a single input file and output a single image file, the simple version of batch processing can be simpler to use and more flexible. The batch file for simple processing might look like the following.

TYPE=simple
SOURCE=General Data
PLOT=General Plot:500x400

Unlike the full format, there will never be multiple source or plot lines. When you create the batch file in the GUI, if your graph has more than one source or more than one plot, you will be asked which of the ones you want to use for the batch file. In this case the file names are not given for either the input files or the plot files because those will be specified on the command line. The only thing you are likely to edit is the size of the output image.

To run the simple version you do the same thing you do for the complex version except that after the batch file name you give a list of the files that you want to process. Note that you can use wildcards to get long lists. So, for example, the following command might be used to batch process all of the files that begin with "in" and end with ".txt" in the current directory.

java -Xmx1000M -jar SwiftVis.jar test.svf testSimple.svb in*.txt

The output file will be created by stripping off the extension of the input file (assuming it has one) and replacing it with .png. So for each in*.txt you will get a matching in*.png image file.