コード例 #1
0
    def __init__(self, ps, landscape):
        self._ps = ps
        self._landscape = landscape
        self._nx, self._ny = landscape.shape

        #Check if the simulation should end if an individual leaves the landscape bounds
        self._break_on_leave = ps.max_distance and (
            ps.max_distance < self._nx / 2. or ps.max_distance < self._ny / 2.)

        #Calculate the number of individuals to seed each of the initial source locations.
        self._ips = np.floor(self._ps.ips / len(self._ps.isl))

        #Construct the population and dispersal sub-models
        self._pmodel = Population_Model(ps)
        self._dmodel = Dispersal_Model(ps, landscape)