Visualization¶
The visualization module provides tools for visualizing DeepMIMO datasets, including coverage maps, ray paths, and channel characteristics.
More visualization examples
See the Visualization section of the DeepMIMO Manual for additional examples.
Coverage Maps¶
Create coverage map visualization for user positions.
import deepmimo as dm
# Load a scenario and select the txrx pair with a receiver grid
dataset = dm.load('asu_campus_3p5')[0]
# Example plot LoS status with default settings
dm.plot_coverage(dataset.rx_pos, dataset.los)
# Customize visualization
ax, cbar = dm.plot_coverage(
rxs, # User positions (NĂ—3)
cov_map, # Coverage values
dpi=100, # Plot resolution
figsize=(6, 4), # Figure size
cbar_title='Power', # Colorbar title
title=True, # Show title
scat_sz=0.5, # Marker size
bs_pos=bs_position, # Base station position
bs_ori=bs_orientation, # Base station orientation
legend=True, # Show legend
proj_3D=False, # 2D/3D projection
cmap='viridis' # Color map
)
# Plot multiple features
features = ['aoa_az', 'aoa_el', 'aod_az', 'aod_el',
'delay', 'power', 'phase', 'los', 'num_paths']
for key in features:
plt_var = dataset[key][:,0] if dataset[key].ndim == 2 else dataset[key]
dataset.plot_coverage(plt_var, title=key) # wrapper to plot_coverage(dataset.rx_pos)
Generate coverage map visualization for user positions.
This function creates a customizable plot showing user positions colored by coverage values, with optional base station position and orientation indicators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rxs
|
ndarray
|
User position array with shape (n_users, 3) |
required |
cov_map
|
tuple[float, ...] | list[float] | ndarray
|
Coverage map values for coloring |
required |
dpi
|
int
|
Plot resolution in dots per inch. Defaults to 300. |
100
|
figsize
|
tuple[int, int]
|
Figure dimensions (width, height) in inches. Defaults to (6,4). |
(6, 4)
|
cbar_title
|
str
|
Title for the colorbar. Defaults to ''. |
''
|
title
|
bool | str
|
Plot title. Defaults to False. |
False
|
scat_sz
|
float
|
Size of scatter markers. Defaults to 0.5. |
0.5
|
bs_pos
|
Optional[ndarray]
|
Base station position coordinates. Defaults to None. |
None
|
bs_ori
|
Optional[ndarray]
|
Base station orientation angles. Defaults to None. |
None
|
legend
|
bool
|
Whether to show plot legend. Defaults to False. |
False
|
lims
|
Optional[tuple[float, float]]
|
Color scale limits (min, max). Defaults to None. |
None
|
proj_3d
|
bool
|
Whether to create 3D projection. Defaults to False. |
False
|
equal_aspect
|
bool
|
Whether to maintain equal axis scaling. Defaults to False. |
False
|
tight
|
bool
|
Whether to set tight axis limits around data points. Defaults to True. |
True
|
cmap
|
str | list
|
Matplotlib colormap name or list of colors. Defaults to 'viridis'. |
'viridis'
|
cbar_labels
|
Optional[list[str]]
|
List of labels for the colorbar. Defaults to None. |
None
|
ax
|
Optional[Axes]
|
Matplotlib Axes object. Defaults to None. |
None
|
**kwargs
|
Any
|
Additional keyword-only options; accepts |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Tuple containing: |
Axes
|
|
Colorbar
|
|
tuple[Figure, Axes, Colorbar]
|
|
Rays¶
Plot ray paths between transmitter and receiver with interaction points.
import deepmimo as dm
# Load a scenario and select the txrx pair with a receiver grid
dataset = dm.load('asu_campus_3p5')[0]
# Plot ray paths
fig, ax = dm.plot_rays(
dataset.rx_pos, # Receiver location
dataset.tx_pos, # Transmitter location
dataset.inter_pos, # Interaction positions
dataset.inter, # Interaction types
figsize=(10, 8), # Figure size
dpi=100, # Plot resolution
proj_3D=True, # 3D projection
color_by_type=True # Color by interaction type
)
# Plot ray paths with wrapper
dataset.plot_rays(10) # user index
Plot ray paths between transmitter and receiver with interaction points.
For a given user, plots all ray paths connecting TX and RX through their respective interaction points. Each path is drawn as a sequence of segments connecting TX -> interaction points -> RX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rx_loc
|
ndarray
|
Receiver location array with shape [3,] |
required |
tx_loc
|
ndarray
|
Transmitter location array with shape [3,] |
required |
inter_pos
|
ndarray
|
Interaction positions with shape [n_paths, max_interactions, 3] where n_paths is the number of rays for this user |
required |
inter
|
ndarray
|
Interaction types with shape [n_paths,] where each path's value contains digits representing interaction types (e.g., 211 means type 2 for first bounce, type 1 for second and third) |
required |
figsize
|
tuple
|
Figure size in inches. Defaults to (10,8). |
(10, 8)
|
dpi
|
int
|
Resolution in dots per inch. Defaults to 300. |
100
|
proj_3d
|
bool
|
Whether to create 3D projection. Defaults to True. |
True
|
color_by_type
|
bool
|
Whether to color interaction points by their type. Defaults to False. |
True
|
inter_objects
|
Optional[ndarray]
|
Object ids at each interaction point. Defaults to None. If provided, will color the interaction points by the object id, and ignore the interaction type. |
None
|
inter_obj_labels
|
Optional[list[str]]
|
Labels for the interaction objects. Defaults to None. If provided, will use these labels instead of the object ids. |
None
|
color_rays_by_pwr
|
bool
|
Whether to color rays by their power. Defaults to False. |
False
|
powers
|
Optional[ndarray]
|
Power values for each path. Required if color_rays_by_pwr is True. |
None
|
show_cbar
|
bool
|
Whether to show the colorbar. Defaults to False. |
False
|
limits
|
Optional[tuple[float, float]]
|
Power limits for coloring (min, max). If None, uses relative scaling. |
None
|
ax
|
Optional[Axes]
|
Matplotlib Axes object. Defaults to None. When provided, the figure and axes are not created. |
None
|
**kwargs
|
Any
|
Additional keyword-only options; accepts |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Tuple containing: |
Axes
|
|
tuple[Figure, Axes]
|
|