easyvvuq.encoders package

Submodules

easyvvuq.encoders.copy_encoder module

An encoder meant to simply copy a file to the input directory unchanged. It is meant to be used in combination with MultiBuilder encoder and possibly the DirectoryBuilder. It duplicates some functionality of the ApplyFixtures encoder but can be useful for very simple cases.

Examples

>>> multiencoder = uq.encoders.MultiEncoder(
      DirectoryBuilder(tree={"parent" : {"child1" : None, "child2" : None}}),
      CopyEncoder('/home/user/input1.conf', 'parent/child1/input1.conf')
      CopyEncoder('/home/user/input2.conf', 'parent/child1/input2.conf')
      CopyEncoder('/home/user/input3.conf', 'parent/child2/input3.conf')
      GenericEncoder(delimiter='$', template_fname='/home/user/template.in',
                     target_filename='parent/input.int'))
class easyvvuq.encoders.copy_encoder.CopyEncoder(source_filename, target_filename)[source]

Bases: object

An Encoder to copy an input file to a simulation.

Parameters:
  • source_filename (str) – a full path to some file that a simulation needs
  • target_filename (str) – a target filename inside the simulation directory
element_version()[source]
encode(params={}, target_dir='')[source]

Copy a file to target_dir.

Parameters:
  • params (dict) – keep empty, has no effect
  • target_dir (str) – target directory, full path
get_restart_dict()[source]

easyvvuq.encoders.directory_builder module

class easyvvuq.encoders.directory_builder.DirectoryBuilder(tree)[source]

Bases: object

DirectoryBuilder builds the specified directory structure for a Run.

The dir structure is specified by the ‘tree’ parameter. This should be a dict of dicts, for example:

tree = {‘a’ : {‘b’ : {‘c’ : None, ‘d’ : None}}, ‘e’ : {‘f’ : None}}

Parameters:tree (dict of dicts) – The desired directory structure
create_dir_tree(dirtree, root)[source]
element_version()[source]
encode(params={}, target_dir='')[source]

Builds the directory structure specified in self.tree into the target_dir directory

Parameters:
  • params (dict) – Parameter information in dictionary.
  • target_dir (str) – Path to directory where application input will be written.
get_restart_dict()[source]

easyvvuq.encoders.generic_template module

class easyvvuq.encoders.generic_template.GenericEncoder(template_fname, delimiter='$', target_filename='app_input.txt')[source]

Bases: object

GenericEncoder for substituting values into application template input.

encode(params={}, target_dir='')[source]

Substitutes params into a template application input, saves in target_dir

Parameters:
  • params (dict) – Parameter information in dictionary.
  • target_dir (str) – Path to directory where application input will be written.
easyvvuq.encoders.generic_template.get_custom_template(template_txt, custom_delimiter='$')[source]

easyvvuq.encoders.jinja_encoder module

class easyvvuq.encoders.jinja_encoder.JinjaEncoder(template_fname, target_filename='app_input.txt')[source]

Bases: object

JinjaEncoder for substituting values into application template input. Uses the jinja2 template system, which supports more complex expressions than the GenericEncoder. See https://jinja.palletsprojects.com/en/2.10.x/templates/ for template syntax.

encode(params={}, target_dir='')[source]

Substitutes params into a template application input, saves in target_dir

Parameters:
  • params (dict) – Parameter information in dictionary.
  • target_dir (str) – Path to directory where application input will be written.

easyvvuq.encoders.multiencoder module

class easyvvuq.encoders.multiencoder.MultiEncoder(*encoders)[source]

Bases: object

encode(params={}, target_dir='')[source]

Applies all encoders in the list of encoders.

is_restartable()[source]

Module contents