Skip to content

Automating Your FRED Workflow

JohnGrefenstette edited this page Jan 19, 2016 · 5 revisions

When running a large number of simulations, it is challenging to keep track of the steps involved. We strongly recommended that users automate their FRED workflow as much as possible.

One approach is to create an executable script called, for example, METHODS, that captures the steps involved in a FRED analysis. This enables the users to easily re-run the analysis as needed. Reasons for re-running the analysis might include:

  • Some additional variables need to be measured.
  • A different set of plots are required.
  • The user decides to make a change in parameters.
  • The user wants to use an updated version of FRED.

The METHODS file also helps to document the steps followed, as might be required for the Methods section of a research paper.

As an example, we create a METHODS file to capture the steps used in the Parameter Sweeps example.

% cat METHODS
#!/bin/sh
echo METHODS started `date`
echo
echo params.base:
cat params.base
echo
echo config:
cat config
echo
echo fred_make_params -f config
fred_make_params -f config
echo
echo fred_make_tasks -n 10
fred_make_tasks -n 10
echo
echo running tasks
tasks
echo
echo creating plot file
fred_plot -v C -b -n -w -X 10 -t "Comparing Epidemics" -k R0=1.0 -k R0=1.5 -k R0=2.0 -k R0=2.5 -d 0
echo
echo printing plot file
lp plot-C.pdf
echo
echo METHODS finished `date`

Note the use of the "-d 0" options in fred_plot to suppress the display of the plot on the screen. With the above METHODS file, if you need to re-run the analysis, you can just type:

% METHODS > methods.out

and go get some coffee. When you come back, you can see the progress by typing:

% cat methods.out
METHODS started Wed Sep 9 21:27:52 EDT 2015

params.base:
days = 100
fips = 42065

config:
##################################################
Baseline Parameter File: params.base
Sweep Parameters:
Name: R0 Min: 1.0 Max: 2.5 Inc: 0.5 Format: %0.1f
##################################################

fred_make_params -f config

fred_make_tasks -n 10

running tasks

creating plot file
fred_plot: source_file = plot-C.plt  image_file = plot-C.pdf

printing plot file
request id is Officejet_Pro_8600-11 (1 file(s))

METHODS finished Wed Sep 9 21:28:47 EDT 2015 

The plot should be sitting on the printer.

Clone this wiki locally