plot_itd

hrtfpykit.plots.plot_itd(hrtf, plane_angle=0.0, azimuth_range_mode='0-360', show=True, show_titles=True, show_labels=True, show_legends=True)

Plot signed ITD over a horizontal plane.

plot_itd calls itd() as itd(hrtf, method="threshold", output="time", thresh_level=-10.0, upper_cut_freq=3000.0, filter_order=10, absolute=False) using the current hrtf.IR data. It then selects the nearest measured horizontal plane from hrtf.Sources, sorts the selected sources by azimuth, and plots signed ITD in microseconds.

Positive signed ITD follows the convention of itd(): the left ear is delayed relative to the right ear. 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-360 follows the SOFA anticlockwise

  • convention (front is 0 degrees, listener left is 90 degrees, back is 180) – degrees, and listener right is 270 degrees. -180-180 wraps 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 ITD curve.

Return type:

matplotlib.figure.Figure

Raises:

ValueError – If IR data or sample rate is missing, plane_angle is invalid, the azimuth range is invalid, the selected horizontal plane is empty, or the ITD 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. In azimuth_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 ITD around the horizontal plane:

>>> from hrtfpykit.hrtf import load_hrtf
>>> from hrtfpykit.plots import plot_itd
>>> hrtf = load_hrtf("P0001_FreeFieldComp_44kHz.sofa")
>>> plot_itd(hrtf, plane_angle=0.0)