else: arg1 = arg1.c() return getattr(arg1, op)(arg2) return NotImplemented try: nrnpy_vec_math_register = nrn_dll_sym('nrnpy_vec_math_register') nrnpy_vec_math_register(ctypes.py_object(nrnpy_vec_math)) except: print("Failed to setup nrnpy_vec_math") try: from neuron.psection import psection nrn.set_psection(psection) except: print("Failed to setup nrn.Section.psection") pass import atexit as _atexit @_atexit.register def clear_gui_callback(): try: nrnpy_set_gui_callback = nrn_dll_sym('nrnpy_set_gui_callback') nrnpy_set_gui_callback(None) except: pass
if op == 'uabs': return arg1.abs() elif isinstance(arg2, valid_types): if flag == 1: # either reversed (flag=1) or unary (flag=2) arg2 = arg2.c() if op in ('mul', 'add'): return getattr(arg2, op)(arg1) if op == 'div': return arg2.pow(-1).mul(arg1) if op == 'sub': return arg2.mul(-1).add(arg1) else: arg1 = arg1.c() return getattr(arg1, op)(arg2) return NotImplemented try: nrnpy_vec_math_register = nrn_dll_sym('nrnpy_vec_math_register') nrnpy_vec_math_register(ctypes.py_object(nrnpy_vec_math)) except: print("Failed to setup nrnpy_vec_math") try: from neuron.psection import psection nrn.set_psection(psection) except: print("Failed to setup nrn.Section.psection") pass