AFL.automation.shared.DatasetWidget#

Classes

DatasetWidget(dataset[, sample_dim, ...])

DatasetWidget_Model(dataset, sample_dim)

DatasetWidget_View([...])

defaultdict

defaultdict(default_factory=None, /, [...]) --> dict with default factory

class AFL.automation.shared.DatasetWidget.DatasetWidget(dataset: Dataset, sample_dim: str = 'sample', scatt_variables: List[str] | None = None, comps_variable: str | None = None, comps_color_variable: str | None = None, xmin: float = 0.001, xmax: float = 1.0)[source]#
__init__(dataset: Dataset, sample_dim: str = 'sample', scatt_variables: List[str] | None = None, comps_variable: str | None = None, comps_color_variable: str | None = None, xmin: float = 0.001, xmax: float = 1.0)[source]#

Interactive widget for viewing compositionally varying scattering data

Parameters:
  • dataset (xr.Dataset) – xarray.Dataset containing scattering data and compositions to be plotted.

  • sample_dim (str) – The name of the xarray dimension corresponding to sample variation, typically “sample”

  • comps_variable (Optional[str]) –

    The name of the xarray variable to plot as compositional data. Optional, if not specified, can be customized in the GUI.

    Only the first two columns of the data will be used in the plot. If the compositions are in separate `xarray.DataArray`s, they should be grouped into single `xarray.DataArray`s like so:

    `python ds['comps'] = ds[['A','B','C']].to_array('component').transpose(...,'component') `

  • comps_color_variable (Optional[str]) – The name of the xarray variable to use as the colorscale of the compositional data scatter plot. Optional, if not specified, can be customized in the GUI.

  • xmin (float) – Set the default q-range of the scattering data. Can be customized in the GUI

  • xmax (float) – Set the default q-range of the scattering data. Can be customized in the GUI

  • Usage

  • -----

  • ```python

  • DatasetWidget(ds) (widget =)

  • widget.run()

  • ```

next_button_callback(*args)[source]#
prev_button_callback(*args)[source]#
goto_callback(*args)[source]#
composition_click_callback(figure, location, click)[source]#
update_composition_plot()[source]#
update_scattering_plot()[source]#
update_plots()[source]#
get_comps()[source]#
initialize_plots(*args)[source]#
update_colors(*args)[source]#
apply_sel(*args)[source]#
apply_isel(*args)[source]#
extract_var(*args)[source]#
combine_vars(*args)[source]#
reset_dataset(*args)[source]#
update_dropdowns(*args)[source]#
update_sample_dim(*args)[source]#
update_extract_coords(change)[source]#
run()[source]#
class AFL.automation.shared.DatasetWidget.DatasetWidget_Model(dataset: Dataset, sample_dim: str)[source]#
__init__(dataset: Dataset, sample_dim: str)[source]#
property dataset#
reset_dataset()[source]#
split_vars()[source]#

Heuristically try to split vars into categories

get_non_sample_dims(var: str)[source]#
apply_sel(kw)[source]#
apply_isel(kw)[source]#
combine_vars(combined_var: str, to_combine_vars: List[str])[source]#
extract_var(extract_from_var: str, extract_from_coord: str)[source]#
get_composition(variable)[source]#
get_scattering(variable, index)[source]#
class AFL.automation.shared.DatasetWidget.DatasetWidget_View(initial_scatt_variables: List[str] | None = None, initial_comps_variable: str | None = None, initial_comps_color_variable: str | None = None)[source]#
__init__(initial_scatt_variables: List[str] | None = None, initial_comps_variable: str | None = None, initial_comps_color_variable: str | None = None)[source]#
update_colorscale(colors=None)[source]#
update_selected(**kw)[source]#
update_dropdowns(sample_vars=None, scatt_vars=None, comp_vars=None)[source]#
plot_sas(x, y, name='SAS', append=False)[source]#
plot_comp(x, y, z=None, xname='x', yname='y', zname='z', colors=None)[source]#
init_plots()[source]#
init_buttons()[source]#
init_checkboxes()[source]#
init_dropdowns()[source]#
init_inputs()[source]#
run()[source]#