-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes names and start adding tests.
- Loading branch information
Showing
2 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
This file implements unit tests to check discrete choice functions | ||
""" | ||
from __future__ import print_function, division | ||
from __future__ import absolute_import | ||
|
||
from builtins import str | ||
from builtins import zip | ||
from builtins import range | ||
from builtins import object | ||
|
||
from HARK import interpolation | ||
|
||
# Bring in modules we need | ||
import unittest | ||
import numpy as np | ||
|
||
|
||
class testsForDiscreteChoice(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.Vs2D = np.stack((np.zeros(3), np.ones(3))) | ||
# self.Vs3D = np.array([[0.0, 1.0, 4.0], [1.0, 2.0, 0.0], [3.0, 0.0, 2.0]]) | ||
|
||
self.CRRA_vals = np.linspace(1.,10.,10) | ||
|
||
def test_noShock2D(self): | ||
# Test the value functions and policies of the 2D case | ||
sigma = 0.0 | ||
Vref = np.array([1.0, 1.0, 1.0]) | ||
Pref = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]]) | ||
V, P = interpolation.discreteLogSum(self.Vs2D, sigma) | ||
self.assertTrue((V, P), (Vref, Pref)) | ||
|
||
|
||
|
||
# self.assertTrue((np.array([3., 2., 4.]), array([[0., 0., 1.], [0., 1., 0.], [1., 0., 0.]])) |