Esempio n. 1
0
 def __to_numeric(self, expr):
     output = expr
     for key in self.reference.keys():
         output = output.subs(key, self.reference[key])
     for key in constants.keys():
         output = output.subs(key, constants[key])
     return output
Esempio n. 2
0
def to_numeric(expr):
    if isinstance(expr, np.ndarray):
        return np.array(map(to_numeric, expr))
    output = expr
    for key in constants.keys():
        try:
            output = output.subs(key, constants[key])
        except AttributeError:
            pass
    return np.float(output)