interactive_user_choice

threadcount.fit.interactive_user_choice(fits, choices, user_check, baseline_fits=None)[source]

Choose best model from a display of all model fits to a pixel.

This function goes through each spaxel flagged for user verification (via user_check parameter). It displays a figure showing all fit options, highlighting in yellow which fit option the aic algorithm has auto-chosen via choose_model_aic() (the choices parameter).

The user is then prompted in the console to enter the number corresponding to the fit they would like to choose, usually a number 1-3. Pressing “enter” without inputting a number will keep the default choice.

At any point, the user may cancel further interaction by entering ‘x’ instead of the number 1-3, and the remaining pixels will be set to the auto chosen value (given by choices parameter).

Beware: For an example of 3 fits to choose from, any input that is not 1, 2, 3, or x will keep the default choice and move on to the next pixel, without verification or warning.

Parameters:
  • fits (numpy array of lmfit.model.ModelResult) – array of shape e.g. (3,n,m) for 3 models for spatial shape (n,m)

  • choices (numpy array of int) – array of shape (n,m) containing which model, starting with 1, is the automatic choice made by the aic algorithm choose_model_aic(). A pixel value of -1 indicates invalid fits.

  • user_check (numpy array of bool) – array of shape (n,m) indicating if this procedure should be run on that pixel.

Returns:

array of shape (n,m) contining all the choices, including any changes made by the user during this procedure.

Return type:

numpy array of int