Esempio n. 1
0
 def setUp(self):
     data = south()
     data['n_samples'] = 0
     np.random.seed(TEST_SEED)
     self.trace = Trace.from_csv(FULL_PATH + '/data/south_mvcm_5000',
                                 multi=True)
     self.single_trace = Trace.from_csv(FULL_PATH +
                                        '/data/south_mvcm_5000_0.csv')
     self.geweke_known = json.load(open(FULL_PATH + '/data/geweke.json'))
Esempio n. 2
0
    def setUp(self):

        self.a = {chr(i + 97): list(range(10)) for i in range(5)}

        self.t = Trace(**self.a)
        self.mt = Trace(self.a, self.a, self.a)
        self.real_mt = Trace.from_csv(FULL_PATH + r'/data/south_mvcm_5000',
                                      multi=True)
        self.real_singles = [
            Trace.from_csv(FULL_PATH +
                           r'/data/south_mvcm_5000_{}.csv'.format(i))
            for i in range(4)
        ]
Esempio n. 3
0
 def setUp(self):
     super(Test_Lower_SE, self).build_self()
     self.cls = lower.SE
     del self.inputs["M"]
     self.inputs['n_samples'] = 0
     instance = self.cls(**self.inputs)
     self.answer_trace = Trace.from_csv(FULL_PATH + '/data/lower_se.csv')
Esempio n. 4
0
 def setUp(self):
     super(Test_Upper_SMA, self).build_self()
     self.cls = upper.SMA
     del self.inputs["W"]
     self.inputs['n_samples'] = 0
     instance = self.cls(**self.inputs)
     self.answer_trace = Trace.from_csv(FULL_PATH + '/data/upper_sma.csv')
Esempio n. 5
0
 def setUp(self):
     data = south()
     data['n_samples'] = 0
     np.random.seed(TEST_SEED)
     test_methods = ['obm', 'bm', 'bartlett', 'hanning', 'tukey']
     self.trace = Trace.from_csv(FULL_PATH + '/data/south_mvcm_5000',
                                 multi=True)
     self.single_trace = Trace.from_csv(FULL_PATH +
                                        '/data/south_mvcm_5000_0.csv')
     self.bm = json.load(open(FULL_PATH + '/data/mcse_bm.json', 'r'))
     self.obm = json.load(open(FULL_PATH + '/data/mcse_obm.json', 'r'))
     self.tukey = json.load(open(FULL_PATH + '/data/mcse_hanning.json',
                                 'r'))
     self.bartlett = json.load(
         open(FULL_PATH + '/data/mcse_bartlett.json', 'r'))
     self.hanning = self.tukey
Esempio n. 6
0
 def setUp(self):
     super(Test_MVCM, self).build_self()
     self.cls = M.MVCM
     del self.inputs['M']
     del self.inputs['W']
     self.inputs['n_samples'] = 0
     self.instance = self.cls(**self.inputs)
     self.answer_trace = Trace.from_csv(FULL_PATH + '/data/mvcm.csv')
Esempio n. 7
0
    def setUp(self):

        self.answer = Trace.from_csv(FULL_PATH + '/data/svc.csv')
        self.inputs = dict()
        baltim = ps.pdio.read_files(ps.examples.get_path('baltim.shp'))
        Y = np.log(baltim.PRICE.values).reshape(-1, 1)
        Yz = Y - Y.mean()
        X = baltim[['AGE', 'LOTSZ', 'SQFT']].values
        Xz = X - X.mean(axis=0)
        coords = baltim[['X', 'Y']].values
        self.inputs.update({'Y': Yz, 'X': Xz, 'coordinates': coords})
        self.ignore_shape = True
        self.test_trace = no_op
Esempio n. 8
0
 def setUp(self):
     data = south()
     data['n_samples'] = 0
     with open(FULL_PATH + '/data/psrf_noburn.json', 'r') as noburn:
         self.noburn = json.load(noburn)
     with open(FULL_PATH + '/data/psrf_brooks.json', 'r') as brooks:
         self.known_brooks = json.load(brooks)
     with open(FULL_PATH + '/data/psrf_gr.json', 'r') as gr:
         self.known_gr = json.load(gr)
     np.random.seed(TEST_SEED)
     self.trace = Trace.from_csv(FULL_PATH + '/data/south_mvcm_5000',
                                 multi=True)
     self.mockmodel = Hashmap(trace=self.trace)
Esempio n. 9
0
 def test_mvcm(self):
     instance = self.cls(**self.inputs)
     np.random.seed(TEST_SEED)
     instance.draw()
     other_answers = Trace.from_csv(FULL_PATH + '/data/mvcm.csv')
     strip_out = [
         col for col in instance.trace.varnames
         if col not in other_answers.varnames
     ]
     other_answers._assert_allclose(instance.trace.drop(*strip_out,
                                                        inplace=False),
                                    rtol=RTOL,
                                    atol=ATOL)
Esempio n. 10
0
 def test_from_csv(self):
     self.t.to_csv('./test_from_csv.csv')
     new_t = Trace.from_csv('./test_from_csv.csv')
     assert self.t == new_t
     os.remove('./test_from_csv.csv')
Esempio n. 11
0
 def setUp(self):
     super(Test_SESE, self).build_self()
     self.cls = M.SESE
     self.inputs['n_samples'] = 0
     self.instance = self.cls(**self.inputs)
     self.answer_trace = Trace.from_csv(FULL_PATH + '/data/sese.csv')
Esempio n. 12
0
 def setUp(self):
     data = south()
     data['n_samples'] = 0
     np.random.seed(TEST_SEED)
     self.trace = Trace.from_csv(FULL_PATH + '/data/south_mvcm_5000',
                                 multi=True)
Esempio n. 13
0
 def setUp(self):
     super(Test_Generic, self).build_self()
     self.cls = M.Generic
     self.inputs['n_samples'] = 0
     instance = self.cls(**self.inputs)
     self.answer_trace = Trace.from_csv(FULL_PATH + '/data/generic.csv')