Plotting microphone array coordinates

Plotting microphone array coordinates#

This notebook attempts to visualise some of the microphone array coordinates given inside audiblelight.arrays

Import dependencies#

[1]:
import plotly.graph_objects as go
import pandas as pd
from plotly.subplots import make_subplots

from audiblelight.micarrays import *

Create arrays#

We just define a list of our MicArray classes

[2]:
arrays = [
    AmbeoVR(),
    Eigenmike32(),
]

Visualise arrays#

These arrays can each be visualised nicely in a 3D space using plotly

[3]:
fig = make_subplots(
    rows=1,
    cols=2,
    specs=[
        [{"type": "scene"}, {"type": "scene"}],
    ],
    subplot_titles=[a.name for a in arrays]
)
fig.update_layout(
    width=720,
    height=500,
    autosize=False,
    margin=dict(
        l=10,
        r=10,
        b=10,
        t=10,
    ),
)
pass # called so we don't immediately show the plot
[4]:
for (mic_x, mic_y), mic_array in zip([(1, 1), (1, 2)], arrays):
    df = pd.DataFrame(mic_array.coordinates_cartesian, columns=["x", "y", "z"])
    fig.add_trace(
        go.Scatter3d(
            x=df["x"],
            y=df["y"],
            z=df["z"],
            mode="markers",
            name=mic_array.name,
            marker_size=5,
            hovertext=mic_array.capsule_names
        ),
        row=mic_x,
        col=mic_y
    )
[5]:
fig.show()