public static void SetUp(string backend) { using (Py.GIL()) { Numpy.Initialize(); Matplotlib.Initialize(backend); //PythonEngine.Exec("import matplotlib;print(matplotlib.get_backend())"); Console.WriteLine(Matplotlib.get_backend()); } }
public void TestNumpy() { using (Py.GIL()) { Numpy.Initialize(); var scope = Py.CreateScope(); var np = scope.Import("numpy", "np"); dynamic m1 = np.matrix(new List <List <float> > { new List <float>() { 1, 2, 3 }, new List <float>() { 4, 5, 6 } }); TestOutput(m1); dynamic m2 = np.matrix(new List <List <float> > { new List <float>() { 1, 2, }, new List <float>() { 3, 4 }, new List <float>() { 5, 6 } }); TestOutput(m2); TestOutput((m1 * m2).ToString()); } }