Performance plotting utilities

API reference

doatools.plotting.plot_performance.get_global_config()[source]

Gets the global configuration dictionary.

Returns:

The global configuration dictionary, which can be modified directly to globally change plotting styles.

Return type:

dict

doatools.plotting.plot_performance.set_doa_method_style(method_name, color=None, marker=None)[source]

Sets the style for a specific DOA estimation method.

Parameters:
  • method_name (str) – Name of the DOA estimation method.

  • color (str, optional) – Color string, e.g., ‘b’, ‘g’, ‘r’.

  • marker (str, optional) – Marker string, e.g., ‘x’, ‘o’, ‘s’.

doatools.plotting.plot_performance.get_doa_method_style(method_name, index=0)[source]

Gets the style for a specific DOA estimation method.

Parameters:
  • method_name (str) – Name of the DOA estimation method.

  • index (int, optional) – Index used to get style from default lists when the method name is not in the configuration. Default value is 0.

Returns:

(color, marker) tuple.

Return type:

tuple

doatools.plotting.plot_performance.plot_metric_vs_parameter(parameter_values: ndarray, results: Dict[str, ndarray], parameter_name: str, metric_name: str, parameter_unit: str = '', metric_unit: str = '', show_crb: bool = False, crb_values: ndarray | None = None, crb_label: str = 'CRB', ax: Axes | None = None)[source]

Plots a line graph of metric values versus parameter values.

Parameters:
  • parameter_values (np.ndarray) – Array of parameter values.

  • results (Dict[str, np.ndarray]) – Dictionary of metric results for different algorithms, where keys are algorithm names and values are corresponding metric value arrays.

  • parameter_name (str) – Parameter name, used for the x-axis label.

  • metric_name (str) – Metric name, used for the y-axis label and legend.

  • parameter_unit (str, optional) – Parameter unit, used for the x-axis label. Default is an empty string.

  • metric_unit (str, optional) – Metric unit, used for the y-axis label. Default is an empty string.

  • show_crb (bool, optional) – Whether to show the CRB curve. Default value is False.

  • crb_values (Optional[np.ndarray], optional) – Array of CRB values. Default value is None.

  • crb_label (str, optional) – Legend label for the CRB curve. Default value is ‘CRB’.

  • ax (Optional[plt.Axes], optional) – Externally provided matplotlib axes object. If None, a new figure will be created. Default value is None.

doatools.plotting.plot_performance.plot_scatter_estimates(true_angles: ndarray, estimates: ndarray, algorithm_name: str, angle_unit: str = 'rad', ax: Axes | None = None)[source]

Plots a scatter plot of true angles versus estimated angles.

Parameters:
  • true_angles (np.ndarray) – Array of true angles, with shape (n_monte_carlo, n_sources) or (n_sources,).

  • estimates (np.ndarray) – Array of estimated angles, with shape (n_monte_carlo, n_sources).

  • algorithm_name (str) – Algorithm name, used for the title.

  • angle_unit (str, optional) – Angle unit, ‘rad’ or ‘deg’. Default value is ‘rad’.

  • ax (Optional[plt.Axes], optional) – Externally provided matplotlib axes object. If None, a new figure will be created. Default value is None.

doatools.plotting.plot_performance.plot_cdf(estimates: ndarray | Dict[str, ndarray], true_angles: ndarray, algorithm_name: str | None = None, metric_name: str = 'Error', metric_unit: str = 'rad', metric_type: str = 'absolute', ax: Axes | None = None)[source]

Plots the CDF (Cumulative Distribution Function) of estimation errors.

Supports two modes: 1. Single algorithm mode: Plots the CDF for a single algorithm 2. Multi-algorithm comparison mode: Plots CDF comparisons for multiple algorithms

Parameters:
  • estimates (Union[np.ndarray, Dict[str, np.ndarray]]) –

    • Single algorithm: Array of estimated angles with shape (n_monte_carlo, n_sources).

    • Multi-algorithm comparison: Dictionary where keys are algorithm names and values are corresponding estimated angle arrays.

  • true_angles (np.ndarray) – Array of true angles with shape (n_monte_carlo, n_sources) or (n_sources,).

  • algorithm_name (Union[str, None], optional) –

    • Single algorithm: Algorithm name, used for the title and legend.

    • Multi-algorithm comparison: None, this parameter is ignored.

    Default value is None.

  • metric_name (str, optional) – Error metric name, used for the x-axis label. Default value is ‘Error’.

  • metric_unit (str, optional) – Error unit, used for the x-axis label. Default value is ‘rad’.

  • metric_type (str, optional) – Error type, with options: - ‘absolute’: Absolute error - ‘rms’: Root Mean Square error - ‘mae’: Mean Absolute Error Default value is ‘absolute’.

  • ax (Optional[plt.Axes], optional) – Externally provided matplotlib axes object. If None, a new figure will be created. Default value is None.