Skip to content

Note

Click here to download the full example code

Geometric Operations#

Sound events are naturally spatial object defined by their location in both time and frequency. The soundevent's geometry module provides tools to manipulate the geometry of the sound events, facilitating the analysis of acoustic data.

Usage details

To use the soundevent.geometry module you need to install some additional dependencies. You can do this by running the following command:

pip install soundevent[geometry]

Understanding Geometric Operations#

Geometric operations provide essential tools to conduct sound event analysis:

  1. Buffering: Expand sound event boundaries, accommodating uncertainties inherent in annotations.
  2. Clipping: Remove unwanted sections.
  3. Spatial Relationships: Determine overlaps, containment, and distances between sound events, aiding in comparative analysis.

Here we will explore the geometric operations that can be applied to sound events and how they can be used to analyze and compare sound events.

from soundevent import data, geometry

geom = data.Polygon(coordinates=[[[1, 2], [4, 3], [5, 6], [1, 2]]])
geom
1.00
5.00
2
6
POLYGON ((0.25 0.5, 1 0.75, 1.25 1.5, 0.25 0.5))
buffered = geometry.buffer_geometry(geom, time_buffer=1, freq_buffer=0.5)
buffered
0.00
6.79
1
8
POLYGON ((0 0.1449628471538281, 0 0.2880963635219792, 0.9273687952358558 1.144962847153828, 1 1.1340513875370795, 0.7235737572896033 0.3678177689649299, 0 0.1449628471538281))

Datasets#

Total running time of the script: ( 0 minutes 0.353 seconds) Estimated memory usage: 26 MB

Download Python source code: 4_geometric_operations.py

Download Jupyter notebook: 4_geometric_operations.ipynb

Gallery generated by mkdocs-gallery