Skip to content

Commit

Permalink
_PropertyGrid: Rename functions to select and move by multiple proper…
Browse files Browse the repository at this point in the history
…ties

Hopefully these names are a little clearer
  • Loading branch information
EwoutH committed Dec 6, 2023
1 parent 907d60a commit ca72bee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,11 @@ class _PropertyGrid(_Grid):
remove_property_layer(property_name): Removes a property layer from the grid by its name.
get_empty_mask(): Generates a boolean mask indicating empty cells on the grid.
get_neighborhood_mask(pos, moore, include_center, radius): Generates a boolean mask of the neighborhood.
select_cells_multi_properties(conditions, mask, return_list): Selects cells based on multiple property conditions,
select_cells_by_properties(conditions, mask, return_list): Selects cells based on multiple property conditions,
optionally with a mask, returning either a list of coordinates or a mask.
select_extreme_value_cells(property_name, mode, mask, return_list): Selects cells with extreme values of a property,
optionally with a mask, returning either a list of coordinates or a mask.
move_agent_to_random_cell(agent, conditions, mask): Moves an agent to a random cell meeting specified property
move_agent_to_cell_by_properties(agent, conditions, mask): Moves an agent to a random cell meeting specified property
conditions, optionally with a mask.
move_agent_to_extreme_value_cell(agent, property_name, mode, mask): Moves an agent to a cell with extreme value of
a property, optionally with a mask.
Expand Down Expand Up @@ -814,7 +814,7 @@ def get_neighborhood_mask(
mask[coords[:, 0], coords[:, 1]] = True
return mask

def select_cells_multi_properties(
def select_cells_by_properties(
self, conditions: dict, mask: np.ndarray = None, return_list: bool = True
) -> list[Coordinate] | np.ndarray:
"""
Expand Down Expand Up @@ -847,7 +847,7 @@ def select_cells_multi_properties(
else:
return combined_mask

def move_agent_to_random_cell(
def move_agent_to_cell_by_properties(
self, agent: Agent, conditions: dict, mask: np.ndarray = None
) -> None:
"""
Expand All @@ -859,7 +859,7 @@ def move_agent_to_random_cell(
conditions (dict): Conditions for selecting the cell.
mask (np.ndarray, optional): A boolean mask to restrict the selection.
"""
eligible_cells = self.select_cells_multi_properties(
eligible_cells = self.select_cells_by_properties(
conditions, mask, return_list=True
)

Expand Down

0 comments on commit ca72bee

Please sign in to comment.