extract_spaxel_info_mc

threadcount.fit.extract_spaxel_info_mc(mc_fits, fit_info, model_params, method='median', names_only=False)[source]

Compute the average and standard deviation of the information requested.

This function takes as input a list of monte carlo iterations of a ModelResult and returns the average of the fit_info, and average and standard deviation of the model_params, using method “median” or “mean”, provided by method.

For models which have multiple gaussian components, this function also incorporates a re-ordering of components (see threadcount.lmfit_ext.order_gauss()) with the idea that we would like to average similar components together.

It is advisable to also have this function compute the names array for you, using names_only =True, since the entries in fit_info and model_params will have strings added to the beginning and end.

Parameters:
  • mc_fits (list of lmfit.model.ModelResult) – List of fits to extract and average parameters from.

  • fit_info (list of string) – Options here include things like “chisqr”,”aic_real”, “success”, any attribute that will return a float from ModelResult.attribute

  • model_params (list of string) – The list of the model parameter names (don’t include “_err”, that will be added for you.) For example, you could compute this from model.make_params().keys()

  • method (str, optional) – either “mean” or “median”, by default “median”. The function used to caluclate the average. This will always be “mean” for the “success” info.

  • names_only (bool, optional) – Return a list of the “column names” instead of computing the averages, by default False

Returns:

A list of the extracted and averaged information.

Return type:

numpy array of floats, or list of string (in case names_only is True)

Raises:

ValueError – If method is not “median” or “mean”.