Commit 4b9d643a authored by Thomas Gaskin's avatar Thomas Gaskin
Browse files

Merge branch 'use-updated-abm-plot-in-SimpleFlocking' into 'master'

Use updated ABM plot in `SimpleFlocking` model

Closes #363

See merge request !290
parents f7e4fe4d 84cc29a2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -506,7 +506,7 @@ The following table includes the most important Python dependencies:

| Software                  | Version  | Comments                        |
| ------------------------- | -------- | ------------------------------- |
| [utopya](https://gitlab.com/utopia-project/utopya)   | >= 1.1   | The (outsourced) Utopia frontend package |
| [utopya](https://gitlab.com/utopia-project/utopya)   | >= 1.2   | The (outsourced) Utopia frontend package |
| [dantro](https://gitlab.com/utopia-project/dantro)   | >= 0.18  | Handle, transform, and visualize hierarchically organized data |
| [paramspace](https://gitlab.com/blsqr/paramspace)    | >= 2.5   | Makes parameter sweeps easy |

+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ if (NOT PYTHON_PACKAGE_wheel_FOUND)
endif()

# -- utopya
set(UTOPYA_REQUIRED_VERSION 1.1.3)
set(UTOPYA_REQUIRED_VERSION 1.2.0)

if(NOT UTOPYA_FROM_PYPI)
    set(UTOPYA_FROM_PYPI On)
+7 −12
Original line number Diff line number Diff line
@@ -63,10 +63,8 @@ errorbars:
    - .std: [!dag_tag infected, [seed]]
      tag: infected_std

    - operation: xr.Dataset
      kwargs:
        data_vars:
          avg: !dag_tag infected_mean
    - xr.Dataset:
      - avg: !dag_tag infected_mean
        err: !dag_tag infected_std
      tag: data  # Don't forget to define the 'data' tag

@@ -182,8 +180,7 @@ stacked_errorbands:
        dim: seed
      tag: std
    - xr.Dataset:
        data_vars:
          infected density: !dag_tag mean
      - infected density: !dag_tag mean
        err: !dag_tag std
      tag: data

@@ -231,8 +228,7 @@ panel_errorbands:
    - .std: [!dag_tag infected, seed]
      tag: std
    - xr.Dataset:
        data_vars:
          infected density: !dag_tag mean
      - infected density: !dag_tag mean
        err: !dag_tag std
      tag: data

@@ -274,6 +270,7 @@ panel_all:
  color: ~
  style:
    axes.prop_cycle: cycler('color', ['#CC3333', '#006666', '#AFD8BC' ])
    savefig.transparent: true
  helpers:
    set_limits:
      y: [ 0, 0.6 ]
@@ -361,8 +358,7 @@ scatter_2d_facet:
      tag: infected

    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
        infected: !dag_tag infected
      tag: data

@@ -409,8 +405,7 @@ scatter_3d:
      tag: recovered

    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
        infected: !dag_tag infected
        recovered: !dag_tag infected
      tag: data
+7 −14
Original line number Diff line number Diff line
@@ -48,8 +48,7 @@ _default_style: &default_style

  transform:
    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
      tag: data

  dag_visualization:
@@ -111,8 +110,7 @@ debug_DAG_locate_with_vis:
      tag: recovered

    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
        exposed: !dag_tag exposed
        infected: !dag_tag infected
        recovered: !dag_tag recovered
@@ -179,8 +177,7 @@ debug_DAG_advanced_print_examples:
### END --- debug_DAG_advanced_print_examples
    # To make the plot work, just combine them here
    - xr.Dataset:
        data_vars:
          susceptible: !dag_prev
      - susceptible: !dag_prev
        exposed: !dag_prev
      tag: data

@@ -333,8 +330,7 @@ scatter_2d_simple:
      tag: recovered

    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
        infected: !dag_tag infected
        recovered: !dag_tag recovered
      tag: data
@@ -372,8 +368,7 @@ scatter_2d:
      kwargs: { drop: true }
      tag: recovered
    - xr.Dataset:
        data_vars:
          susceptible: !dag_tag susceptible
      - susceptible: !dag_tag susceptible
        infected: !dag_tag infected
        recovered: !dag_tag recovered
      tag: data
@@ -415,10 +410,8 @@ scatter_3d:
    - .sel: [!dag_tag kind, { kind: recovered }]
      kwargs: { drop: true }
      tag: recovered
    - operation: xr.Dataset
      kwargs:
        data_vars:
          susceptible: !dag_tag susceptible
    - xr.Dataset:
      - susceptible: !dag_tag susceptible
        infected: !dag_tag infected
        recovered: !dag_tag recovered
      tag: data
+155 −0
Original line number Diff line number Diff line
# Output for the demo scenario
---

_utopia_colors: &utopia_colors
  dark_blue:          &darkblue           '#003366'
  medium_blue:        &mediumblue         '#0099CC'
  light_blue:         &lightblue          '#99CCFF'
  dark_green:         &darkgreen          '#006666'
  medium_green:       &mediumgreen        '#339999'
  light_green:        &lightgreen         '#AFD8BC'
  yellow:             &yellow             '#FFCC66'
  red:                &red                '#CC3333'
  cream_white:        &creamwhite         '#F6F6F6'
  white:              &white              '#fff'
  black:              &black              '#000000'
  gray:               &gray               '#F7F9FF'
  dark_gray:          &darkgray           '#666666'


# -----------------------------------------------------------------------------

# Demonstrates agents in a domain
### Start --- agents_in_domain
agents:

  based_on:
    - .creator.universe
    - .plot.abm
    - .animation.ffmpeg
    - .animation.fps30

  # Prepare data
  select:
    x:
      path: agent/x
      transform: [ .data ]
      allow_failure: silent
      fallback: !dag_tag _skip_plot
    y:
      path: agent/y
      transform: [ .data ]
    orientation:
      path: agent/orientation
      transform: [ .data ]

    space_extent:
      path: agent/x  # meta data is written to every other dataset as well
      transform:
        - getattr: [ !dag_prev , attrs ]
        - getitem: [ !dag_prev , space_extent ]

  transform:
    # Combine data into one dataset
    - xr.Dataset:
        - x: !dag_tag x
          y: !dag_tag y
          orientation: !dag_tag orientation
      tag: agents

  # Data encoding
  x: x
  y: y
  frames: time
  orientation: orientation
  hue: orientation

  # Define what to plot
  to_plot:
    agents:
      marker: wedge

  # Pass on space extent (used for setting limits)
  domain:
    extent: !dag_result space_extent
    pad: 0

  # Set tail lengths, style, and decay factor
  tail_length: 24
  tail_decay: 0.12
  tail_max_segment_length: 1.  # to avoid problems when crossing a boundary
  tail_kwargs:
    color: black
    linewidth: 0.5
    alpha: .6
    zorder: -10

  # Colorbar settings
  vmin: -3.14159
  vmax: +3.14159
  cbar_labels:
    +3.14159: $+π$
    +1.570795: $+π/2$
    0: $0$
    -1.570795: $+π/2$
    -3.14159: $-π$

### End --- agents_in_domain
  enabled: true

  universes:
    seed: [ 0 ]
  # Use a Utopia-themed colormap
  cmap: &cmap
    continuous: true
    from_values:
      0.0: *darkgreen
      0.333: *yellow
      0.666: *red
      1.0: *darkgreen
  frames_isel: !range [ 200 ]


fish_demo:
  based_on:
    - agents
    - .animation.disabled
  frames_isel: [10]
  to_plot:
    agents:
      marker: fish2

agents_in_domain_clean:
  based_on:
    - agents_in_domain
    - .animation.fps30
    - .animation.very_high_dpi
    # - .animation.frames

    # Hide axes
    - .hlpr.ticks.x.hide
    - .hlpr.ticks.y.hide
    - .style.no_spines
    - .style.no_grid

  figsize_aspect_offset: 0
  suptitle_fstr: false
  add_colorbar: false
  add_legend: false

  style:
    axes.facecolor: *gray

  cmap:
    <<: *cmap

  universes:
    seed: [ 1, 2 ]

agents_in_domain_clean_frames:
  enabled: false
  based_on:
    - agents_in_domain_clean
    - .animation.frames

  marker: fish
Loading