Module 03: Python and Jupyter for Neuroscience

Build practical Python/Jupyter skills for reproducible connectomics data exploration.

Stylized vector art: notebook code cells with prompt chevrons and a result sparkline.

Lesson Flow

Learn

Goals and Concepts

Start with the capability target and concept set for this module.

Practice

Studio Activity

Apply the ideas in a guided activity tied to realistic outputs.

Check

Assessment Rubric

Use the rubric to verify competency and identify improvement targets.

Interactive Lab

Practice in short loops: checkpoint quiz, microtask decision, and competency progress tracking.

Artifact Triage Microtask

What should happen before reconstruction starts?

Progress Tracker

State is saved locally in your browser for this module.

0% complete

Capability target

Create a reproducible Jupyter notebook that ingests a connectomics dataset slice, performs one analysis, and exports documented outputs. Demonstrate familiarity with the core Python libraries used in connectomics research: CAVEclient, CloudVolume, NetworkX, pandas, and matplotlib.

Why this module matters

Python is the lingua franca of connectomics. Every major connectomics platform — CAVE, FlyWire, MICrONS, NeuPrint — provides Python client libraries. Jupyter notebooks have become the standard medium for sharing reproducible analyses: they combine executable code, inline visualizations, and narrative explanations in a single document. Mastering the notebook workflow early means that every subsequent module builds on a solid technical foundation rather than fighting tooling issues.

Concept set

1) Python as the lingua franca of connectomics

2) Jupyter notebooks for reproducible analysis

3) Key libraries overview

4) Best practices for connectomics code

5) The notebook as a communication tool

Core concepts

Core workflow

  1. Set environment and dependencies (requirements.txt with pinned versions).
  2. Initialize clients (CAVEclient, CloudVolume) and record dataset/materialization version.
  3. Load dataset and validate schema (check column names, data types, row counts).
  4. Run analysis cell sequence (filter, aggregate, compute metrics).
  5. Visualize results (at least one plot with labeled axes, title, and caption).
  6. Save outputs + metadata (CSV/Parquet for data, PNG/SVG for figures, JSON for parameters).
  7. Re-run from clean kernel to verify reproducibility.

Detailed run-of-show (90 minutes)

Block 1: Notebook anatomy (00:00-12:00)

Block 2: Environment setup and library tour (12:00-28:00)

Block 3: Guided analysis sprint (28:00-50:00)

Block 4: Visualization and export (50:00-65:00)

Block 5: Clean rerun test (65:00-80:00)

Block 6: Competency check and exit ticket (80:00-90:00)

Studio activity: “Build a connectomics analysis notebook”

Overview

Learners produce a complete, reproducible Jupyter notebook that queries a connectomics dataset, performs a descriptive analysis, and exports documented results.

Part A: Setup and data loading (20 minutes)

  1. Create a new notebook with a header cell: title, your name, date, dataset name, materialization version.
  2. Create a setup cell with all imports and version pinning.
  3. Initialize CAVEclient (or load a provided sample CSV if CAVE access is unavailable).
  4. Query or load a synapse table. Validate: print column names, data types, row count, and first 5 rows.
  5. Add a markdown cell explaining what the dataset contains and what version you are using.

Part B: Analysis (20 minutes)

  1. Choose one descriptive analysis from the following options:
    • Synapse count distribution: histogram of synapse counts per neuron.
    • Top connections: bar chart of the 10 most connected cell-type pairs.
    • Degree distribution: in-degree vs. out-degree scatter plot for all neurons in a region.
    • Spatial distribution: scatter plot of synapse locations colored by cell type.
  2. Write the analysis code with markdown cells explaining each step.
  3. Compute at least one summary statistic (mean, median, max, or standard deviation) and report it in a markdown cell.

Part C: Visualization and export (15 minutes)

  1. Create at least one publication-quality figure with labeled axes, title, and legend.
  2. Add a markdown caption below the figure explaining what it shows and what conclusions (if any) can be drawn.
  3. Export your data table as CSV and your figure as PNG.
  4. Create a metadata JSON cell recording dataset version, query parameters, and analysis date.

Part D: Reproducibility check (5 minutes)

  1. Restart kernel and run all cells.
  2. Verify all outputs regenerate correctly.

Outputs

Assessment rubric

Content library references

Teaching resources

Academic references

Quick practice prompt

Add one markdown cell documenting input version, processing steps, and output files. Then write a code cell that queries a synapse table and computes the mean number of synapses per neuron for one brain region.

Teaching Materials

Activity Worksheet

Learner worksheet aligned to the studio activity and rubric.

Open worksheet

Slide Source

Marp source file for editing and rendering.

course/decks/marp/modules/module03.marp.md

Related Content