liana.utils.query_bandwidth#
- liana.utils.query_bandwidth(coordinates, start=0, end=500, interval_n=50, reference=None)#
Query the bandwidth (maximum distance) at which the average number of neighbors is maximized.
- Parameters:
coordinates (
ndarray) – Spatial coordinates of spots.start (
int(default:0)) – Starting bandwidth.end (
int(default:500)) – Ending bandwidth.interval_n (
int(default:50)) – Number of bandwidths to query. Used to generate a linearly spaced interval betweenstartandend. Default is 50.reference (
ndarray(default:None)) – Reference coordinates to query the neighbors from. Default isNone, which will usecoordinates.
- Return type:
tuple[Figure,DataFrame]- Returns:
A
plotnineplot and apandasDataFrame with the following columns: -bandwith: the bandwidth (maximum distance) at which the average number of neighbors is maximized. -neighbours: the average number of neighbors at the specified bandwidth.
Examples