Пример #1
0
 def test_override_kde_grid(self):
     c = ChainConsumer()
     x, y = np.linspace(0, 10, 10), np.linspace(0, 10, 10)
     z = np.ones((10, 10))
     c.add_chain([x, y], weights=z, grid=True, kde=2.0)
     c.configure()
     assert not c.chains[0].config["kde"]
Пример #2
0
 def test_pass_in_dataframe1(self):
     df = pd.DataFrame(self.d2, columns=self.p)
     c = ChainConsumer()
     c.add_chain(df)
     summary1 = c.analysis.get_summary()
     assert np.isclose(summary1["a"][0], -1, atol=0.03)
     assert np.isclose(summary1["a"][1], 0, atol=0.05)
     assert np.isclose(summary1["a"][2], 1, atol=0.03)
     assert np.isclose(summary1["b"][0], -1, atol=0.03)
     assert np.isclose(summary1["c"][0], -1, atol=0.03)
Пример #3
0
 def test_pass_in_dataframe3(self):
     data = np.random.uniform(-4, 6, size=(1000000, 1))
     weight = norm.pdf(data)
     df = pd.DataFrame(data, columns=["a"])
     df["weight"] = weight
     c = ChainConsumer()
     c.add_chain(df)
     summary1 = c.analysis.get_summary()
     assert np.isclose(summary1["a"][0], -1, atol=0.03)
     assert np.isclose(summary1["a"][1], 0, atol=0.05)
     assert np.isclose(summary1["a"][2], 1, atol=0.03)
Пример #4
0
 def test_cache_invalidation(self):
     c = ChainConsumer()
     c.add_chain(normal(size=(1000000, 1)), parameters=["a"])
     c.configure(summary_area=0.68)
     summary1 = c.analysis.get_summary()
     c.configure(summary_area=0.95)
     summary2 = c.analysis.get_summary()
     assert np.isclose(summary1["a"][0], -1, atol=0.03)
     assert np.isclose(summary2["a"][0], -2, atol=0.03)
     assert np.isclose(summary1["a"][2], 1, atol=0.03)
     assert np.isclose(summary2["a"][2], 2, atol=0.03)
Пример #5
0
 def test_override_kde_grid(self):
     c = ChainConsumer()
     x, y = np.linspace(0, 10, 10), np.linspace(0, 10, 10)
     z = np.ones((10, 10))
     c.add_chain([x, y], weights=z, grid=True, kde=2.0)
     c.configure()
     assert not c.chains[0].config["kde"]
Пример #6
0
 def test_cache_invalidation(self):
     c = ChainConsumer()
     c.add_chain(normal(size=(1000000, 1)), parameters=["a"])
     c.configure(summary_area=0.68)
     summary1 = c.analysis.get_summary()
     c.configure(summary_area=0.95)
     summary2 = c.analysis.get_summary()
     assert np.isclose(summary1["a"][0], -1, atol=1e-2)
     assert np.isclose(summary2["a"][0], -2, atol=1e-2)
     assert np.isclose(summary1["a"][1], summary2["a"][1], atol=1e-2)
     assert np.isclose(summary1["a"][2], 1, atol=1e-2)
     assert np.isclose(summary2["a"][2], 2, atol=1e-2)
Пример #7
0
 def test_color_data_posterior(self):
     c = ChainConsumer()
     c.add_chain(self.d,
                 parameters=self.p,
                 name=self.n,
                 weights=self.w,
                 posterior=np.ones(100))
     c.configure(color_params="posterior")
     chain = c.chains[0]
     assert np.all(chain.get_color_data() == np.ones(100))
Пример #8
0
 def test_color_data_none(self):
     c = ChainConsumer()
     c.add_chain(self.d,
                 parameters=self.p,
                 name=self.n,
                 weights=self.w,
                 posterior=np.ones(100))
     c.configure(color_params=None)
     chain = c.chains[0]
     assert chain.get_color_data() is None
Пример #9
0
 def test_color_data_none(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, name=self.n, weights=self.w, posterior=np.ones(100))
     c.configure(color_params=None)
     chain = c.chains[0]
     assert chain.get_color_data() is None
Пример #10
0
 def test_override_kde(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, kde=2.0)
     c.configure()
     assert c.chains[0].config["kde"] == 2.0
Пример #11
0
 def test_override_shade_alpha(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, shade_alpha=0.8)
     c.configure()
     assert c.chains[0].config["shade_alpha"] == 0.8
Пример #12
0
 def test_override_linestyle(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, linestyle="--")
     c.configure()
     assert c.chains[0].config["linestyle"] == "--"
Пример #13
0
 def test_override_linewidth(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, linewidth=2.0)
     c.configure(linewidths=[100])
     assert c.chains[0].config["linewidth"] == 100
Пример #14
0
 def test_override_color(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, color="#4286f4")
     c.configure()
     assert c.chains[0].config["color"] == "#4286f4"
Пример #15
0
 def test_override_color(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, color="#4286f4")
     c.configure()
     assert c.chains[0].config["color"] == "#4286f4"
Пример #16
0
 def test_color_data_posterior(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, name=self.n, weights=self.w, posterior=np.ones(100))
     c.configure(color_params="posterior")
     chain = c.chains[0]
     assert np.all(chain.get_color_data() == np.ones(100))
Пример #17
0
 def test_override_linewidth(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, linewidth=2.0)
     c.configure(linewidths=[100])
     assert c.chains[0].config["linewidth"] == 100
Пример #18
0
 def test_override_linestyle(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, linestyle="--")
     c.configure()
     assert c.chains[0].config["linestyle"] == "--"
Пример #19
0
 def test_override_kde(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, kde=2.0)
     c.configure()
     assert c.chains[0].config["kde"] == 2.0
Пример #20
0
 def test_override_shade_alpha(self):
     c = ChainConsumer()
     c.add_chain(self.d, parameters=self.p, shade_alpha=0.8)
     c.configure()
     assert c.chains[0].config["shade_alpha"] == 0.8