Commit 942ac30f authored by bonnell's avatar bonnell

Changes for ultra wrapper: fix help, enable: dx divx xmin xmax mx; add: powr powa powrx powax

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7021 18c085ea-50e0-402c-830e-de6fd14e8384
parent 0ca259e3
......@@ -14,10 +14,14 @@ mathOpsLongName = ["sine", "cosine", "tangent", "ArcTan", "ArcSin", "ArcCos", "a
cmfeOps = ["+", "-", "*", "/"]
cmfeOpsLongName = ["sum", "difference", "product", "quotient"]
mathOpsArg = ["dy", "divy", "ymin", "ymax", "my"]
mathOpsXArg = ["%s" %el.replace('y', 'x') for el in mathOpsArg]
mathOpsArgLongName = ["Shift", "Divide", "", "", "Scale"]
mathOpsArg +=["powr", "powa"]
mathOpsXArg += ["powrx", "powax"]
mathOpsArgLongName = ["Shift", "Divide", "", "", "Scale", "", ""]
opsArg = ["lnwidth"]
togglePlotOps = ["axis", "data-id", "grid", "x-log-scale", "y-log-scale"]
......@@ -50,11 +54,11 @@ def AddMathOps():
cmdHelp[cmd] = [proc, usg]
tempDict = dict(zip(mathOpsArg, mathOpsLongName) + \
zip(mathOpsXArg, mathOpsLongName))
tempDict = dict(zip(mathOpsArg, mathOpsArgLongName) + \
zip(mathOpsXArg, mathOpsArgLongName))
for cmd in mathOpsArg + mathOpsXArg:
if cmd in mathOpsNoArg:
if cmd in mathOpsArg:
yc = "y"
else:
yc = "x"
......@@ -67,6 +71,14 @@ def AddMathOps():
proc = "Procedure: Filter out point in curves whose %s-values"%yc
proc += " %s limit." % log
elif cmd == "powr" or cmd == "powrx":
usg = "Usage: %s <curve-list> <a>" %cmd
proc = "Procedure: Raise %s values of curves to a power, %s=%s^a"\
%(yc,yc,yc)
elif cmd == "powa" or cmd == "powax":
usg = "Usage: %s <curve-list> <a>" %cmd
proc = "Procedure: Raise a to the power of the %s values of" %yc
proc += " curves, %s=a^%s" %(yc,yc)
else:
usg = "Usage: %s <curve-list> <value>" %cmd
proc = "Procedure: %s %s values of curves by a constant" \
......@@ -246,6 +258,7 @@ multiCurveCommandAlpha = oneOf("""del """ + \
mathOpsXNoArg + \
cmfeOps + \
mathOpsArg + \
mathOpsXArg + \
opsArg \
) \
).setResultsName("cmd")
......
......@@ -159,13 +159,14 @@ def ultra_doOp_percurve(curve, t):
else:
usevar = curve.expressions[numE-1]
usevar = "<%s>"%usevar
if t.cmd in mathOpsNoArg:
newvarDef = "%s(<%s>)" % (t.cmd, usevar)
newvarDef = "%s(%s)" % (t.cmd, usevar)
createAndApplyExpression(curve, newvarDef, t.cmd)
elif t.cmd in mathOpsXNoArg:
usecmd = mathOpsNoArg[mathOpsXNoArg.index(t.cmd)]
newvarDef = "curve_domain(<%s>, %s(coord(<%s>)[0]))" % \
newvarDef = "curve_domain(%s, %s(coord(%s)[0]))" % \
(usevar, usecmd, usevar)
createAndApplyExpression(curve, newvarDef, t.cmd)
......@@ -222,32 +223,44 @@ def ultra_doOp_percurve(curve, t):
elif t.cmd in mathOpsArg:
newvarDef = ""
op = ""
secondVar = t.arg
if t.cmd == 'divy':
op = "/"
elif t.cmd == 'dy':
op = "+"
elif t.cmd == 'my':
op = "*"
elif t.cmd == 'powr':
op = "^"
elif t.cmd == 'powa':
op = "^"
secondVar = usevar
usevar = t.arg
else:
return
newvarDef = "<%s> %s %s" % (usevar, op, t.arg)
newvarDef = "%s %s %s" % (usevar, op, secondVar)
createAndApplyExpression(curve, newvarDef, t.cmd)
elif t.cmd in mathOpsXArg:
newvarDef = "curve_domain(<%s>, %s(coord(<%s>)[0]))" % \
(usevar, usecmd, usevar)
newvarDef = ""
op = ""
secondVar = t.arg
if t.cmd == 'divx':
op = "/"
elif t.cmd == 'dx':
op = "+"
elif t.cmd == 'mx':
op = "*"
elif t.cmd == 'powrx':
op = "^"
elif t.cmd == 'powax':
op = "^"
secondVar = usevar
usevar = t.arg
else:
return
newvarDef = "curve_domain(<%s>, coord(<%s>)[0] %s %s" % \
(usevar, usevar, op, t.arg)
newvarDef = "curve_domain(%s, coord(%s)[0] %s %s)" % \
(usevar, usevar, op, secondVar)
createAndApplyExpression(curve, newvarDef, t.cmd)
elif t.cmd == 'lnwidth':
......@@ -354,7 +367,7 @@ def ultra_multiCurveAlpha(t):
ultra_doOp_percurve(curve, t)
elif t.cmd in cmfeOps:
ultra_docmfemath(cl, t)
elif t.cmd in mathOpsArg:
elif t.cmd in mathOpsArg or t.cmd in mathOpsXArg:
if not t.arg:
UltraUsage(cmd)
else:
......@@ -537,13 +550,14 @@ def runUltraWrapper():
SetUltraScript("")
else:
cmd = raw_input('U-> ')
print "cmd: ", cmd
if cmd.split()[0] == 'runscript':
ultrascript.parseFile(cmd.split()[1])
continue
try:
ulRes = ultracommand.parseString(cmd)
except ParseException, err:
#print 'Exception (%s) while parsing command: %s' %(err,cmd)
print 'Exception (%s) while parsing command: %s' %(err,cmd)
UltraUsage(cmd.split()[0])
continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment