impreve numpy and matplotlib management