Verified Commit a9e7f5ff authored by Yunus Sevinchan's avatar Yunus Sevinchan
Browse files

Improve config set namings and SEIRD densities_facet_grid plot

Renames config sets to be more descriptive.
parent 0a32c7b6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ test:cli:
    - utopia run ForestFire -d --num-seeds=3 --run-mode single --note no_sweep

    # Test using a configuration set to specify run and plots config
    - utopia run ForestFire -d --cs universe_example -N 10
    - utopia run ForestFire -d --cs long_run -N 10
    - if utopia run ForestFire --cs bad_config_set_name; then exit 1; else echo -e "\nFailed as expected"; fi

    # .. Evaluation ...........................................................
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ The following command will invoke a ``ForestFire`` model simulation with the run

.. code-block:: bash

    utopia run ForestFire --cfg-set multiverse_example
    utopia run ForestFire --cfg-set p_lightning_sweep

A config set is simply a directory containing a ``run.yml`` file and/or an ``eval.yml`` file.
In the above example, the directory's name is ``multiverse_example`` and it contains both of these files.
+27 −0
Original line number Diff line number Diff line
@@ -323,3 +323,30 @@ def test_directed_movement():
            # If there are infected ones, there should be movement in the
            # high density population
            assert (data.isel(time=t) != data.isel(time=t + 1)).any()


def test_run_and_eval_cfgs():
    """Carries out all additional configurations that were specified alongside
    the default model configuration.

    This is done automatically for all run and eval configuration pairs that
    are located in subdirectories of the ``cfgs`` directory (at the same level
    as the default model configuration).
    If no run or eval configurations are given in the subdirectories, the
    respective defaults are used.

    See :py:meth:`~utopya.model.Model.run_and_eval_cfg_paths` for more info.
    """
    for cfg_name, cfg_paths in mtc.default_config_sets.items():
        print(f"\nRunning '{cfg_name}' configuration ...")

        mv, _ = mtc.create_run_load(
            from_cfg=cfg_paths.get("run"),
            parameter_space=dict(
                num_steps=50,
                SEIRD=dict(cell_manager=dict(grid=dict(resolution=48))),
            ),
        )
        mv.pm.plot_from_cfg(plots_cfg=cfg_paths.get("eval"))

        print(f"Succeeded running and evaluating '{cfg_name}'.\n")
+18 −2
Original line number Diff line number Diff line
@@ -195,11 +195,10 @@ _:
# =============================================================================
# start: .animation
# The default animation config
# NOTE These do not enable animation, but merely set parameters.
#      Use `.animation.enabled` or the specific `.animation.<writer>` configs.
.animation.defaults:
  based_on:
    - .animation.defaults    # from utopya
    - .animation.medium_dpi  # from here

  # By default, use the ffmpeg writer and the mp4 output format
  file_ext: mp4
@@ -207,6 +206,13 @@ _:
    writer: ffmpeg


# Animation defaults that are disabled by default
.animation.disabled:
  based_on:
    - .animation.defaults
    - .animation.disabled
    - .defaults.file_ext


# Base configs enabling animation for a writer & including the Utopia defaults
.animation.ffmpeg:
@@ -220,6 +226,16 @@ _:
    - .animation.defaults    # from here


# DPI settings
.animation.medium_dpi:
  animation:
    writer_kwargs:
      frames:
        saving:
          dpi: 96
      ffmpeg:
        saving:
          dpi: 96



Loading