label_counts#

label_counts(domain, label_name, population=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, normalised=True)#

Calculate the counts of a specific label within a domain, optionally filtered by population and boundaries.

Parameters:
domainobject

A muspan domain object.

label_namestr

The name of the label to calculate density for.

populationarray-like, optional

The population of objects to consider, by default None.

include_boundarieslist, np.ndarray or query-like or None, optional

Boundaries to include or None to include all.

exclude_boundarieslist, np.ndarray or query-like or None, optional

Boundaries to exclude or None to exclude none.

boundary_exclude_distanceint, optional

Distance to exclude from boundaries, by default 0.

Returns:
countsnumpy.ndarray

An array of counts for each unique label.

unique_labelslist

A list of unique labels.

Raises:
ValueError

If the specified label is not found in the domain labels.