:py:mod:`neurorosettes.grid` ============================ .. py:module:: neurorosettes.grid Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: neurorosettes.grid.UniformGrid neurorosettes.grid.CellDensityCheck neurorosettes.grid.OneLevelDensityCheck neurorosettes.grid.TwoLevelsDensityCheck .. py:class:: UniformGrid Class to store the objects inside a simulation container and their coordinates. Grids are defined as uniform objects with the same size and spacing for all dimensions (2D or 3D). .. py:property:: representation_grid_values :type: numpy.ndarray Returns the grid cell coordinates, inluding the top limit. .. py:attribute:: min :type: float The bottom limit of the grid domain size. .. py:attribute:: max :type: float The top limit of the grid domain size. .. py:attribute:: step :type: float The size of the grid cells. .. py:attribute:: use_2d :type: bool :value: True If a grid has a third dimension or is 2D. .. py:attribute:: grid_values :type: numpy.ndarray The coordinates of the grid cells. .. py:attribute:: idx_values :type: numpy.ndarray The indices of the grid cells. .. py:attribute:: grid :type: numpy.ndarray The grid, with the objects stored inside each cell. .. py:method:: __post_init__() Creates the empty grid object based on the initial size and spacing. .. py:method:: interpolate_idx(position) Returns the indices of the cell where a given position should be stored. :param position: The position to be located inside the grid. .. py:method:: register_cell(cell) Stores a cell object inside the grid and evaluates where to register it. :param cell: The cell object to be stored inside the grid. .. py:method:: register_neurite(neurite) Stores a neurite object inside the grid and evaluates where to register it. :param neurite: The neurite object to be stored inside the grid. .. py:method:: remove_cell(cell) Removes a cell object from the grid. :param cell: The cell object to be removed from the grid. .. py:method:: remove_neurite(neurite) Removes a neurite object from the grid. :param neurite: The neurite object to be removed from the grid. .. py:method:: get_objects_in_voxel(idxx, idxy, idxz = 0) Returns the objects inside a cell of the grid. :param idxx: The index of the cell in the x component. :param idxy: The index of the cell in the y component. :param idxz: The index of the cell in the z component. :rtype: A list of the cell bodies and neurites registered in the given cell of the grid. .. py:method:: get_close_objects(position) Returns the objects inside a cell and its neighbors. :param position: The position to be evaluated. :returns: * *A list of the cell bodies and objects inside a cell, and the* * *cells that surround it in 2 or 3 dimensions.* .. py:method:: get_close_cells(position) Returns only the cell bodies inside a cell and its neighbors. :param position: The position to be evaluated. :rtype: A list of the cell bodies inside a cell and its neighbors. .. py:method:: get_cells_in_radius(position, radius) Returns the objects inside a radius of interest. :param position: The position to be evaluated. :param radius: The radius of interest. :returns: * *A list of the cell bodies and neurites that are inside* * *a radius of interest with the given position as the centre.* .. py:class:: CellDensityCheck Bases: :py:obj:`abc.ABC` Class to evaluate the density of a tissue around a neuron object. Multiple types of checks may be defined, such as grid-based or radius-based evaluations. .. py:method:: check_max_density(cell, grid) :abstractmethod: Returns a true boolean value if the density around a neuron surpasses the limit. :param cell: The cell to be evaluated. :param grid: The Grid object where the cells and its neighbors are registered. .. py:class:: OneLevelDensityCheck(max_neighbors = 15) Bases: :py:obj:`CellDensityCheck` Class for a cell density check based on the neighboring grid cells. :param max_neighbors: The maximum numbers of neighbors inside the cell grid and its neighbors. .. py:method:: check_max_density(cell, grid) Checks if the number of neighbors is higher than the maximum limit. :param cell: The cell to be evaluated. :param grid: The Grid object where the cells and its neighbors are registered. .. py:class:: TwoLevelsDensityCheck(max_outer_neighbors = 15, max_inner_neighbors = 6, radius = 18.0) Bases: :py:obj:`CellDensityCheck` Class for a cell density check based on a radius of interest. Starts by checking if the number of neighbors is larger than the maximum, as done in the OneLevelDensityCheck. If this value is surpassed, the neighbors inside a radius of interest are selected and quantified. It then checks if there are more neighbors inside this radius than the expected value. :param max_outer_neighbors: The maximum numbers of neighbors inside the cell grid and its neighbors. :param max_inner_neighbors: The maximum number of neighbors inside of the radius of interest. :param radius: The radius of interest. .. py:method:: check_max_density(cell, grid) Checks if the number of neighbors is higher than the maximum limit. :param cell: The cell to be evaluated. :param grid: The Grid object where the cells and its neighbors are registered.