Ephys Workflow: Theta Maze with Sleep Sessions

This tutorial records a chronic Neuropixels experiment in rats, from the first animal to an exported project: a project, four subjects and their cohort, the probe implant with the experimental interface it creates, one day of recordings (sleep, the theta maze task, sleep again) and the collection that groups them. At the end you download the project as a JSON file that the NWB converter reads.

Table of contents

  1. Prerequisites
  2. Part A: Project and Subjects
    1. Step 1: Create the project
    2. Step 2: Add the subjects
    3. Step 3: Record housing and weight
    4. Step 4: Create the cohort
  3. Part B: Surgery and Interfaces
    1. Step 5: Record the Neuropixels implant
    2. Step 5b: Group the surgery into a procedure episode (optional)
    3. Step 6: Create the camera and tracking interfaces
  4. Part C: Recording Sessions
    1. Step 7: Pre-behavior sleep session
    2. Step 8: Theta maze session
    3. Step 9: Post-behavior sleep session
  5. Part D: Organize and Export
    1. Step 10: Create the collection
    2. Step 11: Export the project
  6. Next steps

Prerequisites

  • You are a Contributor of your lab’s group (see Get started! and Manage Groups).
  • The records below exist; this tutorial selects them by these names.

Records you need first

NameKindKey settingsCreated in
Theta Maze RigSetupSetup type Theta mazeLab infrastructure
Sleep Recording BoxSetupWhere the rat sleeps before and after the taskLab infrastructure
Surgical StationSetupWhere the implant surgery is doneLab infrastructure
Neuropixels SystemEquipmentRecords the probeLab infrastructure
Sleep Box CameraEquipmentCamera of the Sleep Recording BoxLab infrastructure
OptiTrack SystemEquipmentMotion tracking of the Theta Maze RigLab infrastructure
Stereotaxic FrameEquipmentFrame of the Surgical StationLab infrastructure
Neural Electrode InventoryInventoryHolds the consumable stock Neuropixels 2.0 probe, status AvailableLab infrastructure
Lab ServerData storageWhere the recordings are storedManaging Data Storage
Theta Maze Alternation TaskBehavioral assaySetup type Theta maze, Behavioral paradigm Delayed Alternation, Authenticated groups your lab groupBehavioral Assays

Required fields are marked with an asterisk (*) in the web interface and in the tables below. Several forms open with a short first step and continue after Create and continue. Subject and session forms then save automatically.

Project, cohort and collection forms do not save automatically. Click Save before you leave them, or the changes are lost (see Forms).

Part A: Project and Subjects

Step 1: Create the project

  1. Go to Projects and click Add project.
  2. Enter Project name (must be unique) * Theta Maze Spatial Learning Study and select your lab group under Authenticated groups. The groups you select get Contributor access.
  3. Click Create and continue, enter the Description “Place cell dynamics and memory consolidation during theta maze alternation, with chronic Neuropixels recordings in rats and sleep before and after each session”, leave Project visibility on Private and click Save.

The form looks as in Get started.

Step 2: Add the subjects

  1. Go to Subjects and click Add subject.
  2. Fill in the first step:
FieldValue
Subject name (must be unique) *TM_R001
Projects *Theta Maze Spatial Learning Study
Sex *Male
Species *Rattus norvegicus
StrainLong-Evans (only strains of the chosen species are listed)
Status *Active

The form looks as in Get started.

  1. Click Create and continue and add Genetic line Wild type, Birth date 2024-05-01 and Subject identifier Red-001 (the ear tag).
  2. Add TM_R002, TM_R003 and TM_R004 the same way, or open TM_R001 and click Duplicate: enter the new name, choose which procedures and logs to copy, click Check copy and then Duplicate.

Step 3: Record housing and weight

  1. Open TM_R001 and click Edit. The Subject Logs panel lists the subject’s logs.
  2. Click Add log, choose Housing log, enter the Description “Housing for the theta maze cohort” and click Next. Fill in the first entry and click Save entry:
FieldValue
Start and end time2024-08-01 08:00:00 (leave the end empty)
LocationAnimal Facility Room 204
Cage IDCage_A1_pair
Light cycle12:12 light-dark cycle (lights on 07:00)
  1. Click Add log again, choose Weighing log, click Next and save an entry with Date and time 2024-08-01 09:00:00 and Weight 385 g.

Later entries go into the same logs with Add entry. The fields of every log type are on the Subject log types page.

Step 4: Create the cohort

  1. Go to Cohorts (below Subjects) and click Add cohort.
  2. Enter Cohort name TM_Learning_Cohort_1, Project Theta Maze Spatial Learning Study and Subjects TM_R001 to TM_R004.
  3. Click Create and continue, add the Description “4 male Long-Evans rats, pair housed, food restricted to 85% of body weight during training” and click Save.

Part B: Surgery and Interfaces

Saving an implant procedure creates an experimental interface on the subject. Sessions record through the interface, so a data acquisition inherits where (target region, coordinates) and with what (materials) it was made. Saving an implant procedure creates an experimental interface on the subject. Sessions record through the interface, so a data acquisition inherits where (target region, coordinates) and with what (materials) it was made.

Step 5: Record the Neuropixels implant

A procedure records the surgery with its coordinates, target regions and materials. Creating a performed Silicon probe implant also creates the experimental interface (the implanted probe) that the recordings refer to.

  1. Go to Subjects → Procedures, click Add procedure and choose Create blank.
  2. Fill in:
FieldValue
Type of procedure *Silicon probe implant
Date and time of the procedure2024-08-15 10:00:00
Subject *TM_R001
SetupSurgical Station (narrows the equipment list)
EquipmentStereotaxic Frame
AtlasWaxholm Space Sprague Dawley Rat Brain Atlas
Target regionsCornu ammonis 1, Dentate gyrus
Status *Performed
NotesChronic Neuropixels 2.0 implant in right dorsal hippocampus.

A silicon probe implant's form: type, date, subject, episode, setup and equipment, atlas and target regions, licenses, protocol, performed by and status.

A silicon probe implant’s form: type, date, subject, episode, setup and equipment, atlas and target regions, licenses, protocol, performed by and status.

  1. Under Details set Dura handling Punctured, Ground placement and Reference placement Over the cerebellum, and Fixation method Dental cement and Anchor screws.
  2. Set Coordinates to Stereotaxic Bregma-Based Absolute Coordinates and enter the probe tip: AP coordinate -3.5 mm, ML coordinate 2.5 mm, DV coordinate 3.6 mm, and 0° for AP angle, ML angle and Rotation. Click View coordinates to check the track in the rat atlas (see Atlases and coordinates).

Choose an absolute Bregma-based system if you plan to export to NWB. The converter writes it as a localization point; surface systems with a depth are not written (see Exporting to NWB).

  1. On the Materials tab click + Add material and add these rows (see Materials):
Material roleMaterial sourceValue
Silicon probe (required)Consumable stockInventory Neural Electrode Inventory, Consumable stock Neuropixels 2.0 probe
Adhesive, cement, or sealantManual entryDental cement
Anchor screw, pin, or fastenerManual entryStainless steel skull screws
The Materials tab of a silicon probe implant: its material rows, and the Add material menu listing the roles this procedure type accepts.

The probe’s sites, channels and spacing come from its design in the probe catalog. Stock quantities are not counted down: set the stock’s Status by hand when the last probe is used.

  1. Click Create. As the form’s notice says, this creates a Silicon probe experimental interface, TM_R001 | Silicon probe implant, listed on the procedure’s Experimental interfaces tab and under Sessions → Experimental interfaces. The procedure appears on the Procedures tab of the subject’s page:

The Procedures tab of a subject's page (here rat R06 Carol): each procedure with its details and its Edit, Duplicate, Template, Delete and API buttons

The Procedures tab of a subject’s page (here rat R06 Carol): each procedure with its details and its Edit, Duplicate, Template, Delete and API buttons

Once the implant has created its interface, the procedure’s Subject is fixed, and its Type of procedure cannot be changed while it has material rows. The interface’s type, installation date, coordinates, target regions and equipment are set by the procedure: change them on the procedure, not on the interface, where they cannot be edited.

A procedure with Status Planned creates no interface, so the recordings below cannot select the probe. Click Mark as performed after the surgery (see Planning).

Step 5b: Group the surgery into a procedure episode (optional)

  1. Add the companion procedures on TM_R001 as in Step 5: Anesthesia (required material Anesthetic agent, for example isoflurane) and Analgesic (material Active agent).
  2. Go to Subjects → Procedures → Procedure episodes, create the episode and attach the three procedures with Link existing.

The episode records the surgery as one perioperative event; see Procedure episodes.

Step 6: Create the camera and tracking interfaces

Every data acquisition names the experimental interface the signal passed through. The sleep camera and the motion tracking system each need one, created once and reused in every session of this rat.

  1. Go to Sessions → Experimental interfaces, click Add experimental interface and choose Create blank.
  2. Fill in one column per interface and click Create and continue:
FieldSleep cameraMotion tracking
Name *TM_R001 sleep box cameraTM_R001 OptiTrack
Target typeSubjectSubject
SubjectTM_R001TM_R001
Interface type *CameraTracking system
Persistence *Chronic / persistentChronic / persistent
EquipmentSleep Box CameraOptiTrack System
DetailsFrame rate (Hz) 30Tracked markers Three reflective markers on the headstage

The types and their details are on the Experimental interface types page.

Part C: Recording Sessions

Step 7: Pre-behavior sleep session

  1. Go to Sessions and click Add session.
  2. Fill in the first step and click Create and continue:
FieldValue
Session name (must be unique) *TM_R001_Day1_PreSleep_Baseline
Session type *Subject
Projects *Theta Maze Spatial Learning Study
SubjectsTM_R001
Status *Performed

The form looks as in Get started.

  1. Add Date and time onset 2024-08-22 09:00:00 (the NWB converter writes no file for a session without an onset; see Exporting to NWB), Data storage Lab Server, Session name in data storage tm_r001_day1_presleep and the Tags baseline, sleep.
  2. On the Data acquisition tab click Add Data acquisition once per recording. Setup only narrows the Equipment list.
FieldNeuropixels recordingSleep video
Type of data acquisition *Extracellular ElectrophysiologyVideo Tracking
EquipmentNeuropixels SystemSleep Box Camera
Experimental interfaces *TM_R001 | Silicon probe implantTM_R001 sleep box camera
File nameTM_R001_Day1_PreSleep_Baseline.datTM_R001_Day1_PreSleep_Baseline.avi
FormatBinaryAVI
Data-typeint16 
Number of channels384 
Sampling rate30 kHz 
Number of samples432000000 (4 hours) 
Frame rate 30 Hz

The Data acquisition tab of a saved session (here rat R02's Reversal 01): a Video Tracking entry and, below it, the session's second data acquisition, an Extracellular Electrophysiology entry with its setup, equipment and experimental interface

The Data acquisition tab of a saved session (here rat R02’s Reversal 01): a Video Tracking entry and, below it, the session’s second data acquisition, an Extracellular Electrophysiology entry with its setup, equipment and experimental interface

  1. On the Epochs tab click Add Epoch and add Habituation (Start 00:00:00, End 00:30:00) and Baseline_sleep (00:30:00 to 04:00:00), relative to the session onset.
  2. Drag both data acquisitions from Link to epochs onto Baseline_sleep (see Epochs). A data acquisition belongs to one epoch only, so link each recording to the epoch that covers it.

Step 8: Theta maze session

  1. Add a session as in Step 7 with Session name (must be unique) TM_R001_Day1_ThetaMaze_Training1, Date and time onset 2024-08-22 14:00:00, Data storage Lab Server and Session name in data storage tm_r001_day1_training1.
  2. On the Behaviors tab click Add Behavior and select Subjects TM_R001, Setup Theta Maze Rig and Behavioral assay Theta Maze Alternation Task. The assay is offered only for a setup of the same setup type.

The Behaviors tab of a saved session (here rat R02's Reversal 01): each behavior names its subjects, behavioral assay and setup

The Behaviors tab of a saved session (here rat R02’s Reversal 01): each behavior names its subjects, behavioral assay and setup

  1. On the Data acquisition tab add:
FieldNeuropixels recordingPosition tracking
Type of data acquisition *Extracellular ElectrophysiologyBehavioral Tracking
EquipmentNeuropixels SystemOptiTrack System
Experimental interfaces *TM_R001 | Silicon probe implantTM_R001 OptiTrack
File nameTM_R001_Day1_ThetaMaze_Training1.datTM_R001_Day1_ThetaMaze_Training1.csv
FormatBinaryCSV
Data-typeint16 
Number of channels384 
Sampling rate30 kHz 
Number of samples216000000 (2 hours) 
Frame rate 120 Hz
  1. On the Epochs tab add Pre_task_rest (00:00:00 to 00:10:00), Task (00:10:00 to 01:50:00) and Post_task_rest (01:50:00 to 02:00:00). Drag the behavior and both acquisitions onto Task. The Timeline shows the result:

The Epochs tab of a saved session (here rat R02's Reversal 01): the timeline of its three epochs with their behavior, data acquisitions and manipulation, and the epochs table below

The Epochs tab of a saved session (here rat R02’s Reversal 01): the timeline of its three epochs with their behavior, data acquisitions and manipulation, and the epochs table below

Step 9: Post-behavior sleep session

  1. Add a session as in Step 7 with Session name (must be unique) TM_R001_Day1_PostSleep_Consolidation, Date and time onset 2024-08-22 16:00:00 and Data storage Lab Server.
  2. Add the two data acquisitions of Step 7 with this session’s file names and Number of samples 648000000 (6 hours).
  3. Add the epochs Post_task_rest (00:00:00 to 01:00:00) and Sleep (01:00:00 to 06:00:00), and drag both acquisitions onto Sleep.

Part D: Organize and Export

Step 10: Create the collection

  1. Go to Collections (below Sessions) and click Add collection.
  2. Enter Collection name TM_R001_Learning_Week1, Project Theta Maze Spatial Learning Study and the three Sessions of Steps 7 to 9.
  3. Click Create and continue, add the Tags learning, week1 and click Save.

Step 11: Export the project

  1. Open the project’s page and click Export → Download project data.
  2. Choose File format JSON and Contents Whole project (a single session suits one NWB file).
  3. Click Download.

The options and limits are on Exports and reports. Exporting to NWB converts the file; scripts can request the same export with the Python API tool.

You now have a project with a cohort of four rats; the implant of TM_R001 with its materials and the probe interface it created; camera and tracking interfaces; three sessions of day 1 with their data acquisitions, behavior and epochs, linked to the Lab Server; a collection that groups them; and a JSON export of the project.

Next steps