mechanoChemML.workflows.pde_solver.pde_utility

Module Contents

Classes

BatchDataHeter Produces a sequence of the data with labels.
BatchData Produces a sequence of the data with labels.
BatchDataTime Produces a sequence of the data with labels.

Functions

plot_tex(tex=False)
get_cm()
plot_one_loss(pickle_file, png_filename, show_line=True)
plot_sigma2(pickle_file, png_filename, show_line=True, sigma1=’’)
plot_PDE_solutions_new(img_input, img_label, img_pre_mean, img_pre_var, img_pre_std, dof=1, dof_name=[‘c’], tot_img=6, filename=’’, fig_size=3.3) plot the results of PDEs
plot_PDE_solutions(img_input, img_label, img_pre_mean, img_pre_var, img_pre_std, dof=1, dof_name=[‘c’], tot_img=6, filename=’’, fig_size=2.2) plot the results of PDEs
plot_fields(list_of_field, list_of_field_name, dof, dof_name, filename=’’, print_data=False, vmin=None, vmax=None, Tex=False, fig_size=2.2, mask=False) plot the fields
split_data(datax, datay, batch_size, split_ratio=[‘0.8’, ‘0.1’, ‘0.1’]) split data according to a specific ratio
split_data_heter(datax, datay, dataz, batch_size, split_ratio=[‘0.8’, ‘0.1’, ‘0.1’]) split data according to a specific ratio
expand_dataset(features, labels, times) expand the features and labels to 2^(n+1) with n=times
ExpandDatasetHeter(features, mats, labels, times) expand the features and labels to 2^(n+1) with n=times
exe_cmd(cmd, output=False)
plot_one_field_stat(data, dpi=150, name=’stat.png’) Plot the statistics of a data
plot_one_field(data, x_dim, y_dim, dpi=150, name=’solution.png’) Plot the histogram of a data
plot_one_field_hist(data, x_dim, y_dim, dpi=150, name=’hist.png’) Plot the histogram of a data
mechanoChemML.workflows.pde_solver.pde_utility.plot_tex(tex=False)[source]
mechanoChemML.workflows.pde_solver.pde_utility.get_cm()[source]
mechanoChemML.workflows.pde_solver.pde_utility.plot_one_loss(pickle_file, png_filename, show_line=True)[source]
mechanoChemML.workflows.pde_solver.pde_utility.plot_sigma2(pickle_file, png_filename, show_line=True, sigma1='')[source]
mechanoChemML.workflows.pde_solver.pde_utility.plot_PDE_solutions_new(img_input, img_label, img_pre_mean, img_pre_var, img_pre_std, dof=1, dof_name=['c'], tot_img=6, filename='', fig_size=3.3)[source]

plot the results of PDEs

Parameters:
  • img_input (numpy array) – size of [1, :, :, dof*3]
  • img_label (numpy array) – size of [1, :, :, dof]
  • img_pre_mean (numpy array) – size of [1, :, :, dof]
  • img_pre_var (numpy array) – size of [1, :, :, dof]
  • img_pre_std (numpy array) – size of [1, :, :, dof]
  • dof (int) – default (=1)
  • dof_name (list) – list of string (default [‘c’])
  • tot_img (int) – without plotting std (tot_img=6, default), with std (tot_img=7)
  • filename (str) – default (‘’)
mechanoChemML.workflows.pde_solver.pde_utility.plot_PDE_solutions(img_input, img_label, img_pre_mean, img_pre_var, img_pre_std, dof=1, dof_name=['c'], tot_img=6, filename='', fig_size=2.2)[source]

plot the results of PDEs

Parameters:
  • img_input (numpy array) – size of [1, :, :, dof*2]
  • img_label (numpy array) – size of [1, :, :, dof]
  • img_pre_mean (numpy array) – size of [1, :, :, dof]
  • img_pre_var (numpy array) – size of [1, :, :, dof]
  • img_pre_std (numpy array) – size of [1, :, :, dof]
  • dof (int) – default (=1)
  • dof_name (list) – list of string (default [‘c’])
  • tot_img (int) – without plotting std (tot_img=6, default), with std (tot_img=7)
  • filename (str) – default (‘’)
mechanoChemML.workflows.pde_solver.pde_utility.plot_fields(list_of_field, list_of_field_name, dof, dof_name, filename='', print_data=False, vmin=None, vmax=None, Tex=False, fig_size=2.2, mask=False)[source]

plot the fields

Parameters:
  • list_of_field (list) – list of numpy array [1, :, :, dof]
  • list_of_field_name (list) – list of strings
  • dof (int) – dof per node
  • dof_name (list) – list of string
  • filename (str) – default (‘’)
mechanoChemML.workflows.pde_solver.pde_utility.split_data(datax, datay, batch_size, split_ratio=['0.8', '0.1', '0.1'])[source]

split data according to a specific ratio

mechanoChemML.workflows.pde_solver.pde_utility.split_data_heter(datax, datay, dataz, batch_size, split_ratio=['0.8', '0.1', '0.1'])[source]

split data according to a specific ratio

mechanoChemML.workflows.pde_solver.pde_utility.expand_dataset(features, labels, times)[source]

expand the features and labels to 2^(n+1) with n=times

mechanoChemML.workflows.pde_solver.pde_utility.ExpandDatasetHeter(features, mats, labels, times)[source]

expand the features and labels to 2^(n+1) with n=times

class mechanoChemML.workflows.pde_solver.pde_utility.BatchDataHeter(data, batch_size=128)[source]

Bases: tensorflow.keras.utils.Sequence

Produces a sequence of the data with labels.

__len__(self)[source]
__getitem__(self, idx)[source]
class mechanoChemML.workflows.pde_solver.pde_utility.BatchData(data, batch_size=128)[source]

Bases: tensorflow.keras.utils.Sequence

Produces a sequence of the data with labels.

__len__(self)[source]
__getitem__(self, idx)[source]
class mechanoChemML.workflows.pde_solver.pde_utility.BatchDataTime(data, batch_size=128)[source]

Bases: tensorflow.keras.utils.Sequence

Produces a sequence of the data with labels.

__len__(self)[source]
__getitem__(self, idx)[source]
mechanoChemML.workflows.pde_solver.pde_utility.exe_cmd(cmd, output=False)[source]
mechanoChemML.workflows.pde_solver.pde_utility.plot_one_field_stat(data, dpi=150, name='stat.png')[source]

Plot the statistics of a data

Parameters:
  • data (numpy array) – data[:, :, :]
  • dpi (int) – dpi of png (=150)
  • name (str) – name of png output (=’stat.png’)
mechanoChemML.workflows.pde_solver.pde_utility.plot_one_field(data, x_dim, y_dim, dpi=150, name='solution.png')[source]

Plot the histogram of a data

Parameters:
  • data (numpy array) – data[:, :, :]
  • x_dim (int) – subplots in the x_dim to plot
  • y_dim (int) – subplots in the y_dim to plot
  • dpi (int) – dpi of png (=150)
  • name (str) – name of png output (=’solution.png’)
mechanoChemML.workflows.pde_solver.pde_utility.plot_one_field_hist(data, x_dim, y_dim, dpi=150, name='hist.png')[source]

Plot the histogram of a data

Parameters:
  • data (numpy array) – data[:, :, :]
  • x_dim (int) – subplots in the x_dim to plot
  • y_dim (int) – subplots in the y_dim to plot
  • dpi (int) – dpi of png (=150)
  • name (str) – name of png output (=’hist.png’)
mechanoChemML.workflows.pde_solver.pde_utility.tot_img = 7[source]