Commits

Anonymous committed 0e2a6eb

[econ/pattern/nber][s]: (addendum to prev. commit r1427) missed out rename of test file.

  • Participants
  • Parent commits 03ab2d3

Comments (0)

Files changed (2)

analyse_test.py

-from analyse import *
-import numpy
-
-class TestStuff(object):
-
-    def _gen_test_array(self):
-       tarr1 = RandomArray.random((20, 30))
-       tarr2 = less_equal(tarr1, 0.1)
-       return tarr2
-
-    in_array = 0.0 + array(
-[[0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0],
- [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0],
- [0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0],
- [0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1],
- [0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0],
- [0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
- [1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0],
- [0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],
- [0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
- [0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0],
- [1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
- [1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0],
- [0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
- [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
- [0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
- [0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]]
-)
- 
-    def test_make_closure(self):
-        out = make_closure(self.in_array)
-        assert out[0,1] == 1
-        assert out[0,9] == 1
-    
-    def test_reduce_dimensions(self):
-        # tmp = self.in_array[:,0:self.in_array.shape[0]]
-        tmp = self.in_array
-        out = reduce_dimensions(tmp)
-        assert out.ndim == tmp.ndim
-        assert out.shape == tmp.shape
-
-    def test_reduce_dimensions_rpy(self):
-        tmp = self.in_array
-        out = reduce_dimensions_rpy(tmp)
-        assert out['sdev'][0] > 0
-        # rpy.r.plot(out['sdev'])
-        # rpy.r.lines(rpy.r.c(0,.05),rpy.r.c(1,.05))
-        # while 'X11' in rpy.as_list(rpy.r('.Devices')):
-        #    rpy.r_events()
-        # self.fail(out)
-    
-    def test_all_in_one(self):
-        import tempfile
-        out = make_closure(self.in_array)
-        out = reduce_dimensions_rpy(out)
-        dump_array(out['x'], '/tmp/patent_results.txt')
-

test_dirichlet.py

+from analyse import *
+import numpy
+
+class TestStuff(object):
+
+    def _gen_test_array(self):
+       tarr1 = RandomArray.random((20, 30))
+       tarr2 = less_equal(tarr1, 0.1)
+       return tarr2
+
+    in_array =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0,0,0,0],
+ [0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
+ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0],
+ [0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
+ [0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]]
+)
+ 
+    def test_make_closure(self):
+        out = make_closure(self.in_array)
+        assert out[0,1] == 1
+        assert out[0,9] == 1
+    
+    def test_reduce_dimensions(self):
+        # tmp = self.in_array[:,0:self.in_array.shape[0]]
+        tmp = self.in_array
+        out = reduce_dimensions(tmp)
+        assert out.ndim == tmp.ndim
+        assert out.shape == tmp.shape
+
+    def test_reduce_dimensions_rpy(self):
+        tmp = self.in_array
+        out = reduce_dimensions_rpy(tmp)
+        assert out['sdev'][0] > 0
+        # rpy.r.plot(out['sdev'])
+        # rpy.r.lines(rpy.r.c(0,.05),rpy.r.c(1,.05))
+        # while 'X11' in rpy.as_list(rpy.r('.Devices')):
+        #    rpy.r_events()
+        # self.fail(out)
+    
+    def test_all_in_one(self):
+        import tempfile
+        out = make_closure(self.in_array)
+        out = reduce_dimensions_rpy(out)
+        dump_array(out['x'], '/tmp/patent_results.txt')
+