Documentation#
MuSpAn is organised into several modules, each of which provides tools for working with different aspects of spatial data and analysis. The organisation of the package is designed to group tools and spatial analysis methods that are closely related in terms of their functionality and mathematical underpinnings.
Subpackage |
Description |
---|---|
A container for spatial data |
|
Objects that can be used to represent spatial data |
|
Querying domain objects |
|
Manipulating shape objects |
|
Spatial statistics |
|
Region-based analysis of spatial data |
|
Network analysis for spatial data |
|
Geometric descriptors of shape-like objects |
|
Topological data analysis |
|
Distribution analysis of spatial data |
|
Non-spatial summary statistics |
|
Visualisation |
|
Data input and output helper operations |
|
Datasets for testing and demonstration |
|
Helper functions for spatial analysis and data manipulation |
Overall, the MuSpAn package can conveniently be divided into three main categories of submodules:
Core functionality: This includes the core classes and functions that are used to generate, manipulate, view and filter the spatial data contained within a spatial domain.
Spatial analysis: These modules provide a range of tools for analysing spatial data subcategorised by type of mathematical underpinnings.
Extra features: These modules provide extra features that are not strictly necessary for the core functionality of the package, but are useful for specific applications or use cases. This includes modules data input and output, helper functions and example datasets for demonstration and method development.

Above all this is a MuSpAn domain object, which is a container for all the spatial data. The domain object is the main entry point for working with the MuSpAn package, and it provides a convenient way to access all of the functionality of the package.
In a typical workflow, the user begins by creating a MuSpAn domain object and adding spatial data to it. Metadata is linked to objects via labels. All objects and their associated metadata are stored within the MuSpAn domain. From there, subsets of the data can be filtered using the query module, and visualised through the visualisation module. These filtered subsets can then undergo spatial analysis, with the results also available for visualisation and further downstream analysis. All outputs can be saved either through standard Python methods or via the MuSpAn IO module.

With the support of detailed documentation, tutorials, and paper examples, the MuSpAn package empowers users to thoroughly explore and analyse spatial data—from initial investigation to the integration and development of high-throughput pipelines.
Import functions from MuSpAn#
All of the functions and classes in the MuSpAn package are publically available and can be imported using the following import statement:
import muspan
Or alternatively, you can import specific functions or classes from the package. For example, if we only wanted use a specific function, say network_distance
from the networks module, we could import it as follows:
from muspan.networks import network_distance
distance = network_distance(...)
MuSpAn reference list#
All of the modules are listed below, and each module has its own documentation page that provides a detailed description of the functions and classes that are available in that module.
- muspan.domain
domain
domain.add_labels
domain.add_lines
domain.add_objects_to_collection
domain.add_points
domain.add_shapes
domain.add_shapes_with_internal_holes
domain.convert_objects
domain.delete_distances
domain.delete_labels
domain.delete_network
domain.delete_objects
domain.estimate_boundary
domain.print_collections
domain.print_labels
domain.simplify_shape_boundaries
domain.update_colors
- muspan.objects
- muspan.visualise
- muspan.shape_operations
- muspan.networks
- generate_network
- add_similarity_weight_to_edges
- add_dissimilarity_weight_to_edges
- cluster_neighbourhoods
- khop_neighbourhood
- knn_label_count
- adjacency_permutation_test
- alpha_index
- centrality
- compactness
- cyclomatic_number
- edge_orientation_distribution
- gamma_index
- node_degree
- community_detection
- network_distance
- muspan.query
- query
- query_container
- interpret_query
- is_query_like
- validate_query
- is_A_contained_by_B
- filter_objects_to_included_regions
- get_centroids
- get_children
- get_collections
- get_family_tree
- get_labels
- get_minimum_distances_boundaries
- get_minimum_distances_centroids
- get_object_components
- get_object_types
- get_parents
- return_object_IDs_from_query_like
- muspan.geometry
- muspan.spatial_statistics
- muspan.summary_statistics
- muspan.topology
- muspan.distribution
- muspan.region_based
- muspan.io
- muspan.datasets
- muspan.helpers