tedana.selection.selection_utils.kappa_elbow_kundu

kappa_elbow_kundu(component_table, n_echos, comps2use=None)[source]

Calculate an elbow for kappa.

Uses the approach originally in Prantik Kundu’s MEICA v2.5 code.

Parameters:
  • component_table ((C x M) pandas.DataFrame) – Component metric table. One row for each component, with a column for each metric. The index should be the component number. Only the ‘kappa’ column is used in this function

  • n_echos (int) – The number of echos in the multi-echo data

  • comps2use (list[int]) – A list of component indices used to calculate the elbow default=None which means use all components

Returns:

  • kappa_elbow (float) – The ‘elbow’ value for kappa values, above which components are considered more likely to contain T2* weighted signals. minimum of kappa_allcomps_elbow and kappa_nonsig_elbow

  • kappa_allcomps_elbow (float) – The elbow for kappa values using all components in comps2use

  • kappa_nonsig_elbow (float) – The elbow for kappa values excluding kappa values above a threshold None if there are fewer than 6 values remaining after thresholding

  • varex_upper_p (float) – This is the median “variance explained” across components with kappa values greater than the kappa_elbow calculated using all components

Note

The kappa elbow calculation in Kundu’s original meica code calculates one elbow using all components’ kappa values, one elbow excluding kappa values above a threshold, and then selects the lower of the two thresholds. This is replicated by setting comps2use to None or by giving a list that includes all component numbers. If comps2use includes indices for only a subset of components then the kappa values from just those components will be used for both elbow calculations.

varex_upper_p isn’t used for anything in this function, but it is calculated on kappa values and is used in rho_elbow_kundu_liberal. For several reasons it made more sense to calculate here.