def test_basic_plot_features_nsimu_lt_maxpoints(self): chains = np.random.random_sample(size=(100, 3)) f = MP.plot_pairwise_correlation_panel(chains=chains) x1, y1 = f.axes[0].lines[0].get_xydata().T x2, y2 = f.axes[1].lines[0].get_xydata().T x3, y3 = f.axes[1].lines[0].get_xydata().T self.assertTrue(np.array_equal(x1, chains[:, 0]), msg='Expect x1 to match column 0') self.assertTrue(np.array_equal(y1, chains[:, 1]), msg='Expect y1 to match column 1') self.assertTrue(np.array_equal(x2, chains[:, 0]), msg='Expect x2 to match column 0') self.assertTrue(np.array_equal(y2, chains[:, 2]), msg='Expect y2 to match column 2') self.assertTrue(np.array_equal(x3, chains[:, 0]), msg='Expect x3 to match column 1') self.assertTrue(np.array_equal(y3, chains[:, 2]), msg='Expect y3 to match column 2') for ai in f.axes: self.assertEqual(ai.get_xlabel(), '', msg='Should be blank') self.assertEqual(f.axes[0].get_title(), '$p_{0}$', msg='Expect $p_{0}$') self.assertEqual(f.axes[2].get_title(), '$p_{1}$', msg='Expect $p_{1}$') self.assertEqual(f.axes[0].get_ylabel(), '$p_{1}$', msg='Expect $p_{1}$') self.assertEqual(f.axes[1].get_ylabel(), '$p_{2}$', msg='Expect $p_{2}$') plt.close()
def test_basic_plot_features_2c_w_contours_and_legend(self): chains = np.random.random_sample(size=(100, 2)) f = MP.plot_pairwise_correlation_panel(chains=chains, settings=dict( add_5095_contours=True, add_legend=True)) x1, y1 = f.axes[0].lines[0].get_xydata().T self.assertTrue(np.array_equal(x1, chains[:, 0]), msg='Expect x1 to match column 0') self.assertTrue(np.array_equal(y1, chains[:, 1]), msg='Expect y1 to match column 1') self.assertEqual(len(f.axes[0].lines), 3, msg='Expect 3 lines') self.assertEqual(len(f.legends), 1, msg='Expect legend') plt.close()
def test_basic_plot_features_2c_w_contours(self): chains = np.random.random_sample(size=(100, 2)) f = MP.plot_pairwise_correlation_panel( chains=chains, settings=dict(add_5095_contours=True)) x1, y1 = f.axes[0].lines[0].get_xydata().T self.assertTrue(np.array_equal(x1, chains[:, 0]), msg='Expect x1 to match column 0') self.assertTrue(np.array_equal(y1, chains[:, 1]), msg='Expect y1 to match column 1') self.assertEqual(len(f.axes[0].lines), 3, msg='Expect 3 lines') for ai in f.axes: self.assertEqual(ai.get_title(), '', msg='Should be blank') self.assertEqual(f.axes[0].get_xlabel(), '$p_{0}$', msg='Expect $p_{0}$') self.assertEqual(f.axes[0].get_ylabel(), '$p_{1}$', msg='Expect $p_{1}$') plt.close()