Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Open In Colab Open In Kaggle

Tutorial 5: Working with Data Files

This tutorial demonstrates how to work with data files in your course using the {nma-data} directive.

Declaring Data Files

The {nma-data} directive tells the course kit which files your tutorial needs:

This declaration:

Files must live in data/ or image/ inside your day’s folder.

Using Images

Images work the same way as data files - declare them in {nma-data} and reference them in your content:

Experimental setup schematic

Figure 1:Our experimental pipeline: stimulus presentation, neural recording, and spike train analysis.

In the browser, the image loads instantly from the embedded data. In generated notebooks, the download cell fetches it from GitHub.

Loading Data

Load the data the same way in both environments - normal NumPy works:

Visualizing Spike Trains

Let’s create a raster plot showing spike times for the first neuron across all trials:

Computing Firing Rates

Calculate mean firing rate by condition:

Interactive Exploration

Use a widget to explore different neurons and conditions:

Summary

When adding data and images to your tutorials:

  1. Create data/ and/or image/ folders in your day’s directory

  2. Keep files small (<2MB total) so they embed in browser pages

  3. Declare all files with {nma-data} at the top of the tutorial

  4. Reference normally - images with {figure}, data with np.load() or similar

  5. Validate with nma-kit check before committing

The kit automatically:

Note: This tutorial includes generation scripts (generate_data.py, generate_schematic.py) for reproducibility, but you don’t need to commit generation scripts in your own courses - just commit the files themselves.