plot_ModelResults_pixel

threadcount.fit.plot_ModelResults_pixel(fitList, title='', computer_choice=None, user_checked=None, user_choice=None)[source]

Create a multipanel figure comparing fits to the same data.

This function will call lmfit.model.ModelResult.plot_residuals() and lmfit.model.ModelResult.plot_fit() for each fit in fitList.

The background of the computer_choice fit is highlighted in lightyellow. The background of the user_choice is highlighted in azure. In cases where user_choice is the same as computer_choice, the background is azure.

Additional fit information is added as a text box to each plot. This information consists of:

  • Fit statistics:

    • \(\chi^2\) - chi-square

    • \(\chi_\nu^2\) - reduced chi-square

    • \(\Delta aic_{{n,n-1}}\) - The Akaike info criterion for this panel (n) - the AIC for the previous panel (n-1). For the first panel, there exists no previous panel so I set \(\Delta aic_{{n,n-1}}\) = 0, even though it should probably be ‘n/a’.

  • Information about relative gaussian parameters for models containing more than 1 gaussian. The component with the highest flux is defined as component 0.

    • \(flux_n/flux_0\) - ratio of component n flux to component 0 flux.

    • \(\Delta\mu_n\) - the x center of component n minus the x center of componenet 0.

Note that each component is plotted as the fitted constant + gaussian component. This allows for easier visual comparison of the contributions of the shape of each gaussian component.

Parameters:
  • fitList (list of lmfit.model.ModelResult) – A list of fits of different models to the same data set.

  • title (str, optional) – The figure’s suptitle, by default “”. The function will append to title “auto choice _”, and if the user has checked the fits, “user choice _” is also appended.

  • computer_choice (int, optional) – The automatic choice, usually by choose_model_aic(), by default None. If None, choose_model_aic() will be called.

  • user_checked (bool, optional) – If True, indicates this pixel was checked by the user, by default None. This is often the output for this spaxel’s marginal_fits()

  • user_choice (int, optional) – The fit chosen by the user, if any, by default None

Returns:

The figure instance.

Return type:

matplotlib.figure.Figure