コード例 #1
0
 def test_plot_comparison(self, example_shp, tmpdir):
     matplotlib.pyplot.clf()
     x, y, _ = spatial_efd.ProcessGeometry(example_shp[0])
     coeffs = spatial_efd.CalculateEFD(x, y, 10)
     ax = spatial_efd.InitPlot()
     spatial_efd.plotComparison(ax, coeffs, 10, x, y)
     spatial_efd.SavePlot(ax, 10, tmpdir, 'png')
     assert os.path.isfile('{0}_10.png'.format(tmpdir))
コード例 #2
0
 def test_plot_comparison_norm(self, example_shp, tmpdir):
     x, y, _ = spatial_efd.ProcessGeometry(example_shp[1])
     coeffs = spatial_efd.CalculateEFD(x, y, 10)
     coeffs, rotation = spatial_efd.normalize_efd(coeffs,
                                                  size_invariant=False)
     ax = spatial_efd.InitPlot()
     spatial_efd.plotComparison(ax, coeffs, 7, x, y, rotation=rotation)
     spatial_efd.SavePlot(ax, 7, tmpdir, 'png')
     assert os.path.isfile('{0}_7.png'.format(tmpdir))
コード例 #3
0
 def test_plotting_savefig(self, example_shp, tmpdir):
     matplotlib.pyplot.clf()
     x, y, _ = spatial_efd.ProcessGeometryNorm(example_shp[2])
     coeffs = spatial_efd.CalculateEFD(x, y, 10)
     a, b = spatial_efd.inverse_transform(coeffs)
     ax = spatial_efd.InitPlot()
     spatial_efd.PlotEllipse(ax, a, b, color='k', width=1.)
     spatial_efd.SavePlot(ax, 5, tmpdir, 'png')
     assert os.path.isfile('{0}_5.png'.format(tmpdir))