示例#1
0
 def test_plot_comparison(self):
     matplotlib.pyplot.clf()
     path_ = path.realpath(path.join(os.getcwd(), path.dirname(__file__)))
     filepath = path.join(path_, 'example_data.shp')
     figpath = path.join(path_, 'Test')
     s = spatial_efd.LoadGeometries(filepath)
     x, y, _ = spatial_efd.ProcessGeometry(s[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, figpath, 'png')
     self.assertTrue(path.isfile('{0}_10.png'.format(figpath)))
     os.remove('{0}_10.png'.format(figpath))
示例#2
0
 def test_plot_comparison_norm_size_invariant(self):
     matplotlib.pyplot.clf()
     path_ = path.realpath(path.join(os.getcwd(), path.dirname(__file__)))
     filepath = path.join(path_, 'example_data.shp')
     figpath = path.join(path_, 'Test')
     s = spatial_efd.LoadGeometries(filepath)
     x, y, _ = spatial_efd.ProcessGeometry(s[1])
     coeffs = spatial_efd.CalculateEFD(x, y, 10)
     coeffs, rotation = spatial_efd.normalize_efd(coeffs,
                                                  size_invariant=True)
     ax = spatial_efd.InitPlot()
     spatial_efd.plotComparison(ax, coeffs, 7, x, y, rotation=rotation)
     spatial_efd.SavePlot(ax, 8, figpath, 'png')
     self.assertTrue(path.isfile('{0}_8.png'.format(figpath)))
     os.remove('{0}_8.png'.format(figpath))
示例#3
0
    def test_plotting_savefig(self):
        matplotlib.pyplot.clf()
        path_ = path.realpath(path.join(os.getcwd(), path.dirname(__file__)))
        filepath = path.join(path_, 'example_data.shp')
        figpath = path.join(path_, 'Test')
        s = spatial_efd.LoadGeometries(filepath)
        x, y, _ = spatial_efd.ProcessGeometryNorm(s[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, figpath, 'png')
        self.assertTrue(path.isfile('{0}_5.png'.format(figpath)))
        os.remove('{0}_5.png'.format(figpath))
示例#4
0
 def test_plot_init(self):
     a = spatial_efd.InitPlot()
     self.assertTrue(isinstance(a, matplotlib.axes.Axes))