pdyna.analysis module
pdyna.analysis: The collection of analysis functions for outputs and figures.
- pdyna.analysis.MO_correlation(cnsn, MDTimestep, SaveFigures, uniname)[source]
Calculate the self-correlation of molecular vectors.
- Parameters:
cnsn (numpy.ndarray) – Molecular vectors.
MDTimestep (float) – Molecular dynamics time step.
SaveFigures (bool) – Whether to save the figure.
uniname (str) – User-defined name for printing and figure saving.
- Returns:
Time and correlation values.
- Return type:
tuple
- pdyna.analysis.Tilt_correlation(T, MDTimestep, smoother=0)[source]
Compute time-correlation of tilting.
- Parameters:
T (numpy.ndarray) – Tilt data.
MDTimestep (float) – Time step in picoseconds.
smoother (int) – Smoothing window size.
- Returns:
delta-t and self-correlation values of tilting.
- Return type:
tuple
- pdyna.analysis.compute_tilt_density(T, method='auto', plot_fitting=False, corr_vals=None)[source]
Computes the tilt density from the given tilt angles.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
method (str) – The method for computing tilt density (‘auto’, ‘curve’, ‘kmean’, or ‘gaussian’).
plot_fitting (bool) – Whether to plot the fitted peaks, only for the Gaussian mode.
corr_vals (list) – NN1 Correlation values for the tilt angles.
- Returns:
The fitted tilt angles for each axis.
- Return type:
numpy.ndarray
- pdyna.analysis.compute_tilt_domain(Corr, timestep, uniname, saveFigures, n_bins=42, tol=0, smoother=5)[source]
Compute tilt domain lifetime.
- Parameters:
Corr (numpy.ndarray) – Correlation data.
timestep (float) – Time step in picoseconds.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
tol (float) – Tolerance for zero crossing.
smoother (int) – Smoothing window size.
- Returns:
None
- pdyna.analysis.defect_3D_scatter(peaks, uniname, deftype, saveFigures)[source]
Draw a 3D scatter plot of defects.
- Parameters:
peaks (numpy.ndarray) – Peaks data.
uniname (str) – User-defined name for printing and figure saving.
deftype (str) – Type of defect.
saveFigures (bool) – Whether to save the figure.
- Returns:
None
- pdyna.analysis.draw_MO_order_time(C, steps, uniname, saveFigures, smoother=0, n_bins=50)[source]
Draw the evolution of molecular order over time.
- Parameters:
C (numpy.ndarray) – Correlation data.
steps (numpy.ndarray) – Time steps.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – Smoothing window size.
n_bins (int) – Number of bins for histogram.
- Returns:
The time axis and the correlation data.
- Return type:
tuple
- pdyna.analysis.draw_MO_spatial_corr(C, uniname, saveFigures, n_bins=50)[source]
Draw the spatial correlation of molecular orientations.
- Parameters:
C (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
- Returns:
None
- pdyna.analysis.draw_MO_spatial_corr_NN12(C, uniname, saveFigures, n_bins=100)[source]
Draw the spatial correlation of molecular orientations for NN1 and NN2.
- Parameters:
C (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
- Returns:
None
- pdyna.analysis.draw_MO_spatial_corr_norm(C, uniname, saveFigures, n_bins=30)[source]
Draw the normalized spatial correlation of molecular orientations.
- Parameters:
C (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
- Returns:
The normalized spatial correlation data.
- Return type:
numpy.ndarray
- pdyna.analysis.draw_MO_spatial_corr_norm_var(C, uniname, saveFigures, n_bins=30)[source]
Draw the normalized spatial correlation of molecular orientations.
- Parameters:
C (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
- Returns:
The normalized spatial correlation data.
- Return type:
numpy.ndarray
- pdyna.analysis.draw_MO_spatial_corr_time(C, steps, uniname, saveFigures, smoother=0, n_bins=50)[source]
Draw the evolution of spatial correlation of molecular orientations over time.
- Parameters:
C (numpy.ndarray) – Correlation data.
steps (numpy.ndarray) – Time steps.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – Smoothing window size.
n_bins (int) – Number of bins for histogram.
- Returns:
The time axis and the correlation data.
- Return type:
tuple
- pdyna.analysis.draw_RDF(da, rdftype, uniname, saveFigures, n_bins=200)[source]
Draw the radial distribution function (RDF) histogram.
- Parameters:
da (numpy.ndarray) – Data for RDF.
rdftype (str) – Type of RDF (‘CN’ or ‘BX’).
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
- Returns:
None
- pdyna.analysis.draw_conntype_tilt_density(T, oc, uniname, saveFigures, n_bins=100, symm_n_fold=4, title=None)[source]
Isolate tilting pattern wrt. the connectivity type.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
oc (list) – The connectivity type list.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
symm_n_fold (int) – Symmetry fold for periodicity.
title (str) – Title for the plot.
- Returns:
None
- pdyna.analysis.draw_dist_density(D, uniname, saveFigures, n_bins=100, xrange=[0, 0.5], gaus_fit=True, title=None)[source]
Draws the density of distortion parameters.
- Parameters:
D (numpy.ndarray) – The distortion array.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
xrange (list) – Range for the x-axis.
gaus_fit (bool) – Whether to fit a Gaussian to the plot.
title (str) – Title for the plot.
- Returns:
The mean and standard deviation of the fitted Gaussian if gaus_fit = True.
- Return type:
tuple
- pdyna.analysis.draw_dist_density_frame(D, uniname, saveFigures, n_bins=100, xrange=[0, 0.5])[source]
Draws the density of distortion parameters for frames.
- Parameters:
D (numpy.ndarray) – The distortion array.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
xrange (list) – Range for the x-axis.
- Returns:
The mean of the fitted Gaussian for each distortion parameter.
- Return type:
list of float
- pdyna.analysis.draw_dist_evolution(D, steps, Tgrad, uniname, saveFigures=False, xaxis_type='N', Ti=None, x_lims=None, y_lims=None, invert_x=False)[source]
Draws the evolution of distortion parameters over time or temperature or MD steps.
- Parameters:
D (numpy.ndarray) – The distortion array.
steps (numpy.ndarray) – The time or MD steps.
Tgrad (float) – The temperature gradient.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – The type of x-axis (‘N’, ‘t’, or ‘T’).
Ti (float) – Initial temperature.
x_lims (list) – Limits for the x-axis.
y_lims (list) – Limits for the y-axis.
invert_x (bool) – Whether to invert the x-axis.
- Returns:
The steps and the distortion parameters.
- Return type:
tuple
- pdyna.analysis.draw_dist_evolution_time(D, steps, uniname, saveFigures, smoother=0, y_lim=None)[source]
Draws the evolution of distortion over time.
- Parameters:
D (numpy.ndarray) – The distortion array.
steps (numpy.ndarray) – The time or MD steps.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – The smoothing factor.
y_lim (list) – Limits for the y-axis.
- Returns:
The steps and the smoothed distortion parameters.
- Return type:
tuple
- pdyna.analysis.draw_distortion_evolution_sca(D, steps, uniname, saveFigures, xaxis_type='N', scasize=2.5, y_lim=0.4)[source]
Draws the evolution of distortion parameters over time or temperature or MD steps.
- Parameters:
D (numpy.ndarray) – The distortion array.
steps (numpy.ndarray) – The time or MD steps.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – The type of x-axis (‘N’, ‘t’, or ‘T’).
scasize (float) – Size of the scatter points.
y_lim (float) – Limit for the y-axis.
- Returns:
None
- pdyna.analysis.draw_halideconc_dist_density(Dconc, concent, uniname, saveFigures, n_bins=100, xrange=[0, 0.5])[source]
Isolate distortion mode wrt. the local halide concentration.
- Parameters:
Dconc (list) – The distortion data of each concentraion level.
concent (list) – The halide concentrations.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
xrange (list) – The range for the histogram.
- Returns:
The fitted distortion, distortion standard deviation.
- Return type:
tuple
- pdyna.analysis.draw_halideconc_lat_density(Lconc, concent, uniname, saveFigures, n_bins=100)[source]
Isolate lattice parameter wrt. the local halide concentration.
- Parameters:
Lconc (list) – The lattice data of each concentraion level.
concent (list) – The halide concentrations.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
The fitted lattice parameters, lattice parameter standard deviation.
- Return type:
tuple
- pdyna.analysis.draw_halideconc_tilt_density(Tconc, brconc, concent, uniname, saveFigures, corr_vals=None, n_bins=100, symm_n_fold=4)[source]
Isolate tilting pattern wrt. the local halide concentration.
- Parameters:
Tconc (list) – The tilting data of each concentraion level.
brconc (list) – The bromine concentration.
concent (list) – The halide concentrations.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
corr_vals (list) – The correlation values.
n_bins (int) – Number of bins for the histogram.
symm_n_fold (int) – The symmetry fold.
- Returns:
The fitted tilt angles
- Return type:
tuple
- pdyna.analysis.draw_halideconc_tilt_density_transient(Tconc, steps, concent, uniname, saveFigures, smoother=0)[source]
Isolate tilting pattern wrt. the local halide concentration.
- Parameters:
Tconc (list) – The tilting data of each concentraion level.
steps (list) – The x-axis steps.
concent (list) – The halide concentrations.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – The smoothing window size.
- Returns:
The halide concentrations, steps, and tilting data.
- Return type:
tuple
- pdyna.analysis.draw_hetero_dist_density(Dcls, uniname, saveFigures, n_bins=100, xrange=[0, 0.5])[source]
Isolate distortion mode wrt. the local halide configuration.
- Parameters:
Dcls (list) – The distortion data of each configuration.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
xrange (list) – The range for the histogram.
- Returns:
The fitted distortion, distortion standard deviation.
- Return type:
tuple
- pdyna.analysis.draw_hetero_lat_density(Lcls, uniname, saveFigures, n_bins=100)[source]
Isolate distortion mode wrt. the local halide configuration.
- Parameters:
Lcls (list) – The lattice data of each configuration.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
The fitted lattice parameters, lattice parameter standard deviation.
- Return type:
tuple
- pdyna.analysis.draw_hetero_tilt_density(Tcls, TCNcls, typelib, uniname, saveFigures, corr_vals=None, n_bins=100, symm_n_fold=4)[source]
Isolate tilting pattern wrt. the local halide configuration.
- Parameters:
Tcls (list) – The tilt data of each configuration.
TCNcls (list) – The tilt data of each configuration.
typelib (str) – The type of tilt.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
corr_vals (list) – The correlation values.
n_bins (int) – Number of bins for the histogram.
symm_n_fold (int) – The symmetry fold.
- Returns:
The maximum tilt values.
- Return type:
list of floats
- pdyna.analysis.draw_lattice_density(Lat, uniname, saveFigures=False, n_bins=50, num_crop=0, screen=None, title=None)[source]
Draws the lattice density distribution for a given lattice parameter array.
- Parameters:
Lat (numpy.ndarray) – The lattice parameter array.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – The number of bins for the histogram.
num_crop (int) – The number of initial rows to crop from the array.
screen (list) – The range of values to screen.
title (str) – The title of the plot.
- Returns:
Mean and standard deviation of the lattice parameters.
- Return type:
tuple
- pdyna.analysis.draw_lattice_evolution(dm, steps, Tgrad, uniname, saveFigures=False, xaxis_type='N', Ti=None, x_lims=None, y_lims=None, invert_x=False)[source]
Draws the evolution of lattice parameters over time or temperature or MD steps.
- Parameters:
dm (numpy.ndarray) – The lattice parameter array.
steps (numpy.ndarray) – The time or MD steps.
Tgrad (float) – The temperature gradient.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – The type of x-axis (‘N’, ‘t’, or ‘T’).
Ti (float) – Initial temperature.
x_lims (list) – Limits for the x-axis.
y_lims (list) – Limits for the y-axis.
invert_x (bool) – Whether to invert the x-axis.
- Returns:
None
- pdyna.analysis.draw_lattice_evolution_time(dm, steps, Ti, uniname, saveFigures, smoother=0, x_lims=None, y_lims=None)[source]
Draws the evolution of lattice parameters over time.
- Parameters:
dm (numpy.ndarray) – The lattice parameter array.
steps (numpy.ndarray) – The time or MD steps.
Ti (float) – Initial temperature.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – The smoothing factor.
x_lims (list) – Limits for the x-axis.
y_lims (list) – Limits for the y-axis.
- Returns:
The steps and the smoothed lattice parameters.
- Return type:
tuple
- pdyna.analysis.draw_octatype_dist_density(Dtype, config_types, uniname, saveFigures, n_bins=100, xrange=[0, 0.5])[source]
Isolate distortion mode wrt. the local halide configuration.
- Parameters:
Dtype (list) – The distortion array for each type.
config_types (list) – The configuration types.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
xrange (list) – Range for the histogram.
- Returns:
The distortion values, and distortion standard deviations.
- Return type:
tuple
- pdyna.analysis.draw_octatype_lat_density(Ltype, config_types, uniname, saveFigures, n_bins=100)[source]
Isolate distortion mode wrt. the local halide configuration.
- Parameters:
Ltype (list) – The lattice parameter array for each type.
config_types (list) – The configuration types.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
The lattice values, and lattice standard deviations.
- Return type:
tuple
- pdyna.analysis.draw_octatype_tilt_density(Ttype, typelib, config_types, uniname, saveFigures, corr_vals=None, n_bins=100, symm_n_fold=4)[source]
Isolate tilting pattern wrt. the local halide configuration.
- Parameters:
Ttype (list) – The tilt angle array for each type.
typelib (list) – The types.
config_types (list) – The configuration types.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
corr_vals (list) – The correlation values.
n_bins (int) – Number of bins for the histogram.
symm_n_fold (int) – Symmetry fold for periodicity.
- Returns:
The fitted tilt angles.
- Return type:
list
- pdyna.analysis.draw_octatype_tilt_density_transient(Ttype, steps, typelib, config_types, uniname, saveFigures, smoother=0)[source]
Isolate tilting pattern wrt. the local halide configuration in transient mode.
- Parameters:
Ttype (list) – The tilt angle array for each type.
steps (numpy.ndarray) – The time or MD steps.
typelib (list) – The types.
config_types (list) – The configuration types.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – Smoothing window size.
- Returns:
The configuration types, steps, and tilt angles.
- Return type:
tuple
- pdyna.analysis.draw_tilt_and_corr_density_full(T, Cf, uniname, saveFigures, n_bins=100, title=None)[source]
Generate the full 3-by-3 array of Glazer plots including the off-diagonal correlations.
- Parameters:
T (numpy.ndarray) – Tilt data.
Cf (numpy.ndarray) – Full correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
title (str) – Title of the plot.
- Returns:
tilt correlation polarity (TCP) values of each axis and direction.
- Return type:
numpy.ndarray
- pdyna.analysis.draw_tilt_and_corr_density_shade(T, Corr, uniname, saveFigures, n_bins=100, title=None)[source]
Generate the Glazer plot.
- Parameters:
T (numpy.ndarray) – Tilt data.
Corr (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
title (str) – Title of the plot.
- Returns:
tilt correlation polarity (TCP) values of each axis.
- Return type:
list of floats
- pdyna.analysis.draw_tilt_and_corr_density_shade_frame(T, Corr, uniname, saveFigures, n_bins=100)[source]
Generate the Glazer plot for a single frame.
- Parameters:
T (numpy.ndarray) – Tilt data.
Corr (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
tilt correlation polarity (TCP) values of each axis.
- Return type:
list of floats
- pdyna.analysis.draw_tilt_and_corr_density_shade_longarray(T, Corr, uniname, saveFigures, n_bins=100, title=None)[source]
Generate the Glazer plot for a reshaped array.
- Parameters:
T (numpy.ndarray) – Tilt data.
Corr (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
title (str) – Title of the plot.
- Returns:
tilt correlation polarity (TCP) values of each axis.
- Return type:
list of floats
- pdyna.analysis.draw_tilt_and_corr_density_shade_non3D(T, Corr, uniname, saveFigures, n_bins=100, title=None)[source]
Generate the Glazer plot for non-3D structures.
- Parameters:
T (numpy.ndarray) – Tilt data.
Corr (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
title (str) – Title of the plot.
- Returns:
tilt correlation polarity (TCP) values of each axis.
- Return type:
list of floats
- pdyna.analysis.draw_tilt_coaxial(T, uniname, saveFigures, n_bins=171, title=None)[source]
Draw the coaxial tilting correlation plots.
- Parameters:
T (numpy.ndarray) – Tilt data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
title (str) – Title of the plot.
- Returns:
None
- pdyna.analysis.draw_tilt_corr_density_time(T, Corr, steps, uniname, saveFigures, smoother=0, n_bins=50)[source]
Generate the time evolution of correlation density plots for tilting.
- Parameters:
T (numpy.ndarray) – Tilt data.
Corr (numpy.ndarray) – Correlation data.
steps (numpy.ndarray) – Time steps.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – Smoothing window size.
n_bins (int) – Number of bins for the histogram.
- Returns:
Time steps and correlation values for each axis.
- Return type:
tuple
- pdyna.analysis.draw_tilt_corr_evolution_sca(T, steps, uniname, saveFigures, xaxis_type='t', scasize=1.5, y_lim=[-1, 1])[source]
Draw the tilt correlation evolution.
- Parameters:
T (numpy.ndarray) – Tilt data.
steps (numpy.ndarray) – Steps data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – Type of x-axis (‘N’, ‘T’, or ‘t’).
scasize (float) – Size of scatter points.
y_lim (list) – Y-axis limits.
- Returns:
None
- pdyna.analysis.draw_tilt_density(T, uniname, saveFigures, n_bins=100, symm_n_fold=4, title=None)[source]
Draws the density of tilt angles.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
symm_n_fold (int) – Symmetry fold for periodicity.
title (str) – Title for the plot.
- Returns:
None
- pdyna.analysis.draw_tilt_evolution(T, steps, Tgrad, uniname, saveFigures=False, xaxis_type='N', Ti=None, x_lims=None, y_lims=None, invert_x=False, use_gaussian=False)[source]
Draws the evolution of tilt angles over time or temperature or MD steps.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
steps (numpy.ndarray) – The time or MD steps.
Tgrad (float) – The temperature gradient.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – The type of x-axis (‘N’, ‘t’, or ‘T’).
Ti (float) – Initial temperature.
x_lims (list) – Limits for the x-axis.
y_lims (list) – Limits for the y-axis.
invert_x (bool) – Whether to invert the x-axis.
use_gaussian (bool) – Whether to use Gaussian fitting (require a large enough data).
- Returns:
The steps and the tilt angles.
- Return type:
tuple
- pdyna.analysis.draw_tilt_evolution_sca(T, steps, uniname, saveFigures, xaxis_type='t', scasize=2.5, y_lim=None)[source]
Draws the evolution of tilt angles over time or temperature or MD steps.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
steps (numpy.ndarray) – The time or MD steps.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
xaxis_type (str) – The type of x-axis (‘N’, ‘t’, or ‘T’).
scasize (float) – Size of the scatter points.
y_lim (list) – Limits for the y-axis.
- Returns:
None
- pdyna.analysis.draw_tilt_evolution_time(T, steps, uniname, saveFigures, smoother=0, y_lim=None)[source]
Draws the evolution of tilt angles over time.
- Parameters:
T (numpy.ndarray) – The tilt angle array.
steps (numpy.ndarray) – The time or MD steps.
uniname (str) – The user-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
smoother (int) – The smoothing factor.
y_lim (list) – Limits for the y-axis.
- Returns:
The steps and the smoothed tilt angles.
- Return type:
tuple
- pdyna.analysis.draw_tilt_prediction(c, pred, preds, yc, maxs, override=[False, False, False])[source]
Draws the tilt prediction based on the computed density.
- Parameters:
c (numpy.ndarray) – The computed density.
pred (list) – The total density.
preds (list) – The individual peaks.
yc (numpy.ndarray) – The y-coordinates for the density plot.
maxs (list) – The maximum values for each tilt angle.
override (list) – Flags to override the predictions.
- Returns:
None
- pdyna.analysis.draw_tilt_spatial_corr(C, uniname, saveFigures, n_bins=100)[source]
Generate the spatial correlation plots for tilting.
- Parameters:
C (numpy.ndarray) – Correlation data.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
None
- pdyna.analysis.draw_transient_properties(Lobj, Tobj, Cobj, Mobj, uniname, saveFigures)[source]
Draw transient properties of the system.
- Parameters:
Lobj (list) – List containing lattice parameters.
Tobj (list) – List containing tilting properties.
Cobj (list) – List containing tilting correlation properties.
Mobj (list) – List containing molecular properties.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
- Returns:
None
- pdyna.analysis.fit_3D_disp_atomwise(disp, readTimestep, uniname, moltype, saveFigures, n_bins=50, title=None)[source]
A-site displacement calculation to extract vibration of atoms about their average position.
- Parameters:
disp (numpy.ndarray) – Displacement data.
readTimestep (float) – Time step for reading data.
uniname (str) – User-defined name for printing and figure saving.
moltype (str) – Type of molecule.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
title (str) – Title for the plot.
- Returns:
The peaks of the displacement data.
- Return type:
numpy.ndarray
- pdyna.analysis.fit_3D_disp_total(dispt, uniname, moltype, saveFigures, n_bins=100, title=None)[source]
A-site displacement calculation (total displacement for all given sites).
- Parameters:
dispt (numpy.ndarray) – Total displacement data.
uniname (str) – User-defined name for printing and figure saving.
moltype (str) – Type of molecule.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for histogram.
title (str) – Title for the plot.
- Returns:
None
- pdyna.analysis.fit_damped_oscillator(x, y)[source]
Fit a damped oscillator model to the given data.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
- Returns:
The fitted frequency.
- Return type:
float
- pdyna.analysis.fit_exp_decay(x, y, allow_redo=True)[source]
Fit an exponential decay to the given data.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
allow_redo (bool) – Whether to allow a second fitting attempt.
- Returns:
The fitted decay constant.
- Return type:
float
- pdyna.analysis.fit_exp_decay_both(x, y)[source]
Fit a two-component exponential decay to the given data.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
- Returns:
The fitted decay constants and coefficients.
- Return type:
tuple
- pdyna.analysis.fit_exp_decay_both_correct(x, y)[source]
Fit a two-component exponential decay to the given data with correction term.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
- Returns:
The fitted decay constants, coefficients, and correction term.
- Return type:
tuple
- pdyna.analysis.fit_exp_decay_fixed(x, y, aconst=0.9)[source]
Fit a two-component exponential decay with a fixed coefficient to the given data.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
aconst (float) – Fixed coefficient for the first exponential term.
- Returns:
The fitted decay constant.
- Return type:
float
- pdyna.analysis.fit_exp_decay_single(x, y)[source]
Fit a single exponential decay to the given data.
- Parameters:
x (numpy.ndarray) – Independent variable data.
y (numpy.ndarray) – Dependent variable data.
- Returns:
The fitted decay constant.
- Return type:
float
- pdyna.analysis.get_cube(limits=None)[source]
Get the vertices, edges, and faces of a cuboid defined by its limits.
- Parameters:
limits (numpy.ndarray) –
A 2D array of shape (3, 2) defining the limits of the cuboid. .. rubric:: Example
- limits = np.array([[x_min, x_max],
[y_min, y_max], [z_min, z_max]])
- Returns:
- A tuple containing:
vertices (numpy.ndarray): An array of the coordinates of the cuboid vertices.
edges (numpy.ndarray): An array of paired indices for connecting vertices that form an edge.
faces (numpy.ndarray): An array of groups of four indices that form a face.
- Return type:
tuple
- pdyna.analysis.get_norm_corr(TC, T)[source]
Calculate normalized correlation from tensor components, converting 6 neighbours to three principle directions.
- Parameters:
TC (numpy.ndarray) – Tilting correlation components.
T (numpy.ndarray) – Tilting magnitudes.
- Returns:
Normalized correlation values.
- Return type:
numpy.ndarray
- pdyna.analysis.get_tcp_from_list(TC)[source]
Calculate TCP from a list of tensor components.
- Parameters:
TC (list of numpy.ndarray) – Tilting correlation components.
- Returns:
TCP values.
- Return type:
numpy.ndarray
- pdyna.analysis.if_arrays_are_different(arr, tol=0.2)[source]
Checks if the maximum and minimum values of an array are significantly different.
- Parameters:
arr (numpy.ndarray) – The input array.
tol (float) – The tolerance value for comparison.
- Returns:
A tuple indicating the category of difference.
- Return type:
tuple
- pdyna.analysis.orientation_density(cnsn, moltype, SaveFigures, uniname, title=None, miller_mask=False)[source]
Visualize the orientation density of molecular vectors in 2D polar plot.
- Parameters:
cnsn (numpy.ndarray) – Molecular vectors.
moltype (str) – Molecular type name.
SaveFigures (bool) – Whether to save the figure.
uniname (str) – User-defined name for printing and figure saving.
title (str) – Title for the plot.
miller_mask (bool) – Whether to apply Miller indices masking.
- Returns:
None
- pdyna.analysis.orientation_density_2pan(cnsn, nnsn, moltype, SaveFigures, uniname, title=None, miller_mask=True)[source]
Visualize the orientation density of molecular vectors in 2D with two panels.
- Parameters:
cnsn (numpy.ndarray) – First molecular vectors.
nnsn (numpy.ndarray) – Secondary molecular vectors.
moltype (str) – Molecular type name.
SaveFigures (bool) – Whether to save the figure.
uniname (str) – User-defined name for printing and figure saving.
title (str) – Title for the plot.
miller_mask (bool) – Whether to apply Miller indices masking.
- Returns:
None
- pdyna.analysis.orientation_density_3D_dots(cnsn, moltype, SaveFigures, uniname, title=None)[source]
Visualize the orientation density of molecular vectors in 3D.
- Parameters:
cnsn (numpy.ndarray) – Molecular vectors.
moltype (str) – Molecular type name.
SaveFigures (bool) – Whether to save the figure.
uniname (str) – User-defined name for printing and figure saving.
title (str) – Title for the plot.
- Returns:
None
- pdyna.analysis.orientation_density_3D_sphere(cnsn, moltype, SaveFigures, uniname, title=None)[source]
Visualize the orientation density of molecular vectors in 3D using a sphere.
- Parameters:
cnsn (numpy.ndarray) – Molecular vectors.
moltype (str) – Molecular type name.
SaveFigures (bool) – Whether to save the figure.
uniname (str) – User-defined name for printing and figure saving.
title (str) – Title for the plot.
- Returns:
Variance of the counts (spread metric).
- Return type:
float
- pdyna.analysis.peaks_3D_scatter(peaks, uniname, moltype, saveFigures)[source]
Draw a 3D scatter plot of peaks.
- Parameters:
peaks (numpy.ndarray) – Peaks data.
uniname (str) – User-defined name for printing and figure saving.
moltype (str) – Type of molecule.
saveFigures (bool) – Whether to save the figure.
- Returns:
None
- pdyna.analysis.print_partition(typelib, config_types, brconc, halcounts)[source]
Print the partition of the halide configurations.
- Parameters:
typelib (list) – The list of halide configurations.
config_types (list) – The configuration types.
brconc (list) – The bromine concentration.
halcounts (list) – The counts of halides.
- Returns:
None
- pdyna.analysis.properties_to_binned_grid(T, D, tcorr, bc, ss, bin_indices)[source]
Assign tilting and distortion to 3D grids.
- Parameters:
T (numpy.ndarray) – Tilt data.
D (numpy.ndarray) – Distortion data.
tcorr (numpy.ndarray) – Time correlation data.
bc (numpy.ndarray) – B-site displacement data.
ss (int) – Supercell size of the grid.
bin_indices (numpy.ndarray) – Binned indices of B-sites.
- Returns:
Gridded tilt, distortion, time correlation, and B-site displacement values.
- Return type:
tuple
- pdyna.analysis.quantify_halideconc_tilt_domain(TCconc, concent, uniname, saveFigures, n_bins=100)[source]
Isolate tilting pattern wrt. the local halide concentration.
- Parameters:
TCconc (numpy.ndarray) – Tilt correlation data.
concent (list) – List of halide concentrations.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
Correlation lengths (diagonal and off-diagonal) for each concentration
- Return type:
numpy.ndarray
- pdyna.analysis.quantify_hetero_tilt_domain(TCcls, uniname, saveFigures, n_bins=100)[source]
Isolate tilting pattern wrt. the local halide configuration in hetero-mode.
- Parameters:
TCcls (numpy.ndarray) – Tilt correlation data for each type.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
Correlation lengths (diagonal and off-diagonal) for each configuration type.
- Return type:
numpy.ndarray
- pdyna.analysis.quantify_octatype_tilt_domain(TCtype, config_types, uniname, saveFigures, n_bins=100)[source]
Isolate tilting pattern wrt. the local halide configuration.
- Parameters:
TCtype (numpy.ndarray) – Tilt correlation data for each type.
config_types (list) – List of halide configurations.
uniname (str) – User-defined name for printing and figure saving.
saveFigures (bool) – Whether to save the figure.
n_bins (int) – Number of bins for the histogram.
- Returns:
Correlation lengths (diagonal and off-diagonal) for each configuration type.
- Return type:
numpy.ndarray
- pdyna.analysis.quantify_tilt_domain(sc, scnorm, plot_label='tilt')[source]
Compute spatial coorelation of tilting.
- Parameters:
sc (numpy.ndarray) – Spatial correlation data.
scnorm (numpy.ndarray) – Normalized spatial correlation data.
plot_label (str) – Label for plotting.
- Returns:
Decay lengths for each tilt axis and spatial direction.
- Return type:
numpy.ndarray
- pdyna.analysis.savitzky_golay(y, window_size=51, order=3, deriv=0, rate=1)[source]
Smooth (and optionally differentiate) data with a Savitzky-Golay filter.
References [1] A. Savitzky, M. J. E. Golay, Smoothing and Differentiation of
Data by Simplified Least Squares Procedures. Analytical Chemistry, 1964, 36 (8), pp 1627-1639.
- [2] Numerical Recipes 3rd Edition: The Art of Scientific Computing
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery Cambridge University Press ISBN-13: 9780521880688
- Parameters:
y (numpy.ndarray) – the input signal
window_size (int) – the length of the window (must be an odd integer)
order (int) – the order of the polynomial used in the filtering
deriv (int) – the order of the derivative to compute (default is 0 means only smoothing)
rate (int) – rate of change of the x values (default is 1)
- Returns:
the smoothed signal
- Return type:
numpy.ndarray
- pdyna.analysis.set_axes_equal(ax)[source]
Set the aspect ratio of a 3D plot to be equal.
- Parameters:
ax (matplotlib.axes._axes.Axes) – The axes object to set the aspect ratio for.
- Returns:
None
- pdyna.analysis.sphere_bin_count(cnsn)[source]
Count the number of molecular vectors in spherical bins.
- Parameters:
cnsn (numpy.ndarray) – Molecular vectors.
- Returns:
Mesh coordinates (x, y, z), counts array, and variance (spread metric).
- Return type:
tuple
- pdyna.analysis.sphere_mesh(res=80)[source]
Create a sphere mesh for visualization.
- Parameters:
res (int) – Resolution of the sphere mesh.
- Returns:
Mesh coordinates (x, y, z) and sampled points.
- Return type:
tuple
- pdyna.analysis.spherical_coordinates(cn)[source]
Convert Cartesian coordinates to spherical coordinates.
- Parameters:
cn (numpy.ndarray) – Cartesian coordinates (x, y, z).
- Returns:
Spherical coordinates (theta, phi).
- Return type:
tuple
- pdyna.analysis.vis3D_domain_anime(cfeat, frs, tstep, ss, bin_indices, figname)[source]
Visualise tilting in 3D animation. Better visual effects can be done with professional software.
- Parameters:
cfeat (numpy.ndarray) – Color feature data.
frs (list) – Frame indices.
tstep (float) – Time step.
ss (int) – Supercell size of the grid.
bin_indices (numpy.ndarray) – Binned indices of B-sites.
figname (str) – Name of the figure file.
- Returns:
None
- pdyna.analysis.vis3D_domain_frame(cfeat, ss, bin_indices, cmap, clbedge, figname, saveFigures)[source]
Visualise tilting in 3D for a single frame.
- Parameters:
cfeat (numpy.ndarray) – Color feature data.
ss (int) – Supercell size of the grid.
bin_indices (numpy.ndarray) – Binned indices of B-sites.
cmap (str) – Color map.
clbedge (float) – Color bar edge.
figname (str) – Name of the figure file.
saveFigures (bool) – Whether to save the figure.
- Returns:
None