moved Numpy related imports and definitions together