def cylindrical_in(x, y, z, V): rho, phi, z = to_cylindrical((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, z=z, V=V)) v1 = safe_eval_compiled(compiled1, variables) v2 = safe_eval_compiled(compiled2, variables) v3 = safe_eval_compiled(compiled3, variables) return out_coordinates(v1, v2, v3)
def carthesian_in(x, y, z, V): variables.update(dict(x=x, y=y, z=z, V=V)) v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np) v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np) v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np) if not isinstance(v1, np.ndarray): v1 = np.full_like(x, v1) if not isinstance(v2, np.ndarray): v2 = np.full_like(x, v2) if not isinstance(v3, np.ndarray): v3 = np.full_like(x, v3) return out_coordinates(v1, v2, v3)
def spherical_in(x, y, z, V): rho, phi, theta = to_spherical_np((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, theta=theta, V=V)) v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np) v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np) v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np) if not isinstance(v1, np.ndarray): v1 = np.full_like(x, v1) if not isinstance(v2, np.ndarray): v2 = np.full_like(x, v2) if not isinstance(v3, np.ndarray): v3 = np.full_like(x, v3) return out_coordinates(v1, v2, v3)
def function(u, v): variables.update(dict(u=u, v=v)) v1 = safe_eval_compiled(compiled1, variables, allowed_names = safe_names_np) v2 = safe_eval_compiled(compiled2, variables, allowed_names = safe_names_np) v3 = safe_eval_compiled(compiled3, variables, allowed_names = safe_names_np) if not isinstance(v1, np.ndarray): v1 = np.full_like(u, v1) if not isinstance(v2, np.ndarray): v2 = np.full_like(u, v2) if not isinstance(v3, np.ndarray): v3 = np.full_like(u, v3) return np.array(out_coordinates(v1, v2, v3)).T
def spherical(x, y, z, V): rho, phi, theta = to_spherical((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, theta=theta, V=V)) r = safe_eval_compiled(compiled, variables) if not isinstance(r, np.ndarray): r = np.full_like(x, r) return r
def cylindrical(x, y, z, V): rho, phi, z = to_cylindrical_np((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, z=z, V=V)) r = safe_eval_compiled(compiled, variables, allowed_names = safe_names_np) if not isinstance(r, np.ndarray): r = np.full_like(x, r) return r
def eval_compiled_spreadsheet(compiled_src_dict, row_names, order, variables, allowed_names=None): result = compiled_src_dict.copy() named_accessors = { name: SvSpreadsheetRowAccessor(result, name) for name in row_names } variables = variables.copy() variables.update(named_accessors) col_names = list(list(compiled_src_dict.values())[0].keys()) for row_name, col_name in order: compiled = compiled_src_dict[row_name][col_name] if compiled: item_variables = variables.copy() column_accessors = { name: compiled_src_dict[row_name][name] for name in col_names } item_variables.update(column_accessors) value = safe_eval_compiled(compiled, item_variables, allowed_names) result[row_name][col_name] = value return result
def carthesian(x, y, z, V): variables.update(dict(x=x, y=y, z=z, V=V)) r = safe_eval_compiled(compiled, variables, allowed_names=safe_names_np) if not isinstance(r, np.ndarray): r = np.full_like(x, r) return r
def function(t): variables.update(dict(t=t)) v1 = safe_eval_compiled(compiled1, variables) v2 = safe_eval_compiled(compiled2, variables) v3 = safe_eval_compiled(compiled3, variables) return np.array(out_coordinates(v1, v2, v3))
def carthesian_in(x, y, z, V): variables.update(dict(x=x, y=y, z=z, V=V)) v1 = safe_eval_compiled(compiled1, variables) v2 = safe_eval_compiled(compiled2, variables) v3 = safe_eval_compiled(compiled3, variables) return out_coordinates(v1, v2, v3)
def spherical(x, y, z, V): rho, phi, theta = to_spherical((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, theta=theta, V=V)) return safe_eval_compiled(compiled, variables)
def cylindrical(x, y, z, V): rho, phi, z = to_cylindrical((x, y, z), mode='radians') variables.update(dict(rho=rho, phi=phi, z=z, V=V)) return safe_eval_compiled(compiled, variables)
def carthesian(x, y, z, V): variables.update(dict(x=x, y=y, z=z, V=V)) return safe_eval_compiled(compiled, variables)
def function(x, y, z, V): variables = dict(x=x, y=y, z=z, V=V) return safe_eval_compiled(compiled, variables)
def function(x, y, z, V): variables = dict(x=x, y=y, z=z, V=V) v1 = safe_eval_compiled(compiled1, variables) v2 = safe_eval_compiled(compiled2, variables) v3 = safe_eval_compiled(compiled3, variables) return v1, v2, v3