Esempio n. 1
0
 def test_null_edge_directionality_timeseries(self):
     exp_edge_dir_mat = array(
         [[2., 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., 0.],
          [0., 0., 0., 2., 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., 0., 0., 0., 0., 2., 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., 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.],
          [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., 2., 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.]])
     indices = timeseries_indices(self.freq, self.amp, self.phase,
                                  self.noise, self.adj, self.q)
     num_nodes = [
         81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81
     ]
     otu1 = ['o1', 'o1', 'o1']
     otu2 = ['o3', 'o1', 'o240']
     edge_dir_mat = null_edge_directionality_timeseries(
         otu1, otu2, num_nodes, indices)
     self.assertEqual(exp_edge_dir_mat, edge_dir_mat)
Esempio n. 2
0
 def test_timeseries_indices(self):
     '''test that the parser works correctly for combinations actually used in timeseries tables round 2
     freq 1 otus: 0-80, freq 2 otus: 81-161, freq 3 otus: 162-242
     amp 1 otus: 0-26, 81-107, 162-188; amp .5 otus: 27-53, 108-134, 189-215; amp .25 otus: 54-80, 135-161, 216-242
     phase 0 otus: 0-8, 81-89, 162-170, 27-35, 108-116, 189-197, 54-62, 135-143, 216-224
     phase .25pi otus: 9-17, 90-98, 171-179, 36-44, 117-125, 198-206, 63-71, 144-152, 225-233
     phase .5pi otus: 18-26, 99-107, 180-188, 45-53, 126-134, 207-215, 72-80, 153-161, 234-242 
     noise 0 otus: 0-2, 9-11, 36-34, 81-83, 90-92, 117-119, 162-164, 171-173, 198-200, 63-65, 144-146, 225-227, 27-29, 108-110, 189-191, 54-56, 135-137, 216-218,
     18-20, 99-101, 180-182, 45-47, 126-128, 207-209, 72-74, 153-155, 234-236
     noise .25 otus: 3-5, 12-14, 36-38, 84-86, 93-95, 120-122, 165-167, 174-176, 201-203, 66-68, 147-149, 228-230, 30-32, 111-113, 193-195, 57-59, 138-140, 219-221,
     21-23, 102-104, 183-185, 48-50, 129-131, 210-212, 75-77, 156-158, 237-239
     noise .5 otus: 6-8, 15-17, 39-41, 87-89, 96-98, 123-125, 168-170, 177-179, 204-206, 69-71, 150-152, 231-233, 33-35, 114-116, 196-198, 60-62, 141-143, 222-224, 
     24-26, 105-107, 186-188, 51-53, 132-134, 213-215, 78-80, 159-161, 240-242
     adj(1) otus: 0, 3, 6, 9, 12, 15 ... 237, 240
     adj(2) otus: 1, 4, 7, 10, ... 238, 241
     adj(3) otus: 2, 5, 8, 11, ... 239, 242 
     '''
     indices = timeseries_indices(self.freq, self.amp, self.phase,
                                  self.noise, self.adj, self.q)
     self.assertEqual(self.exp_indices, indices)
Esempio n. 3
0
 def test_timeseries_indices(self):
     '''test that the parser works correctly for combinations actually used in timeseries tables round 2
     freq 1 otus: 0-80, freq 2 otus: 81-161, freq 3 otus: 162-242
     amp 1 otus: 0-26, 81-107, 162-188; amp .5 otus: 27-53, 108-134, 189-215; amp .25 otus: 54-80, 135-161, 216-242
     phase 0 otus: 0-8, 81-89, 162-170, 27-35, 108-116, 189-197, 54-62, 135-143, 216-224
     phase .25pi otus: 9-17, 90-98, 171-179, 36-44, 117-125, 198-206, 63-71, 144-152, 225-233
     phase .5pi otus: 18-26, 99-107, 180-188, 45-53, 126-134, 207-215, 72-80, 153-161, 234-242 
     noise 0 otus: 0-2, 9-11, 36-34, 81-83, 90-92, 117-119, 162-164, 171-173, 198-200, 63-65, 144-146, 225-227, 27-29, 108-110, 189-191, 54-56, 135-137, 216-218,
     18-20, 99-101, 180-182, 45-47, 126-128, 207-209, 72-74, 153-155, 234-236
     noise .25 otus: 3-5, 12-14, 36-38, 84-86, 93-95, 120-122, 165-167, 174-176, 201-203, 66-68, 147-149, 228-230, 30-32, 111-113, 193-195, 57-59, 138-140, 219-221,
     21-23, 102-104, 183-185, 48-50, 129-131, 210-212, 75-77, 156-158, 237-239
     noise .5 otus: 6-8, 15-17, 39-41, 87-89, 96-98, 123-125, 168-170, 177-179, 204-206, 69-71, 150-152, 231-233, 33-35, 114-116, 196-198, 60-62, 141-143, 222-224, 
     24-26, 105-107, 186-188, 51-53, 132-134, 213-215, 78-80, 159-161, 240-242
     adj(1) otus: 0, 3, 6, 9, 12, 15 ... 237, 240
     adj(2) otus: 1, 4, 7, 10, ... 238, 241
     adj(3) otus: 2, 5, 8, 11, ... 239, 242 
     '''
     indices = timeseries_indices(self.freq, self.amp, self.phase, 
         self.noise, self.adj, self.q)
     self.assertEqual(self.exp_indices, indices)
Esempio n. 4
0
 def test_null_edge_directionality_timeseries(self):
     exp_edge_dir_mat = array([ 
     [ 2. , 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. , 0.],
     [ 0. , 0. , 0. , 2. , 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. , 0. , 0. , 0. , 0. , 2. , 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. , 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.],
     [ 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. , 2. , 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.]])
     indices = timeseries_indices(self.freq, self.amp, self.phase, self.noise, self.adj, self.q)
     num_nodes = [81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81]
     otu1 = ['o1', 'o1', 'o1']
     otu2 = ['o3', 'o1', 'o240']
     edge_dir_mat = null_edge_directionality_timeseries(otu1, otu2, num_nodes, indices)
     self.assertEqual(exp_edge_dir_mat, edge_dir_mat)