plot_data_model_residual#

torusimaging.plot.plot_data_model_residual(binned_data, model, params_fit, params_init=None, smooth_residual=None, vlim_residual=None, residual_normalization=None, usys=None, pos_label='pos', vel_label='vel', x_coord='vel')#

Make a 4 panel figure showing data (number counts of stars in z-vz), initial model, fitted model, and residual of the fitted model

Parameters:
  • binned_data (dict[str, Union[Quantity, _Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], complex, bytes, str, _NestedSequence[complex | bytes | str]]]) – The binned data dictionary.

  • model (TorusImaging1D) – The model instance.

  • params_fit (dict) – The optimized parameters, or the MAP parameters, or the parameters you would like to show.

  • params_init (dict | None) – The initial parameters. If specified, will plot the initial model as well.

  • smooth_residual (float | None) – If specified (as a float), smooth the residual image by a Gaussian with kernel with set by this parameter.

  • vlim_residual (float | None) – The vmin, vmax for the residual colormap are set using this value such that vmin=-vlim_residual and vmax=vlim_residual.

  • residual_normalization (Union[_Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], complex, bytes, str, _NestedSequence[complex | bytes | str], None]) – If specified, the residual is divided by this value. This is useful for plotting fractional residuals.

  • usys (UnitSystem | None) – The unit system to use for plotting. If None, will use the unit system of the model.

  • pos_label (str) – The label for the position coordinate. Default is “pos”.

  • vel_label (str) – The label for the velocity coordinate. Default is “vel”.

  • x_coord (str) – Which coordinate to plot on the x-axis, either “vel” or “pos”. Default is “vel”.

Return type:

tuple[Figure, Axes]