FittingResults

class sofia_redux.visualization.display.fitting_results.FittingResults(parent: Any)[source]

Bases: QDialog, Ui_Dialog

Fitting results display widget.

After a curve has been fit to data in the Eye, a FittingResults window is opened to display the parameters of the fit and all subsequent fits. The window can also be used to remove the fit curves from the plots in the Eye.

Parameters:
parentView

Parent view widget for the dialog window.

Attributes:
model_fitslist

Feature fit parameters to display in the widget.

signalssofia_redux.visualization.signals.Signals

Custom signals to pass events to the controller, as needed.

table_headerlist

Column titles for table.

canvasmatplotlib.matplotlib.backends.backend_agg.FigureCanvasAgg

Matplotlib canvas for the most recent fit.

figmatplotlib.figure.Figure

Matplotlib figure for the most recent fit.

axmatplotlib.axes.Axes

Matplotlib axes for the most recent fit.

fit_colorstr

Color for the most recent fit plot.

Methods Summary

add_results(fit_params)

Add fit results to the table display.

change_units(units[, panes, return_new])

Change the units of fits.

clear_fit()

Clear the table widget display and reset fits stored.

format_parameters(kind)

Format the fit parameters for all loaded fits.

gather_models()

Return all loaded models with updated visibility.

hide_all_fits()

Set all fit visibilities to False

hide_fit(fit)

Set the fit visibility to False.

save_results()

Save current table to a CSV file.

update_colors(updates)

Update plot colors.

Methods Documentation

add_results(fit_params: List[ModelFit]) None[source]

Add fit results to the table display.

Parameters:
fit_paramslist of ModelFit

Updated fit parameters.

]
change_units(units: Dict[str, str], panes: List[PT] = None, return_new: bool | None = False) List[ModelFit] | None[source]

Change the units of fits.

The ‘axes’ parameter of each model fit loaded in model_fits is compared to the ‘axes’ of each Pane in panes to verify the model should be updated. The fit along with the current and desired units are passed to uc.convert_model_fit to perform the actual conversion. If the conversion fails (more common with changing flux units) then the model fit is left unchanged, but is hidden so it will not affect the autoscaling of the new Pane. The table widget is updated with the new units or visibility settings at the end.

Parameters:
unitsdict

The new units to apply. Keys are the axis directions ‘x’, ‘y’. Values are the string representations of the new unit, like ‘um’ or ‘Jy’.

paneslist, optional

List of Pane objects to apply the fit changes to. If not provided, all fits will be updated.

return_newbool, optional

If true, return the new fit parameters. Defaults to False.

Returns:
parameters: dict

Details of the new fit parameters.

clear_fit() None[source]

Clear the table widget display and reset fits stored.

format_parameters(kind: str) List[Any][source]

Format the fit parameters for all loaded fits.

Parameters:
kind{‘string’, ‘dict’, ‘list’, ‘html’}

Specify the desired structure for the parameters to be returned as. String formats all values for proper display in the table. Dict compiles the parameters for returns to other functions. Html returns the string format, additionally formatted for HTML display in the text view.

Returns:
paramslist

List of formatted fit parameters.

gather_models() List[ModelFit][source]

Return all loaded models with updated visibility.

Returns:
model_fitslist

Feature fit parameters to display in the widget.

hide_all_fits() None[source]

Set all fit visibilities to False

static hide_fit(fit: ModelFit) None[source]

Set the fit visibility to False.

save_results() None[source]

Save current table to a CSV file.

update_colors(updates)[source]

Update plot colors.

Parameters:
updatesdict

Color updates to apply. Must include ‘line’ kind, matching model ID and mid-model id, for the ‘color’ update to be applied.