Ephys Workflow: Theta Maze with Sleep Sessions

Introduction

This tutorial walks through a complete electrophysiology experiment in BrainSTEM, from subject preparation to data analysis. We’ll document a multi-day theta maze learning study with sleep sessions, demonstrating how to integrate subjects, procedures, behavioral paradigms, data acquisition, manipulations, and collections in a realistic research workflow.

Experimental Design Overview:

  • Subjects: Rat cohort for spatial learning study
  • Setup: Theta maze with ceiling-mounted camera and OptiTrack 3D tracking
  • Sessions: Pre-behavior sleep → Theta maze behavior → Post-behavior sleep
  • Data: Neuropixels recordings, behavioral video, 3D position tracking
  • Analysis: Learning curves, replay detection, place cell analysis

This tutorial assumes that the lab infrastructure is already set up (setups, equipment, inventories) as described in the Setting Up Lab Infrastructure tutorial.

Part A: Project and Subject Setup

Step 1: Creating the Research Project

First, we’ll create a project to organize and provide context for our experimental work. The project submission is split in two steps. First, you fill in required details, after which you can add other details. Required fields are highlighted with an asterix (*) in the web interface and this tutorial.

  1. Navigate to Projects:
    • Go to Projects
    • Click Add project

Project creation interface

  1. Configure Project Details:
FieldValue
Name *Theta Maze Spatial Learning Study
DescriptionInvestigating hippocampal place cell dynamics and memory consolidation during spatial learning using theta maze behavioral paradigm with simultaneous Neuropixels recordings in freely moving rats.
Authenticated GroupsSelect groups that should have access to this project
Public AccessNo (keep project private to lab)

Once submitted other details can be added. Additional project details like PI name, funding source, IACUC protocol numbers, and timeline information can be included in the project description or managed through your lab’s separate project management systems. Authenticated groups will get contribute permissions. You can add additional groups or change permissions in the manage page: Go to Project detail pageManage

Step 2: Adding Individual Subjects

Now we’ll add individual rats that will participate in our study.

  1. Navigate to Add Subject:
    • Go to Subjects
    • Click Add subject

Subject creation form

  1. Subject Configuration Example:
FieldValue
Name *TM_R001
Projects *Select: Theta Maze Spatial Learning Study
Sex *Male
Species *Select: Rattus norvegicus
Strain *Select: Long-Evans
DescriptionMale Long-Evans rat for theta maze spatial learning study with Neuropixels recordings
Genetic LineWild type
Birth Date2024-05-01
Subject IdentifierRed-001 (ear tag number)

Repeat this process to create additional subjects:

  • TM_R002, TM_R003, TM_R004 (for a cohort of 4 rats)
  • Use similar configurations but update IDs, ear tags

The additional subjects can be duplicated from the first subject. Go to the Subject detail page of the first subjectDuplicate Fill in the new subject name and click Duplicate. After this you can alter other fields if necessary.

Step 2b: Document Initial Housing and Weight

After creating subjects, document their housing conditions and initial weights using subject logs.

  1. Create Housing Log:
    • Go to Subject logs (below Subjects)
    • Click Add subject log

Housing Log Configuration:

FieldValue
TypeHousing log
SubjectSelect: TM_R001
DescriptionInitial housing assignment for experimental cohort

Type-specific Details:

FieldValue
Start and end time2024-08-01 08:00:00 to 2024-12-31 18:00:00
NotesPair-housed with TM_R002. Standard rat cages with enrichment.
LocationAnimal Facility Room 204
Cage IDCage_A1_pair
Cage typeNexGen Rat 1800
Light cycle12:12 light-dark cycle (lights on 07:00)
EnrichmentPaper tubes, wooden chew blocks

Only the start time is required, so you can leave the end time blank.

  1. Create Initial Weighing Log:

Weighing Log Configuration:

FieldValue
TypeWeighing log
SubjectSelect: TM_R001

Type-specific Details:

FieldValue
Weight (grams)385
Date and time2024-08-01 09:00:00
NotesPre-experiment baseline weight. Animal healthy and active.

Step 3: Creating the Experimental Cohort

After creating individual subjects, we can group them into a cohort for experimental organization.

  1. Navigate to Cohorts:
    • Go to Cohorts (below Subjects)
    • Click Add cohort

Cohort creation form

  1. Configure Cohort Details:
FieldValue
NameTM_Learning_Cohort_1
ProjectSelect: Theta Maze Spatial Learning Study
SubjectsSelect: TM_R001, TM_R002, TM_R003, TM_R004
DescriptionFirst experimental cohort for theta maze spatial learning study. 4 male Long-Evans rats, age-matched littermates, trained on alternation task with Neuropixels recordings. Pair housed, 12:12 light cycle, food restricted to 85% body weight during training.
Tagstheta maze, spatial learning, neuropixels, male rats

Step 4: Equipment and Setup Verification

Verify your theta maze setup includes all necessary equipment:

Equipment list view filtered by setup

Required Equipment:

  • Neuropixels data acquisition system (IMEC - Neuropixels OneBox)
  • Ceiling-mounted camera for behavioral tracking (Basler - acA640-90uc)
  • OptiTrack motion capture system for 3D head tracking (6+ cameras OptiTrack - Flex 13)

Step 5: Neuropixels Probe Implantation Procedure

Document the surgical procedure for Neuropixels probe implantation.

  1. Navigate to Procedures:
    • Go to Subjects (below Subjects)
    • Click Edit for subject TM_R001

Procedure view

  1. Procedure Configuration:

Basic Information:

FieldValue
TypeSilicon probe implant
SubjectSelect: TM_R001
Date and Time2024-08-15 10:00:00
SetupSelect: Surgical Station
EquipmentSelect: Stereotaxic Frame
InventorySelect: Neural Electrode Inventory
Consumable StockSelect: Neuropixels 2.0 probe
AtlasAllen Mouse Brain Atlas
Brain RegionHIP: Hippocampal region
NotesChronic Neuropixels probe implantation targeting CA1/CA3 hippocampus.
Coordinates SystemStereotaxic Bregma-Based Surface Coordinates with Depth

Coordinate Details:

FieldValue
AP coordinate (mm)-3.5
ML coordinate (mm)+2.5
DV coordinate (mm)2.0 (initial insertion depth)
AP angle
ML angle
Rotation

Probe specifications (Neuropixels 2.0: 960 total sites, 384 recording sites, 20 μm spacing, etc.) are documented in the consumable stock entry, not in the procedure record. You can also document the Isoflurane anesthesia, Head fixation, Craniotomy, and the Headcap, but we will leave that out for brevity.

Part B: Multi-Session Experimental Workflow

Step 6: Pre-Behavior Sleep Session

After recovery, we begin with a baseline sleep recording.

  1. Navigate to Sessions:
    • Go to Sessions
    • Click Add session
  1. Sleep Session Configuration:

Basic Session Information:

FieldValue
NameTM_R001_Day1_PreSleep_Baseline
ProjectsSelect: Theta Maze Spatial Learning Study
DescriptionBaseline sleep recording before theta maze training. 4-hour session to capture natural sleep-wake cycles and establish baseline neural activity patterns.
Date_time_onset2024-08-22 09:00:00
Tagsbaseline, sleep, pre-training, neuropixels

Sessions don’t have subject, setup, duration, or behavioral paradigm fields directly. These are specified in the Behavior, Data acquisition and Epoch tabs within the session.

Data Acquisition - Extracellular Recording:

SettingValue
TypeExtracellular Electrophysiology
Subject proceduresSelect: TM_R001 : Silicon probe implant : Neuropixels Implantation
SetupSelect: Sleep Recording Box
EquipmentSelect: Neuropixels System
File nameTM_R001_Day1_PreSleep_Baseline.dat
FormatBinary
Data-typeint16
Number of channels384
Sampling rate (Hz)30000
Least significant bit (μV/bit)0.195

Data Acquisition - Video:

SettingValue
SessionSelect: TM_R001_Day1_PreSleep
TypeVideo Tracking
ProceduresSelect: TM_R001 : Silicon probe implant : Neuropixels Implantation
SetupSelect: Sleep Recording Box
EquipmentSelect: Sleep Box Camera
NotesSleep state monitoring

Session Epochs:

Epoch NameStart (min)Duration (min)Description
Habituation030Adaptation to recording environment
Baseline_recording30210Continuous sleep/wake recording (3.5 hours)

Step 7: Theta Maze Behavioral Session

The main experimental session combining behavior with neural recording.

  1. Behavioral Paradigm Setup:
FieldValue
NameTheta Maze Alternation Task
Environment TypeTheta maze
Authenticated GroupsSelect your lab groups
DescriptionForced alternation task in theta maze. Rats navigate alternating left/right arms to receive food rewards. Trial duration 180s, inter-trial interval 45s, total 40 trials per session. Performance criteria: 80% correct, minimum 15 trials for learning threshold.
Public AccessNo
  1. Complete Session Configuration:

Basic Session Information:

FieldValue
NameTM_R001_Day1_ThetaMaze_Training1
ProjectsSelect: Theta Maze Spatial Learning Study
DescriptionFirst day theta maze behavioral training with Neuropixels recording
Date_time_onset2024-08-22 14:00:00
Tagsbehavior, theta-maze, training, day1
Data_storage/data/neuropixels/tm_r001/

Data Acquisition - Extracellular Recording:

SettingValue
SessionSelect: TM_R001_Day1_Behavior
TypeExtracellular Electrophysiology
ProceduresSelect: Neuropixels Implantation
SetupSelect: Theta Maze Rig
EquipmentSelect: Neuropixels System
FormatBinary
Data-typeint16
Number of channels384
Sampling rate (Hz)30000
Number of samples216000000
Least significant bit (μV/bit)0.195

Data Acquisition - Video:

SettingValue
SessionSelect: TM_R001_Day1_Behavior
TypeVideo
ProceduresSelect: Neuropixels Implantation
SetupSelect: Theta Maze Rig
EquipmentSelect: Ceiling Camera
NotesBehavioral video recording with LED tracking

Data Acquisition - Position Tracking:

SettingValue
SessionSelect: TM_R001_Day1_Behavior
TypeBehavioral Tracking
ProceduresSelect: Neuropixels Implantation
SetupSelect: Theta Maze Rig
EquipmentSelect: OptiTrack System
NotesHead and body position tracking with LED markers

Session Epochs:

Epoch NameStart (min)Duration (min)Description
Pre_task_baseline010Open field exploration before task
Training_trials1060Forced alternation training trials (longer for rats)
Free_choice_trials7040Free choice alternation test (longer for rats)
Post_task_rest11010Rest period after task completion

Step 8: Adding Manipulations (Optional)

For experiments with optogenetic or pharmacological manipulations.

Manipulation Configuration:

Basic Information:

FieldValue
SessionSelect: TM_R001_Day1_Behavior
TypeOptogenetic stimulation
ProceduresSelect: Neuropixels Implantation
SetupSelect: Theta Maze Rig
EquipmentSelect: Yellow Laser System
NotesPV interneuron silencing during choice trials

Type-specific Details:

ParameterValue
Power (mW)10.0
Amplitude (A)0.5
Stimulation profileContinuous
Duration (s)0.5
Duty cycle1.0
Repetitions40
Wavelength (nm)589
Closed loopfalse

Step 9: Post-Behavior Sleep Session

Capture sleep-dependent replay and consolidation.

Post-Sleep Session Configuration:

Basic Session Information:

FieldValue
NameTM_R001_Day1_PostSleep_Consolidation
ProjectsSelect: Theta Maze Spatial Learning Study
DescriptionPost-behavior sleep session for memory consolidation recording
Date_time_onset2024-08-22 16:00:00
Tagspostsleep, consolidation, replay
Data_storage/data/neuropixels/tm_r001/

Data Acquisition - Extracellular Recording:

SettingValue
SessionSelect: TM_R001_Day1_PostSleep_Consolidation
TypeExtracellular Electrophysiology
ProceduresSelect: Neuropixels Implantation
SetupSelect: Sleep Recording Box
EquipmentSelect: Neuropixels System
FormatBinary
Data-typeint16
Number of channels384
Sampling rate (Hz)30000
Number of samples648000000

Session Epochs:

Epoch NameStart (min)Duration (min)Description
Post_behavior_rest060Immediate post-behavior period
Sleep_recording60300Extended sleep/replay recording (5 hours)

Part C: Data Organization and API access

Step 10: Creating Collections

Group related sessions for analysis and organization.

Collection Configuration:

FieldValue
NameTM_R001_Learning_Week1
ProjectSelect: Theta Maze Spatial Learning Study
SessionsSelect: TM_R001_Day1_PreSleep_Baseline, TM_R001_Day1_ThetaMaze_Training1, TM_R001_Day1_PostSleep_Consolidation
DescriptionFirst week of theta maze training for subject TM_R001. Collection includes presleep baseline, behavioral training session, and postsleep consolidation recording.
Tagslearning, spatial_memory, hippocampus, week1, place_cells

Step 11: API Data Access for Analysis

Access your experimental data programmatically for analysis.

from brainstem_api_client import BrainstemClient

client = BrainstemClient()

# Get all sessions for a subject
subject_sessions = client.load_model('session', 
                                   filters={'subject__name': 'TM_R001'}).json()

# Get behavioral performance data
behavior_data = client.load_model('behavioralparadigm',
                                filters={'session__subject__name': 'TM_R001'}).json()

# Get neural data file paths
neural_files = client.load_model('dataacquisition',
                               filters={'session__subject__name': 'TM_R001',
                                      'type': 'Extracellular'}).json()

# Download specific session data
session_data = client.load_model('session', filters={'name': 'tm_r001_day1_behavior_id'})

Next Steps

After completing this comprehensive electrophysiology workflow, consider these logical progressions:

  • Access data programmatically: Master the Python API tool or MATLAB API tool to automate analysis workflows for your large-scale electrophysiology datasets
  • Understand behavioral documentation: Review Behavioral Paradigms to understand how behavioral protocols are documented and standardized across experiments
  • Optimize data management: Learn about Managing Data Storage to efficiently organize and access your large electrophysiology datasets with proper file linking
  • Enable data sharing: Use Sharing Project Publicly to make your electrophysiology datasets available to the research community for collaborative analysis and meta-studies