shnitsel.vis.datasheet.datasheet_page#

Classes#

DatasheetPage

Class encapsulating the data generation and plotting of a single page of a datasheet.

Module Contents#

class DatasheetPage(data, state_selection=None, structure_selection=None, *, spectra_times=None, col_state=None, col_inter=None)#

Class encapsulating the data generation and plotting of a single page of a datasheet.

Involves plotting of inter-state graphs like spectra, statistics of energy deltas and transitional dipoles, histograms of per-state and inter-state properties, etc.

Parameters:
state_selection: shnitsel.filtering.state_selection.StateSelection#
state_selection_provided: bool = False#
structure_selection: shnitsel.filtering.structure_selection.StructureSelection | None = None#
structure_selection_provided: bool = False#
spectra_times: list[int | float] | numpy.ndarray | None = None#
charge: int = 0#
structure_skeletal: bool = False#
name: str = ''#
can#
_copy_data(old)#

Copy data from the other DataSheetPage into this entity’s fields.

Parmaeters#

oldSelf

The DataSheetPage to create a copy of.

Parameters:

old (Self)

property per_state: shnitsel.data.dataset_containers.PerState#

Get per-state data for the underlying dataset and cache it for repeated use.

Returns:

Per-state data of the self.frames object. (Energies, permanent dipoles)

Return type:

PerState

property inter_state: shnitsel.data.dataset_containers.InterState#

Inter-state (state-transition) data of the underlying self.frames object

Returns:

Inter-state properties of the underlying data. (delta_energies, transition dipoles, SOCs, NACs, fosc)

Return type:

InterState

property pops: shnitsel.analyze.populations.PopulationStatistics#

Population data for the underlying self.frames

Returns:

Population data encapsulated in an object holding absolute and relative population data

Return type:

PopulationStatistics

property delta_E: xarray.Dataset#

Energy deltas between different states in a dataset.

Returns:

Dataset holding ‘energy_interstate’ variable.

Return type:

xr.Dataset

property fosc_time: xarray.Dataset | None#

Strength of oscillator/transition rate between states at different points in time.

Returns:

Either the f_osc data (with confidence intervals) or None if not sufficient data in self.frames to calculate it.

Return type:

xr.Dataset | None

property spectra: shnitsel.core.typedefs.SpectraDictType#

Spectral statistics of the self.frames object.

Returns:

The spectral information per state transition

Return type:

SpectraDictType

property spectra_groups: tuple[shnitsel.core.typedefs.SpectraDictType, shnitsel.core.typedefs.SpectraDictType]#

Get different spectral groups for ground-state transitions and for excited-state transitions

Returns:

One spectral dict per ground-state or excited-state transitions.

Return type:

tuple[SpectraDictType, SpectraDictType]

property spectra_ground: shnitsel.core.typedefs.SpectraDictType#

Extracted spectral information of only the ground-state transitions

Returns:

Extracted spectral information of only the ground-state transitions

Return type:

SpectraDictType

property spectra_excited: shnitsel.core.typedefs.SpectraDictType#

Extracted spectral information of only the excited-state transitions

Returns:

Extracted spectral information of only the excited-state transitions

Return type:

SpectraDictType

property pca_full_data: shnitsel.analyze.pca.PCAResult#

Get full PCA result with PCA detailed info.

Returns:

The pairwise distance PCA results

Return type:

xr.DataArray

property pca_data: xarray.DataArray#

Noodle plot source data derived from principal component analysis (PCA) on the full data in self.frames using only pairwise distances.

Returns:

The pairwise distance PCA results

Return type:

xr.DataArray

property pca_info: sklearn.decomposition.PCA#

Detailed PCA decomposition information

Returns:

The sklearn.decomposition.PCA object containing all PCA information.

Return type:

sk_PCA

property pca_explanation: dict[str, str]#

Provide an explanation for the components of the PCA components.

Returns:

Result of the explanation process.

Return type:

dict[str, str]

property hops: xarray.DataArray#

The PCA plots at the hopping points

Returns:

PCA data at the hopping points

Return type:

xr.DataArray

property structure_atXYZ: shnitsel.core.typedefs.AtXYZ#

Structure/Position data in the first frame/timestep of the trajectory

Returns:

Positional data.

Return type:

AtXYZ

property mol: rdkit.Chem.Mol#

Property to get an rdkit Mol object from the structural data

Returns:

Molecule object representing the structure in the first frame

Return type:

rdkit.Chem.Mol

property mol_skeletal: rdkit.Chem.Mol#

Skeletal representation of the the rdkit.Chem.Mol representation of the structure

Returns:

Molecule object representing the skeletal structure (no H atoms) in the first frame

Return type:

rdkit.Chem.Mol

property smiles: str#

Smiles representation of the skeletal molecule structure.

Returns:

Smiles representation of the skeletal molecule structure

Return type:

str

property inchi: str#

InChI representation of the skeletal molecule structure.

Returns:

InChI representation of the skeletal molecule structure.

Return type:

str

calc_all()#

Helper method to allow for precalculation of all cached properties

plot_per_state_histograms(state_selection, fig=None, shape=None)#

Plot histograms of forces, energies and permanent dipoles for each selected state.

Parameters:
Returns:

The axes to which the histograms have been plotted with their assigned names.

Return type:

dict[str, Axes]

plot_timeplots(state_selection, fig=None)#

Create the Time plots of populations and energy level errors of each state for this DataSheetPage.

Parameters:
Returns:

The axes that have been plotted to

Return type:

Axes

plot_separated_spectra_and_hists(state_selection, fig=None, current_multiplicity=1)#
Parameters:
Return type:

dict[str, matplotlib.axes.Axes]

plot_separated_spectra_and_hists_groundstate(state_selection, fig=None, scmap=plt.get_cmap('turbo'))#
Parameters:
Return type:

dict[str, matplotlib.axes.Axes]

plot_nacs_histograms(state_selection, fig=None)#
Parameters:
Return type:

dict[str, matplotlib.axes.Axes]

plot_noodle(fig=None, state_selection=None)#
Parameters:
Return type:

matplotlib.axes.Axes

plot_energy_bands(state_selection, fig=None)#
Parameters:
Return type:

dict[str, matplotlib.axes.Axes]

plot_structure(fig=None, state_selection=None)#
Parameters:
Return type:

matplotlib.axes.Axes

plot_pca_structure(fig=None, state_selection=None)#
Parameters:
Return type:

matplotlib.axes.Axes

plot_coupling_page(figure, suplots, state_selection, simple_mode=False)#

Plot coupling and state-info data on an axes grid.

Either a plot of all state-coupling information or a matrix of plots with color-coded information of

Parameters:
  • figure (Figure | SubFigure) – Figure this is being plotted into. Used for some after-the fact manipulation like introducing

  • suplots (dict[StateCombination, Axes]) – Axes to plot the data of individual state combinations into.

  • state_selection (StateSelection) – The StateSelection object to limit the combinations to include

  • simple_mode (bool, optional) – Flag to determine whether we want full coupling plots (NACs, SOCs, dip_trans) or just color plots. Defaults to False meaning permitted and unpermitted transitions will be color-coded.

Returns:

The dict of axes after plotting to them

Return type:

dict[StateCombination, Axes]

render_meta_page()#

Helper function to output the entire meta overview page to a Shnitsel Tools datasheet.

Returns:

The pair of the entire figure and a dict of the subfigures involved in the meta-overview page.

Return type:

tuple[Figure, dict[str, SubFigure]]

static get_subfigures_main_page(include_per_state_hist=False, borders=False)#

Helper function to prepare a figure to hold all subfigures in this DatasheetPage

Parameters:
  • include_per_state_hist (bool, optional) – Flag whether per state histograms will be included. Defaults to False.

  • borders (bool, optional) – Flag whether figure borders should be drawn. Defaults to False.

Returns:

The overall figure and a dict to access individual subfigures by their name.

Return type:

tuple[Figure, dict[str, SubFigure]]

static get_subfigures_pca_page(borders=False)#

Helper function to prepare a figure to hold all subfigures in this DatasheetPage covering all PCA information.

Parameters:

borders (bool, default=False) – Flag whether figure borders should be drawn. Defaults to False.

Returns:

The overall figure and a dict to access individual subfigures by their name.

Return type:

tuple[Figure, dict[str, SubFigure]]

static get_subfigures_meta_page(borders=False)#

Helper function to prepare a figure to hold all subfigures in this DatasheetPage covering all Meta information.

Parameters:

borders (bool, default=False) – Flag whether figure borders should be drawn. Defaults to False.

Returns:

The overall figure and a dict to access individual subfigures by their name.

Return type:

tuple[Figure, dict[str, SubFigure]]

static get_subfigures_coupling_page(state_selection, borders=False)#

Helper function to prepare a figure to hold all state interaction figures.

Parameters:
Returns:

The overall figure and a dict to access individual subfigures by their name.

Return type:

tuple[Figure, dict[str, SubFigure]]

plot(include_per_state_hist=False, include_coupling_page=True, include_pca_page=False, include_meta_page=False, borders=False, consistent_lettering=True)#

Function to plot this Datasheet.

Will generate all subplots and calculate necessary data if it has not yet been generated.

Parameters:
  • include_per_state_hist (bool, optional) – Flag whether per-state histograms should be included. Defaults to False.

  • include_coupling_page (bool, optional) – Flag to create a full page with state-coupling plots. Defaults to True.

  • include_pca_page (bool, optional) – Flag to create a PCA analysis page with details on PCA results. Defaults to False.

  • include_meta_page (bool, optional) – Flag to add a page with meta-information about the trajectory data. Defaults to False

  • borders (bool, optional) – Flag whether the figure should have borders or not. Defaults to False.

  • consistent_lettering (bool, optional) – Flag whether consistent lettering should be used, i.e. whether the same plot should always have the same label letter. Defaults to True.

Returns:

  • Figure – The figure holding the entirety of plots in this Datasheet page.

  • list[Figure] – The list of figures holding the plots in this Datasheet page if there are multiple (depending on the configuration flags)

Return type:

matplotlib.figure.Figure | list[matplotlib.figure.Figure]

_test_subfigures(include_per_state_hist=False, borders=False)#

Helper method to test whether subfigures are successfully plotted

Parameters:
  • include_per_state_hist (bool, default=False) – Flag to include per-state histograms. Defaults to False.

  • borders (bool, default=False) – Whether the figures should have borders. Defaults to False.