This protocol details habituation of animals and behavioral training of animals for in vivo electrophysiology or optogenetic experiments.