mdse.visualizeDB.vis_plots

Functions

doping_plot(plot_name, plot_data, sim_data)

Generates a figure with five subplots for doping formation energies.

get_defect_cat(defect_name)

Parses a defect name to determine its category and element.

get_label_name(property)

Gets a display-friendly label for a given property key.

heatmap_plot(plot_name, plot_data, sim_data)

Generates heatmaps for double defect formation energies.

plot_avg(axial, x_pos, y_values)

Plots a marker for the average of a set of y-values on a given axis.

scatter_plot(plot_name, plot_data, sim_data)

Generates a scatter plot from simulation data.

single_defect_plot(plot_name, plot_data, ...)

Generates a figure with four subplots for single defect formation energies.

sub_sub_plot(plot_name, plot_data, sim_data)

The heatmap is not too informative for diagonal (sub-sub).

symmetrize(df)

Makes a DataFrame symmetric by combining it with its transpose.

mdse.visualizeDB.vis_plots.doping_plot(plot_name, plot_data, sim_data)

Generates a figure with five subplots for doping formation energies.

The figure shows formation energy vs. doping element, organized by rows of the periodic table across five subplots. Each point represents a simulation, with its color determined by the ‘avg_a’ property.

Parameters:
  • plot_name (str) – The base name for the output plot file.

  • plot_data (dict) – A dictionary containing plot configuration, such as ‘average’ to plot mean values or ‘fix_y’ to set y-axis limits.

  • sim_data (list[dict]) – A list of simulation result dictionaries, where each dictionary must contain ‘doping’, ‘formation_energy’, and ‘avg_a’ keys.

Raises:

ValueError – If required keys are missing from any simulation data entry.

mdse.visualizeDB.vis_plots.get_defect_cat(defect_name)

Parses a defect name to determine its category and element.

Examples

  • “Int_Na” -> (“interstitial”, “Na”)

  • “Na_C” -> (“substitution”, “Na”)

  • “Vac_C” -> (“vacancy”, “C”)

Parameters:

defect_name (str) – The defect name string.

Returns:

A tuple containing the defect category and the associated element, or the string “BAD defect” if parsing fails.

Return type:

tuple[str, str] or str

mdse.visualizeDB.vis_plots.get_label_name(property)

Gets a display-friendly label for a given property key.

Parameters:

property (str) – The property key from the configuration (e.g., “MSD”).

Returns:

Human-readable label for use in plots (e.g., “Means square displacement”).

Return type:

str

Raises:

ValueError – If no label is defined for the given property.

mdse.visualizeDB.vis_plots.heatmap_plot(plot_name, plot_data, sim_data)

Generates heatmaps for double defect formation energies.

This function can generate two types of heatmaps based on the configuration:

  1. A combined heatmap for substitution-substitution (upper triangle) and interstitial-interstitial (lower triangle) defects. This also produces bar plots for the diagonal values.

  2. A single heatmap for substitution-interstitial defects.

Parameters:
  • plot_name (str) – The base name for the output plot file.

  • plot_data (dict) – A dictionary containing plot configuration, specifying the properties for the ‘x’ and ‘y’ axes of the heatmap.

  • sim_data (list[dict]) – A list of simulation result dictionaries containing double defect data.

mdse.visualizeDB.vis_plots.plot_avg(axial, x_pos, y_values)

Plots a marker for the average of a set of y-values on a given axis.

This helper function calculates the mean of y_values and plots it as a distinctive square marker on the provided matplotlib axis.

Parameters:
  • axial (plt.Axes) – The matplotlib Axes object on which to plot.

  • x_pos (int or float) – The x-coordinate for the average marker.

  • y_values (list[float]) – A list of numerical values to average.

Returns:

The calculated average of y_values.

Return type:

float

mdse.visualizeDB.vis_plots.scatter_plot(plot_name, plot_data, sim_data)

Generates a scatter plot from simulation data.

This function creates a scatter plot where the x and y axes are determined by properties specified in plot_data. An optional third property can be used for color-coding the points (z-axis).

Parameters:
  • plot_name (str) – The base name for the output plot file.

  • plot_data (dict) – A dictionary containing plot configuration, requiring ‘x’ and ‘y’ keys for the axes, and an optional ‘z’ key for color.

  • sim_data (list[dict]) – A list of simulation result dictionaries.

Raises:

ValueError – If required properties are missing from plot_data or if property values are missing from sim_data.

mdse.visualizeDB.vis_plots.single_defect_plot(plot_name, plot_data, sim_data)

Generates a figure with four subplots for single defect formation energies.

The figure consists of four scatter plots organized by defect type:

  1. Interstitial defects.

  2. Interstitial defects paired with a vacancy.

  3. Substitutional defects.

  4. Substitutional defects paired with a vacancy.

Each subplot shows formation energy vs. element. Points are colored by the ‘avg_a’ property.

Parameters:
  • plot_name (str) – The base name for the output plot file.

  • plot_data (dict) – A dictionary containing plot configuration, such as ‘average’ to plot mean values or ‘fix_y’ to set y-axis limits.

  • sim_data (list[dict]) – A list of simulation result dictionaries.

mdse.visualizeDB.vis_plots.sub_sub_plot(plot_name, plot_data, sim_data)

The heatmap is not too informative for diagonal (sub-sub). This investigates furhter, by seperating into spins

mdse.visualizeDB.vis_plots.symmetrize(df)

Makes a DataFrame symmetric by combining it with its transpose.

For a matrix M, this computes M.combine_first(M.T), which fills NaN values in M with corresponding values from M.T.

Parameters:

df (pd.DataFrame) – The input DataFrame, typically the upper or lower triangle of a matrix.

Returns:

A symmetric DataFrame.

Return type:

pd.DataFrame