label_density#
- label_density(domain, label_name, population=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0)#
Calculate the density of a specific label within a given domain.
- 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:
- densitynumpy.ndarray
An array of densities for each unique label.
- this_areafloat
The total area considered for the density calculation.
- unique_labelslist
A list of unique labels found in the domain.
- Raises:
- ValueError
If the label is not found in the domain or if the label is not categorical.