def test_set_animal_parameters(self, input_map, ini_pop):
        """set_animal_parameters should change parameters successfully"""
        s = BioSim(island_map=input_map, ini_pop=ini_pop, seed=1)

        s.set_animal_parameters("Herbivore", {"zeta": 3.2, "xi": 1.8})
        s.set_animal_parameters("Carnivore", {"zeta": 5.0, "xi": 2.0})
        assert Herbivore.animal_params["zeta"] == 3.2
        assert Herbivore.animal_params["xi"] == 1.8
        assert Carnivore.animal_params["zeta"] == 5.0
        assert Carnivore.animal_params["xi"] == 2.0
Exemple #2
0
            "age": 5,
            "weight": 20
        } for _ in range(100)],
    }]
    # Should specify the total_years
    sim = BioSim(island_map=geogr,
                 ini_pop=ini_herbs,
                 seed=123456,
                 total_years=2000,
                 img_base='Raw_Images',
                 cmax_animals={
                     'Herbivore': 100,
                     'Carnivore': 100
                 })

    sim.set_animal_parameters("Herbivore", {"zeta": 3.2, "xi": 1.8})
    sim.set_animal_parameters(
        "Carnivore",
        {
            "a_half": 70,
            "phi_age": 0.5,
            "omega": 0.3,
            "F": 65,
            "DeltaPhiMax": 9.0,
        },
    )
    sim.set_landscape_parameters("J", {"f_max": 700})

    sim.simulate(num_years=50, vis_years=1, img_years=10)

    sim.add_population(population=ini_carns)
Exemple #3
0
from src.biosim.simulation import BioSim
from src.biosim.animals import Carnivore, Herbivore, BaseAnimal

default_population = [
    {
        "loc": (3, 3),
        "pop": [{
            "species": "Herbivore",
            "age": 5,
            "weight": 20
        } for _ in range(2000)],
    },
]
sim = BioSim(island_map='OOOOOOO\n'
             'ODDDDDO\n'
             'ODDDDDO\n'
             'ODDDDDO\n'
             'ODDDDDO\n'
             'ODDDDDO\n'
             'OOOOOOO',
             ini_pop=default_population,
             img_base='migrate_checker',
             ymax_animals=3000)
sim.set_animal_parameters('Herbivore', {
    'mu': 1e10,
    'omega': 1e-10,
    'eta': 1e-10
})
print(Herbivore.mu, Herbivore.omega, Herbivore.eta, Herbivore.w_birth,
      Herbivore.sigma_birth)
sim.make_movie()