Getting started#

The Behavior Explorer is a web dashboard (Dash) to look at the behavior of the mice of the Training Village, day by day. It reads the same data as the daily reports (village-report-generator), with lecilab-behavior-analysis.

Running it#

On the cluster, one dashboard runs all the time for everyone: see use it from your computer. How it runs there: running the shared dashboard.

To run one yourself:

behavior-explorer

(or python behavior_data_visualizer/main.py) and open http://127.0.0.1:8050. Options: --port (default 8050), --threads (requests served at once, default 8), --dev (the development server of Flask). It needs Python 3.11 or newer, with this package and lecilab-behavior-analysis installed (pip install -e . in each repository).

The data#

A data folder has one folder per project:

  • <project>/sessions/<mouse>/<mouse>.csv (or .csv.gz): the trials of each mouse,

  • <project>/<setup>/events.csv: the events of each setup (box),

  • <project>/videos/<mouse>/<mouse>_<task>_<YYYYMMDD_HHMMSS>.mp4: the video of each session.

There can be several data folders with this structure, e.g. on the cluster /storage/training_village (current projects) and /archive/training_village (older ones). The dashboard shows a project list per data folder, each titled with its path: choose a project in one of them (the others are cleared). Everything else (the mice, their trials, settings, reports and videos) is read from the data folder of the chosen project.

The data folders are, in this order and only those that exist:

  1. the folder of lecilab-behavior-analysis: the LECILAB_DATA_PATH environment variable if it is set, otherwise the folder of the computer (lecilab_behavior_analysis.io.server.get_outpath),

  2. /storage/training_village,

  3. /archive/training_village.

The BDV_DATA_PATHS environment variable (folders separated by :) replaces this list. For example, to look at a sample dataset:

LECILAB_DATA_PATH=tests/data/sample_data python behavior_data_visualizer/main.py

The dashboard only reads the data folders (the videos are sent from them), so any user who can read the data can run it, even from someone else’s copy of the code. The status page (/status) lists the data folders in use.

What it shows#

  1. Choose a project and a mouse. Its trials are read (a few seconds for a long history; the last mice opened are kept in memory and read again when their file changes).

  2. The calendar shows the days with trials (darker: more trials). The last day is selected; click another day to see it (framed in red).

  3. For the selected day:

    • a summary (sessions, training stages, trials, performance, water),

    • the performance through its trials, with a dashed line at each new session. Click a point to watch the video of the session from that trial,

    • the psychometric curves, one per stimulus modality (two in multisensory sessions), as in the daily report: by brightness ratio (visual), by evidence strength (cloud of tones), by sound level, 3 bins per side (sound location), or by side and difficulty when there are only easy trials.

    • trial by trial, as a barcode (one tick per trial): the correct side of the stimulus (coloured by modality, darker for easier trials), the outcome (correct, incorrect, miss) and the early pokeouts, with the performance and the early pokeouts of the last 20 trials above. Click a trial to watch the video from that trial. Zoom on some trials (drag across the performance or the trial-by-trial figure) and the other figure shows the same trials, and the psychometric curves are made with those trials only (their range is shown above them). Double click to see the whole day again.

  4. The buttons draw the figures of the daily report: the session report of the day and the training history up to the day.

  5. Settings history (button): how the training went, session by session.

    • Below, the proportion of left choices for each correct side and difficulty (left easy at the top, right easy at the bottom; red: left, blue: right): a psychometric curve per session, as colours.

    • Above, a row per setting chosen in the list (the settings that changed at some point come first; by default the training stage, punishment, hard trials, reward and holding time), coloured by its value, with the value written where it changes.

    • The selected day is framed. Click a session to go to its day.

    • Below the figure, all the settings of each session of the day, the ones that changed since the previous session first (marked with *).

    The settings come from the settings column of the sessions_summary.csv of each setup of the project (saved by the village).