A script to transform CASA Guide webpages and casapy scripts to casapy
scripts suited for interactive or non-interactive use. This script can be
run from the command line. Use the '-h' option to obtain a help message
explaining the command line parameters and options.
The script runs in one of three modes:
1) interactive (default): Generates a casapy script that requests user input
when interactive GUIs are invoked.
2) non-interactive: Generates a casapy script that sleeps for 60s when an
interactive GUI is invoked. (Note: 60s may not be enough time for some
3) benchmark: Generates a casapy script that makes all tasks noninteractive or
removes their invocation all together. The output script imports and makes
extensive use of module *casa_call.py* to keep track of the start and stop
time of tasks. *casa_call.py* must be in the casapy Python path when
the casapy script is run. To work properly, the list of casapy tasks hard
coded below must be consistent with the tasks available in the version of
casa being tests. To check for consistency or update the hardcoded list,
use the function listCASATasks() below (see the function's docstring for
The intended functionality of the benchmarking mode is (1) to allow easy
assessment of whether the scripts are working and (2) to produce useful
benchmarks of performance, e.g., as a function of machine.
from optparse import OptionParser
beginBlock = "class=\"p\""
beginBlock1 = "class=\"n\""
beginBlock2 = "class=\"k\""
beginBlock3 = "class=\"s1\""
beginBlock4 = "class=\"s2\""
interactive=re.compile("[\s;]*(plotxy|plotcal|plotms|viewer|plotants|imview)")