count_tiles_matching_filter

toasty.toast.count_tiles_matching_filter(depth, filter, bottom_only=True, coordsys=ToastCoordinateSystem.ASTRONOMICAL)[source]

Count the number of tiles matching a filter.

Parameters:
depthint

The tile depth to recurse to.

filterfunction(Tile)->bool

A filter function; only tiles for which the function returns True will be investigated.

bottom_onlybool

If True, then only the lowest tiles will be processed.

coordsysoptional ToastCoordinateSystem

The TOAST coordinate system to use. Default is ToastCoordinateSystem.ASTRONOMICAL.

Returns:
The number of tiles matching the filter. Even if bottom_only is false,
the n = 0 tile is not counted.

Notes

This function’s call signature and tree-exploration semantics match generate_tiles_filtered().