ModelFitting
- class jdaviz.configs.default.plugins.model_fitting.model_fitting.ModelFitting(*args, **kwargs)[source] [edit on github]
Bases:
PluginTemplateMixin
,DatasetSelectMixin
,SpectralSubsetSelectMixin
,DatasetSpectralSubsetValidMixin
,AddResultsMixin
,TableMixin
See the Model Fitting Plugin Documentation for more details.
Only the following attributes and methods are available through the public plugin API:
dataset
(DatasetSelect
): Dataset to fit the model.spatial_subset
(SubsetSelect
): Only exposed for Cubeviz. Spatially collapsed spectrum to use to fit the model.spectral_subset
(SubsetSelect
)model_component
(SelectPluginComponent
)poly_order
model_component_label
(AutoTextField
)equation
(AutoTextField
)cube_fit
Only exposed for Cubeviz. Whether to fit the model to the cube instead of to the collapsed spectrum.add_results
(AddResults
)residuals_calculate
(bool) Whether to calculate and expose the residuals (model minus data).residuals
(AutoTextField
) Label of the residuals to apply when callingcalculate_fit()
ifresiduals_calculate
isTrue
.
Public constructor
Attributes Summary
A trait for unicode strings.
A boolean (True, False) trait.
A trait for unicode strings.
A trait for unicode strings.
An instance of a Python list.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
List of the labels of model components in the current equation
A boolean (True, False) trait.
An instance of a Python list.
A trait for unicode strings.
List of the labels of existing model components
A trait for unicode strings.
A boolean (True, False) trait.
A trait for unicode strings.
A trait for unicode strings.
Mixin to handle empty integer field.
A boolean (True, False) trait.
A trait for unicode strings.
A boolean (True, False) trait.
A trait for unicode strings.
A trait for unicode strings.
An instance of a Python list.
A trait for unicode strings.
Methods Summary
calculate_fit
([add_data])Calculate the fit.
create_model_component
([model_component, ...])Add a new model component to the list of available model components
get_model_component
(model_component_label[, ...])Get a (read-only) dictionary representation of an existing model component.
reestimate_model_parameters
([...])Re-estimate all free parameters in a given model component given the currently selected data and subset selections.
remove_model_component
(model_component_label)Remove an existing model component.
set_model_component
(model_component_label, ...)Set the value or fixed attribute of a parameter in an existing model component.
vue_add_model
(event)vue_apply
(event)vue_remove_model
(event)Attributes Documentation
- comp_label
A trait for unicode strings.
- comp_label_auto
A boolean (True, False) trait.
- comp_label_default
A trait for unicode strings.
- comp_label_invalid_msg
A trait for unicode strings.
- component_models
An instance of a Python list.
- cube_fit
A boolean (True, False) trait.
- dialog
A boolean (True, False) trait.
- display_order
A boolean (True, False) trait.
- eq_error
A boolean (True, False) trait.
- equation_components
List of the labels of model components in the current equation
- form_valid_model_component
A boolean (True, False) trait.
- model_comp_items
An instance of a Python list.
- model_comp_selected
A trait for unicode strings.
- model_components
List of the labels of existing model components
- model_equation
A trait for unicode strings.
- model_equation_auto
A boolean (True, False) trait.
- model_equation_default
A trait for unicode strings.
- model_equation_invalid_msg
A trait for unicode strings.
- poly_order
Mixin to handle empty integer field.
- residuals_calculate
A boolean (True, False) trait.
- residuals_label
A trait for unicode strings.
- residuals_label_auto
A boolean (True, False) trait.
- residuals_label_default
A trait for unicode strings.
- residuals_label_invalid_msg
A trait for unicode strings.
- spatial_subset_items
An instance of a Python list.
- spatial_subset_selected
A trait for unicode strings.
- template_file = ('/home/docs/checkouts/readthedocs.org/user_builds/jdaviz/envs/v3.5.0/lib/python3.9/site-packages/jdaviz/configs/default/plugins/model_fitting/model_fitting.py', 'model_fitting.vue')
- user_api
Methods Documentation
- calculate_fit(add_data=True)[source] [edit on github]
Calculate the fit.
- Parameters:
- add_databool
Whether to add the resulting spectrum/cube to the app as a data entry according to
add_results
.
- Returns:
- fitted model
- fitted spectrum/cube
- residuals (if
residuals_calculate
is set toTrue
)
- create_model_component(model_component=None, model_component_label=None, poly_order=None)[source] [edit on github]
Add a new model component to the list of available model components
- Parameters:
- model_componentstr
Type of model component to add. If not provided, will default according to
model_component
.- model_component_labelstr
Name of the model component to add. If not provided, will default according to
model_component_label
(ifmodel_component_label.auto
is True andmodel_component
is passed as an argument, then the default label will be recomputed rather than applying the current value).- poly_orderint
Order of the polynomial if
model_component
is (or defaults to) “Polynomial1D”. Will raise an error if provided andmodel_component
is not “Polynomial1D”. If not provided, will default according topoly_order
.
- get_model_component(model_component_label, parameter=None)[source] [edit on github]
Get a (read-only) dictionary representation of an existing model component.
- Parameters:
- model_component_labelstr
The label given to the existing model component
- parameterstr
Optional. The name of a valid parameter in the model component, in which case only the information on that parameter is returned.
- reestimate_model_parameters(model_component_label=None)[source] [edit on github]
Re-estimate all free parameters in a given model component given the currently selected data and subset selections.
- Parameters:
- model_component_labelstr or None.
The label given to the existing model component. If None, will iterate over all model components.
- remove_model_component(model_component_label)[source] [edit on github]
Remove an existing model component.
- Parameters:
- model_component_labelstr
The label given to the existing model component
- set_model_component(model_component_label, parameter, value=None, fixed=None)[source] [edit on github]
Set the value or fixed attribute of a parameter in an existing model component.
- Parameters:
- model_component_labelstr
The label given to the existing model component
- parameterstr
The name of a valid parameter in the model component.
- valuefloat
Optional. The new initial value of the parameter. If not provided or None, will remain unchanged.
- fixedbool
Optional. The new state of the fixed attribute of the parameter. If not provided or None, will remain unchanged.
- Returns:
- updated dictionary of the parameter representation
- vue_add_model(event)[source] [edit on github]
- vue_apply(event)[source] [edit on github]
- vue_reestimate_model_parameters(model_component_label=None, **kwargs)[source] [edit on github]
- vue_remove_model(event)[source] [edit on github]