Interface Utility Functions

The functions defined here are used to support the interactive and command-line interfaces for vivarium.

vivarium.interface.utilities.run_from_ipython()[source]

Taken from https://stackoverflow.com/questions/5376837/how-can-i-do-an-if-run-from-ipython-test-in-python

Return type:

bool

vivarium.interface.utilities.log_progress(sequence, every=None, size=None, name='Items')[source]

Taken from https://github.com/alexanderkuk/log-progress

exception vivarium.interface.utilities.InteractiveError[source]

Error raised when the Interactive context is in an inconsistent state.

vivarium.interface.utilities.raise_if_not_setup(system_type)[source]
vivarium.interface.utilities.get_output_model_name_string(artifact_path, model_spec_path)[source]

Find a good string to use as model name in output path creation.

Parameters:
  • artifact_path (str | Path) – Path to the artifact file, if exists, else should be None

  • model_spec_path (str | Path) – Path to the model specification file. This must exist.

Returns:

A model name string for use in output labeling.

Return type:

str

vivarium.interface.utilities.get_output_root(results_directory, model_specification_file, artifact_path)[source]
Parameters:
  • results_directory (str | Path) –

  • model_specification_file (str | Path) –

  • artifact_path (str | Path) –