Visualize

The script visualize.py is used to visualize a search in 1D, 2D or 3D.

Outputs generated by the script are:
  • *video.mp4

    a video of the search (.mp4), only for Unix-based systems with ffmpeg installed

  • *video_xxxxxxxx.png

    video frames, only if requested or if unable to make a video

Each frame consists of two panels: one shows an observation map with the hits received since the start of the search, the other shows the current probability distribution of source locations.

Parameters of the script are:
  • Source-tracking POMDP
    • N_DIMS (int > 0)

      number of space dimensions (1D, 2D, …)

    • LAMBDA_OVER_DX (float >= 1)

      dimensionless problem size

    • R_DT (float > 0.0)

      dimensionless source intensity

    • NORM_POISSON (‘Euclidean’, ‘Manhattan’ or ‘Chebyshev’)

      norm used for hit detections, usually ‘Euclidean’

    • N_HITS (int >= 2 or None)

      number of possible hit values, set automatically if None

    • N_GRID (odd int >= 3 or None)

      linear size of the domain, set automatically if None

  • Policy
    • POLICY (int)
      • -1: neural network

      • 0: infotaxis (Vergassola, Villermaux and Shraiman, Nature 2007)

      • 1: space-aware infotaxis

      • 2: custom policy (to be implemented by the user)

      • 5: random walk

      • 6: greedy policy

      • 7: mean distance policy

      • 8: voting policy (Cassandra, Kaelbling & Kurien, IEEE 1996)

      • 9: most likely state policy (Cassandra, Kaelbling & Kurien, IEEE 1996)

    • STEPS_AHEAD (int >= 1)

      number of anticipated moves, can be > 1 only for POLICY=0

    • MODEL_PATH (str or None)

      path of the model (neural network) for POLICY=-1, None otherwise

  • Setup
    • DRAW_SOURCE (bool)

      if False, episodes will continue until the source is almost surely found (Bayesian setting)

    • ZERO_HIT (bool)

      whether to enforce a series of zero hits

  • Visualization
    • VISU_MODE (int={0,1,2})
      • 0: run without video

      • 1: make video in the background

      • 2: make video with live preview (slower)

      Note: with VISU_MODE = 2, the aspect ratio may be wrong depending on your screen size or resolution.

    • FRAME_RATE (int > 0)

      number of frames per second in the video

    • KEEP_FRAMES (bool)

      whether individual frames should be saved (otherwise frames are deleted, only the video is kept)

  • Stopping criteria
    • STOP_p (float ~ 0):

      stops when the probability that the source is found is greater than 1 - STOP_p (only if DRAW_SOURCE is False)

    • STOP_t (int > 0)

      maximum number of steps per episode

  • Saving
    • RUN_NAME (str or None)

      prefix used for all output files, if None will use a timestamp