Helper functions for handling numpy operations.

Signed-off-by: Jonas Kalderstam <jonas@kalderstam.se>