simulations.simulation#

Classes:

Simulation(S, force_recalc, **kwargs)

Base class for all simulations.

class udkm1Dsim.simulations.simulation.Simulation(S, force_recalc, **kwargs)[source]#

Bases: object

Base class for all simulations.

Handles the caching and some displaying option.

Parameters:
  • S (Structure) – sample to do simulations with.

  • force_recalc (boolean) – force recalculation of results.

Keyword Arguments:
  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

Attributes:
  • S (Structure) – sample structure to calculate simulations on.

  • force_recalc (boolean) – force recalculation of results.

  • save_data (boolean) – true to save simulation results.

  • cache_dir (str) – path to cached data.

  • disp_messages (boolean) – true to display messages from within the simulations.

  • progress_bar (boolean) – enable tqdm progress bar.

Methods:

disp_message(message)

Wrapper to display messages for that class.

save(full_filename, data, *args)

Save data to file.

conv_with_function(y, x, handle)

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

disp_message(message)[source]#

Wrapper to display messages for that class.

Parameters:

message (str) – message to display.

save(full_filename, data, *args)[source]#

Save data to file. The variable name can be handed as variable argument.

Parameters:
  • full_filename (str) – full file name to data file.

  • data (ndarray) – actual data to save.

  • *args (str, optional) – variable name within the data file.

static conv_with_function(y, x, handle)[source]#

Convolutes the array \(y(x)\) with a function given by the handle on the argument array \(x\).

Parameters:
  • y (ndarray[float]) – y data.

  • x (ndarray[float]) – x data.

  • handle (@lamdba) – convolution function.

Returns:

y_conv (ndarray[float]) – convoluted data.