ism3d.interface.eval_func

ism3d.interface.eval_func(vs_func_ps, var_dict)[source]

Do an inline calculation from a string expression in a lambda function-like syntax

1st: element

exprexpected to be a tuple
expr[0] string:

lamabda function-like syntax defining a anonymous function and its variable(s) the variables’ name and content should exist in the dictionary “locals”

expr[1],expr[2],expr[3]

function parameters

output:

the function’s value at each points of variables under the given parameters

example:

eval_func((‘rho : minimum(rho/p2,1.0)*p1’,200*u.km/u.s,5*u.kpc),locals())

the function call will calculate “minimum(rho/p2,1.0)*p1” assuming p1=200*u.km/u.s & p2=5*u.kpc at each “rho” value. Here, “rho” is a local-scope variable containing a numpy array