src/core/simulation/base_simulation.py
def initiate(
        self,
        x_range: Optional[tuple] = None,
        y_range: Optional[tuple] = None,
        value: Optional[float] = None,
    ) -> Coral:
        """Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
        More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
        workarounds to achieve this anyway.

        :param x_range: minimum and maximum x-coordinate, defaults to None
        :param y_range: minimum and maximum y-coordinate, defaults to None
        :param value: coral cover, defaults to None

        :type coral: Coral
        :type x_range: tuple, optional
        :type y_range: tuple, optional
        :type value: float, optional

        :return: coral animal initiated
        :rtype: Coral
        """
        self.configure_hydrodynamics()
        self.configure_output()
        # Load constants and validate environment.
        self.validate_simulation_directories()
        self.validate_environment()
        RESHAPE().space = self.hydrodynamics.space

        if self.output.defined:
            self.output.initialize(self.coral)
        else:
            print("WARNING: No output defined, so none exported.")

        xy = self.hydrodynamics.xy_coordinates

        if value is None:
            value = 1

        cover = value * np.ones(RESHAPE().space)

        if x_range is not None:
            x_min = x_range[0] if x_range[0] is not None else min(xy[:][0])
            x_max = x_range[1] if x_range[1] is not None else max(xy[:][0])
            cover[np.logical_or(xy[:][0] <= x_min, xy[:][0] >= x_max)] = 0

        if y_range is not None:
            y_min = y_range[0] if y_range[0] is not None else min(xy[:][1])
            y_max = y_range[1] if y_range[1] is not None else max(xy[:][1])
            cover[np.logical_or(xy[:][1] <= y_min, xy[:][1] >= y_max)] = 0

        self.coral.initiate_coral_morphology(cover)

        self.output.initialize(self.coral)
Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
        More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
        workarounds to achieve this anyway.

        :param x_range: minimum and maximum x-coordinate, defaults to None
        :param y_range: minimum and maximum y-coordinate, defaults to None
        :param value: coral cover, defaults to None

        :type coral: Coral
        :type x_range: tuple, optional
        :type y_range: tuple, optional
        :type value: float, optional

        :return: coral animal initiated
        :rtype: Coral
        
Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
workarounds to achieve this anyway.
Initiate the coral distribution . The default coral distribution is a full coral cover over the whole domain . More complex initial conditions of the coral cover cannot be realised with this method . See the documentation on workarounds to achieve this anyway .
def initiate(
        self,
        x_range: Optional[tuple] = None,
        y_range: Optional[tuple] = None,
        value: Optional[float] = None,
    ) -> Coral:
        self.configure_hydrodynamics()
        self.configure_output()
        self.validate_simulation_directories()
        self.validate_environment()
        RESHAPE().space = self.hydrodynamics.space
        if self.output.defined:
            self.output.initialize(self.coral)
        else:
            print("WARNING: No output defined, so none exported.")
        xy = self.hydrodynamics.xy_coordinates
        if value is None:
            value = 1
        cover = value * np.ones(RESHAPE().space)
        if x_range is not None:
            x_min = x_range[0] if x_range[0] is not None else min(xy[:][0])
            x_max = x_range[1] if x_range[1] is not None else max(xy[:][0])
            cover[np.logical_or(xy[:][0] <= x_min, xy[:][0] >= x_max)] = 0
        if y_range is not None:
            y_min = y_range[0] if y_range[0] is not None else min(xy[:][1])
            y_max = y_range[1] if y_range[1] is not None else max(xy[:][1])
            cover[np.logical_or(xy[:][1] <= y_min, xy[:][1] >= y_max)] = 0
        self.coral.initiate_coral_morphology(cover)
        self.output.initialize(self.coral)
def initiate ( self , x_range : Optional [ tuple ] = None , y_range : Optional [ tuple ] = None , value : Optional [ float ] = None , ) -> Coral : self . configure_hydrodynamics ( ) self . configure_output ( ) self . validate_simulation_directories ( ) self . validate_environment ( ) RESHAPE ( ) . space = self . hydrodynamics . space if self . output . defined : self . output . initialize ( self . coral ) else : print ( "WARNING: No output defined, so none exported." ) xy = self . hydrodynamics . xy_coordinates if value is None : value = 1 cover = value * np . ones ( RESHAPE ( ) . space ) if x_range is not None : x_min = x_range [ 0 ] if x_range [ 0 ] is not None else min ( xy [ : ] [ 0 ] ) x_max = x_range [ 1 ] if x_range [ 1 ] is not None else max ( xy [ : ] [ 0 ] ) cover [ np . logical_or ( xy [ : ] [ 0 ] <= x_min , xy [ : ] [ 0 ] >= x_max ) ] = 0 if y_range is not None : y_min = y_range [ 0 ] if y_range [ 0 ] is not None else min ( xy [ : ] [ 1 ] ) y_max = y_range [ 1 ] if y_range [ 1 ] is not None else max ( xy [ : ] [ 1 ] ) cover [ np . logical_or ( xy [ : ] [ 1 ] <= y_min , xy [ : ] [ 1 ] >= y_max ) ] = 0 self . coral . initiate_coral_morphology ( cover ) self . output . initialize ( self . coral )
Initiate the coral distribution.
Initiate the coral distribution .
"""Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
        More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
        workarounds to achieve this anyway.

        :param x_range: minimum and maximum x-coordinate, defaults to None
        :param y_range: minimum and maximum y-coordinate, defaults to None
        :param value: coral cover, defaults to None

        :type coral: Coral
        :type x_range: tuple, optional
        :type y_range: tuple, optional
        :type value: float, optional

        :return: coral animal initiated
        :rtype: Coral
        """ # Load constants and validate environment.
coral animal initiated
coral animal initiated
Coral
self
x_range
Optional[tuple]
minimum and maximum x-coordinate, defaults to None
minimum and maximum x - coordinate defaults to None
None
y_range
Optional[tuple]
minimum and maximum y-coordinate, defaults to None
minimum and maximum y - coordinate defaults to None
None
value
Optional[float]
coral cover, defaults to None
coral cover defaults to None
None