|
6 | 6 | # COPULA IMPORTS |
7 | 7 | from starvine.bvcopula.copula.mixture_copula import MixtureCopula as mc |
8 | 8 | import numpy as np |
9 | | -import matplotlib.pyplot as plt |
| 9 | +from starvine.bvcopula import bv_plot |
10 | 10 | import os |
11 | 11 | pwd_ = os.path.dirname(os.path.abspath(__file__)) |
12 | 12 | from starvine.bvcopula.copula.gumbel_copula import GumbelCopula |
|
17 | 17 |
|
18 | 18 | class TestMixtureCopula(unittest.TestCase): |
19 | 19 | def setUp(self): |
20 | | - self._mix_copula = mc(GumbelCopula(1), 0.5, |
21 | | - GumbelCopula(2), 0.5) |
| 20 | + self._mix_copula = mc(GumbelCopula(2, [2.1]), 0.5, |
| 21 | + GumbelCopula(3, [2.7]), 0.5) |
22 | 22 |
|
23 | 23 | def testMixCoplulaPdf(self): |
24 | | - u = np.linspace(1.0e-8, 1.0-1e-8, 50) |
25 | | - v = np.linspace(1.0e-8, 1.0-1e-8, 50) |
26 | | - c_pdf = self._mix_copula.pdf(u, v) |
| 24 | + u = np.linspace(6.0e-2, 1.0-6e-2, 50) |
| 25 | + v = np.linspace(6.0e-2, 1.0-6e-2, 50) |
| 26 | + uu, vv = np.meshgrid(u, v) |
| 27 | + c_pdf = self._mix_copula.pdf(uu.flatten(), vv.flatten()) |
27 | 28 | self.assertTrue(np.all(c_pdf >= 0)) |
| 29 | + # plot mixture pdf |
| 30 | + bv_plot.bvContourf(uu.flatten(), vv.flatten(), c_pdf, savefig="mix.png") |
28 | 31 |
|
29 | 32 | def testMixCoplulaCdf(self): |
30 | 33 | u = np.linspace(1.0e-8, 1.0-1e-8, 50) |
|
0 commit comments