Example #1
0
 def test_decode_already_population(self):
     m = pyslim.PopulationMetadata(slim_id=1, selfing_fraction=0.2,
                                   female_cloning_fraction=0.3,
                                   male_cloning_fraction=0.4,
                                   sex_ratio=0.5, bounds_x0=0, bounds_x1=10,
                                   bounds_y0=2, bounds_y1=20, bounds_z0=3,
                                   bounds_z1=30, migration_records=[])
     dm = pyslim.decode_population(m)
     self.assertEqual(m, dm)
Example #2
0
 def test_population_metadata(self):
     mrs = [pyslim.PopulationMigrationMetadata(source_subpop=j, migration_rate=0.2)
            for j in range(3)]
     for mr_list in [[], mrs]:
         md = pyslim.PopulationMetadata(
                 slim_id=1, selfing_fraction=0.75, female_cloning_fraction=0.2,
                 male_cloning_fraction=0.8, sex_ratio=0.6, bounds_x0=-1.0,
                 bounds_x1=2.0, bounds_y0=0.0, bounds_y1=0.0, bounds_z0=0.0,
                 bounds_z1=1.0, migration_records=mr_list)
         md_bytes = pyslim.encode_population(md)
         new_md = pyslim.decode_population(md_bytes)
         self.assertEqual(md, new_md)