Ejemplo n.º 1
0
 def testRemoveOutOfRange(self):
     m = fp.MetaPopVec(64, [100, 100])
     #remove the second deme
     demog.remove_pop(m, 1)
     #try again = exception
     with self.assertRaises(IndexError):
         demog.remove_pop(m, 1)
Ejemplo n.º 2
0
 def testAdmixInvalidProportion(self):
     """
     Test requirement that admix prop is 0 <= p <= 1
     """
     m = fp.MetaPopVec(64, [100, 100])
     rng = fp.GSLrng(101)
     with self.assertRaises(RuntimeError):
         demog.admix_pops(rng, m, 0, 1, -0.1, 100)
Ejemplo n.º 3
0
 def testMergeOutOfRange(self):
     m = fp.MetaPopVec(64, [100])
     #Make identical copy of
     #first deme in each pop
     demog.copy_pop(m, 0)
     with self.assertRaises(IndexError):
         #Now, try to merge
         #but second index
         #out of range:
         demog.merge_pops(m, 0, 2)
Ejemplo n.º 4
0
 def testAdmixOutOfRange(self):
     m = fp.MetaPopVec(64, [100, 100])
     rng = fp.GSLrng(101)
     with self.assertRaises(IndexError):
         demog.admix_pops(rng, m, 0, 2, 0.1, 100)
Ejemplo n.º 5
0
 def testSplitOutOfRange(self):
     m = fp.MetaPopVec(64, [100])
     rng = fp.GSLrng(101)
     with self.assertRaises(IndexError):
         demog.split_pops(rng, m, 2, 50)
Ejemplo n.º 6
0
 def testSwapOutOfRange(self):
     m = fp.MetaPopVec(64, [100, 100])
     with self.assertRaises(IndexError):
         demog.swap_pops(m, 0, 2)
Ejemplo n.º 7
0
 def testMergeDemeOntoItself(self):
     m = fp.MetaPopVec(64, [100, 100])
     with self.assertRaises(RuntimeError):
         ##Cannot merge deme into itself:
         demog.merge_pops(m, 1, 1)
Ejemplo n.º 8
0
 def testCopyOutOfRange(self):
     m = fp.MetaPopVec(64, [100])
     ##There is only 1 deme, so index of 1 is out of range
     with self.assertRaises(IndexError):
         demog.copy_pop(m, 1)