Visualization Layers
This module provides a system of layer classes that implement different visualization techniques for ISO plots. Each layer encapsulates a specific visualization method and knows how to render itself on a given context.
Layer-based visualization components for plotting.
This module provides a system of layer classes that implement different visualization techniques for ISO plots. Each layer encapsulates a specific visualization method and knows how to render itself on a given context.
CLASS | DESCRIPTION |
---|---|
DensityLayer |
Layer for rendering kernel density plots. |
Layer |
Base class for all visualization layers. |
SPIDensityLayer |
Layer for rendering simplified SPI plots with fewer contour levels. |
SPILayer |
Layer for rendering SPI plots. |
SPIScatterLayer |
Layer for rendering simplified SPI plots with fewer contour levels. |
SPISimpleLayer |
Layer for rendering simplified SPI plots with fewer contour levels. |
ScatterLayer |
Layer for rendering scatter plots. |
SimpleDensityLayer |
Layer for rendering simplified density plots with fewer contour levels. |
DensityLayer
DensityLayer(custom_data=None, *, param_model=DensityParams, include_outline=False, **params)
Bases: Layer
Layer for rendering kernel density plots.
Initialize a DensityLayer.
PARAMETER | DESCRIPTION |
---|---|
custom_data
|
Optional custom data for this specific layer
TYPE:
|
include_outline
|
Whether to include an outline around the density plot
TYPE:
|
**params
|
Parameters for the density plot
TYPE:
|
Source code in soundscapy/plotting/layers.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
Layer
Layer(custom_data=None, param_model=SeabornParams, **params)
Base class for all visualization layers.
A Layer encapsulates a specific visualization technique and its associated parameters. Layers know how to render themselves onto a PlotContext's axes.
ATTRIBUTE | DESCRIPTION |
---|---|
custom_data |
Optional custom data for this specific layer, overriding context data
TYPE:
|
params |
Parameter model instance for this layer
TYPE:
|
Initialize a Layer.
PARAMETER | DESCRIPTION |
---|---|
custom_data
|
Optional custom data for this specific layer, overriding context data
TYPE:
|
param_model
|
The parameter model class to use, if None uses a generic ParamModel
TYPE:
|
**params
|
Parameters for the layer
TYPE:
|
METHOD | DESCRIPTION |
---|---|
render |
Render this layer on the given context. |
Source code in soundscapy/plotting/layers.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
render
render(context)
Render this layer on the given context.
PARAMETER | DESCRIPTION |
---|---|
context
|
The context containing data and axes for rendering
TYPE:
|
Source code in soundscapy/plotting/layers.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
SPIDensityLayer
SPIDensityLayer()
Bases: SPILayer
, DensityLayer
Layer for rendering simplified SPI plots with fewer contour levels.
Initialize SPIDensityLayer.
This initialization is not supported and will raise NotImplementedError. Use SPISimpleLayer instead.
Source code in soundscapy/plotting/layers.py
686 687 688 689 690 691 692 693 694 695 696 697 |
|
SPILayer
SPILayer(spi_target_data=None, *, msn_params=None, n=10000, param_model=SPISeabornParams, **params)
Bases: Layer
Layer for rendering SPI plots.
Initialize an SPILayer.
PARAMETER | DESCRIPTION |
---|---|
spi_target_data
|
Pre-sampled data for SPI target distribution. When None, msn_params must be provided.
TYPE:
|
msn_params
|
Parameters to generate SPI data if no spi_target_data is provided
TYPE:
|
n
|
Number of samples to generate if using msn_params
TYPE:
|
param_model
|
The parameter model class to use
TYPE:
|
**params
|
Parameters for the layer. For compatibility with other layers, if 'custom_data' is present and spi_target_data is None, custom_data will be used as the SPI target data.
TYPE:
|
Notes
Either spi_target_data or msn_params must be provided, but not both. The test data for SPI calculations will be retrieved from the plot context.
METHOD | DESCRIPTION |
---|---|
render |
Render this layer on the given context. |
show_score |
Show the SPI score on the plot. |
Source code in soundscapy/plotting/layers.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
render
render(context)
Render this layer on the given context.
PARAMETER | DESCRIPTION |
---|---|
context
|
The context containing data and axes for rendering
TYPE:
|
Source code in soundscapy/plotting/layers.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
show_score
show_score(spi_sc, show_score, context, ax, axis_text_kwargs)
Show the SPI score on the plot.
PARAMETER | DESCRIPTION |
---|---|
spi_sc
|
The SPI score to show
TYPE:
|
show_score
|
Where to show the score
TYPE:
|
context
|
The context containing data and axes for rendering
TYPE:
|
ax
|
The axes to render the score on
TYPE:
|
axis_text_kwargs
|
Additional arguments for the axis text |
Source code in soundscapy/plotting/layers.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
|
SPIScatterLayer
SPIScatterLayer()
Bases: SPILayer
, ScatterLayer
Layer for rendering simplified SPI plots with fewer contour levels.
Initialize SPIScatterLayer.
This initialization is not supported and will raise NotImplementedError. Use SPISimpleLayer instead.
Source code in soundscapy/plotting/layers.py
703 704 705 706 707 708 709 710 711 712 713 714 |
|
SPISimpleLayer
SPISimpleLayer(spi_target_data=None, *, msn_params=None, include_outline=True, **params)
Bases: SPILayer
, SimpleDensityLayer
Layer for rendering simplified SPI plots with fewer contour levels.
Initialize an SPISimpleLayer.
PARAMETER | DESCRIPTION |
---|---|
custom_data
|
Optional custom data for this specific layer
TYPE:
|
msn_params
|
Parameters to generate SPI data if no custom data is provided
TYPE:
|
include_outline
|
Whether to include an outline around the density plot
TYPE:
|
**params
|
Parameters for the density plot
TYPE:
|
Source code in soundscapy/plotting/layers.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
|
ScatterLayer
ScatterLayer(custom_data=None, **params)
Bases: Layer
Layer for rendering scatter plots.
Initialize a ScatterLayer.
PARAMETER | DESCRIPTION |
---|---|
custom_data
|
Optional custom data for this specific layer
TYPE:
|
**params
|
Parameters for the scatter plot
TYPE:
|
Source code in soundscapy/plotting/layers.py
123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
SimpleDensityLayer
SimpleDensityLayer(custom_data=None, *, include_outline=True, param_model=SimpleDensityParams, **params)
Bases: DensityLayer
Layer for rendering simplified density plots with fewer contour levels.
Initialize a SimpleDensityLayer.
PARAMETER | DESCRIPTION |
---|---|
custom_data
|
Optional custom data for this specific layer
TYPE:
|
include_outline
|
Whether to include an outline around the density plot
TYPE:
|
**params
|
Parameters for the density plot
TYPE:
|
Source code in soundscapy/plotting/layers.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
show_submodules: true