plot_ild¶
- hrtfpykit.plots.plot_ild(hrtf, plane_angle=0.0, azimuth_range_mode='0-360', show=True, show_titles=True, show_labels=True, show_legends=True)¶
Plot signed broad band ILD over a horizontal plane.
plot_ildcallsild()asild(hrtf, mode="broad-band", epsilon=1e-12, absolute=False)using the currenthrtf.IRdata. It then selects the nearest measured horizontal plane fromhrtf.Sources, sorts the selected sources by azimuth, and plots signed ILD in dB.Positive signed ILD follows the convention of
ild(): the left ear level is greater than the right ear level.azimuth_range_mode="-180-180"reverses the displayed x axis so listener left appears on the left side of the figure.- Parameters:
plane_angle (float, default=0.0) – Target horizontal plane elevation used to select the horizontal plane. The nearest available elevation in the grid is used.
azimuth_range_mode ({
0-360,-180-180}, default=``0-360``) – Azimuth convention used on the x axis.0-360follows the SOFA anticlockwiseconvention (front is 0 degrees, listener left is 90 degrees, back is 180) – degrees, and listener right is 270 degrees.
-180-180wraps listener right to -90 degrees and reverses the displayed x axis so listener left appears visually left.show (bool, default=True) – If True, display the figure before returning.
show_titles (bool, default=True) – If False, suppress generated default figure titles.
show_labels (bool, default=True) – If False, suppress generated axis labels and colorbar labels.
show_legends (bool, default=True) – If False, suppress generated legends.
hrtf (HRTF)
- Returns:
Figure containing the signed broad band ILD curve.
- Return type:
matplotlib.figure.Figure
- Raises:
ValueError – If IR data is missing, plane_angle is invalid, the azimuth range is invalid, the selected horizontal plane is empty, or the ILD value count differs from the number of source positions.
Notes
In
azimuth_range_mode="0-360", the x axis follows the SOFA azimuth convention directly. Inazimuth_range_mode="-180-180", the x axis is displayed right to left numerically so +90 degrees, listener left, appears on the left side of the figure and -90 degrees, listener right, appears on the right side.Examples
Plot signed broad band ILD around the horizontal plane:
>>> from hrtfpykit.hrtf import load_hrtf >>> from hrtfpykit.plots import plot_ild >>> hrtf = load_hrtf("P0001_FreeFieldComp_44kHz.sofa") >>> plot_ild(hrtf, plane_angle=0.0)