D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
matplotlib
/
tests
/
Filename :
test_transforms.py
back
Copy
from nose.tools import assert_equal from numpy.testing import assert_almost_equal from matplotlib.transforms import Affine2D import numpy as np def test_Affine2D_from_values(): points = [ [0,0], [10,20], [-1,0], ] t = Affine2D.from_values(1,0,0,0,0,0) actual = t.transform(points) expected = np.array( [[0,0],[10,0],[-1,0]] ) assert_almost_equal(actual,expected) t = Affine2D.from_values(0,2,0,0,0,0) actual = t.transform(points) expected = np.array( [[0,0],[0,20],[0,-2]] ) assert_almost_equal(actual,expected) t = Affine2D.from_values(0,0,3,0,0,0) actual = t.transform(points) expected = np.array( [[0,0],[60,0],[0,0]] ) assert_almost_equal(actual,expected) t = Affine2D.from_values(0,0,0,4,0,0) actual = t.transform(points) expected = np.array( [[0,0],[0,80],[0,0]] ) assert_almost_equal(actual,expected) t = Affine2D.from_values(0,0,0,0,5,0) actual = t.transform(points) expected = np.array( [[5,0],[5,0],[5,0]] ) assert_almost_equal(actual,expected) t = Affine2D.from_values(0,0,0,0,0,6) actual = t.transform(points) expected = np.array( [[0,6],[0,6],[0,6]] ) assert_almost_equal(actual,expected)