def test_isocontour(self): ref = 50 y, x = numpy.ogrid[-100:100:0.1, -100:100:0.1] r = numpy.sqrt(x * x + y * y) c = isocontour(r, ref) self.assertNotEqual(0, len(c), "controur plot contains not point") i = numpy.round(c).astype(numpy.int32) self.assert_(abs(r[(i[:, 0], i[:, 1])] - ref).max() < 0.05, "contour plot not working correctly") if logger.getEffectiveLevel() <= logging.INFO: pylab.imshow(r) pylab.plot(c[:, 1], c[:, 0], ",") pylab.show()
def test_isocontour(self): ref = 50 y, x = numpy.ogrid[-100:100:0.1, -100:100:0.1] r = numpy.sqrt(x * x + y * y) c = isocontour(r, ref) self.assertNotEqual(0, len(c), "controur plot contains not point") i = numpy.round(c).astype(numpy.int32) self.assert_( abs(r[(i[:, 0], i[:, 1])] - ref).max() < 0.05, "contour plot not working correctly") if logger.getEffectiveLevel() <= logging.INFO: pylab.imshow(r) pylab.plot(c[:, 1], c[:, 0], ",") pylab.show()
def set_circle_scatter_tth(self, tth, level): data = marchingsquares.isocontour(tth, level) self.circle_plot_item.setData(x=data[:, 0], y=data[:, 1])