Neuroscientists are coming closer to understanding why some bad moods seem to tumble uncontrollably through your head like a collapsing chain of dominoes. One misbegotten thought after another drives you to imagine frightful things to come or to relive your shameful past: “Remember that one thing five years ago? Wow, I really am a loser.”

The spiral into such a mood may occur in a brain network that connects two key regions involved with memory and negative emotions, says psychiatrist Vikaas Sohal at the University of California, San Francisco. In a study he co-authored, published in November in Cell, Sohal says he was able to tell if someone’s mood was getting worse just by looking at whether this network was active or not.

Psychiatrists have previously used MRI scans to probe the human brain and the world of emotions within it. This technology can show how brain activity changes within a few seconds, but the brain tends to work a lot faster than that—neurons can fire dozens of times a second. MRI readings might miss things that happen too quickly. Implanted electrodes, however, can measure changes in brain activity up to 1,000 times a second. So when U.C.S.F. neurosurgeon Edward Chang popped into Sohal’s office with an idea to use internal electrodes to elucidate the neurological underpinnings of mood, Sohal was delighted.

The brain surgery needed to implant electrodes is too risky to perform on healthy individuals for a study like this—but Chang works on epilepsy patients who need them anyway. When other treatments do not work, temporarily implanted electrodes can show what part of the brain is causing seizures, allowing Chang to cut that section out during surgery. By asking such patients to report their moods every few hours, the team hoped they could use the electrodes to get a rare window into emotion and the deep brain. “We know that mood is somewhere in the brain,” Sohal says. His goal was “to see if we can find patterns of activity that tell us what mood is.”

Chang implanted electrodes on the surfaces and inside the brains of 21 patients with epilepsy, recording the organs’ activity continuously for seven to 10 days. Then Sohal scoured the recordings for instances when electrodes in different parts of a brain showed identical measurements of electrical activity. “Electrical activity of the brain looks like wiggles” from each electrode when displayed on a graph, Sohal says. “You ask, ‘Okay, do the size of those wiggles and the locations of the peaks go up together in sync across two electrodes?’” If they do, it suggests those brain regions are communicating. “We call that a network,” Sohal says.

One particular network connecting the hippocampus (an area linked to recollection) and the amygdala (an area linked to negative feelings) began appearing over and over, Sohal says. “That was our first big ‘Aha!’ moment.” Whenever these two brain regions created synchronized electrical pulses that fluctuated between 13 to 30 times a second, people reported their moods getting worse. “We basically found that when there is less activity in this network, mood is more positive. When there’s a lot of activity in this network, mood is negative,” Sohal says.

The finding brings scientists closer to understanding how the brain creates bad moods, says Brendon Watson, a psychiatrist and neuroscientist at the University of Michigan who was not involved with the study. “There’s a major open question in psychiatry: How do you construct emotion or mood? People have a very vague idea of what it means to perceive or have an emotion in the brain,” he says, calling the new study “a great step for neuroscience.”

Sohal says his team’s findings spark ideas about how the brain generates negative moods. It is possible, for example, that when these two brain regions work together they create a vicious cycle that drags you down a bad road. “It’s easy to imagine that you might be feeling bad, and then remembering bad experiences, and then feeling worse,” Sohal says. “It’s speculative, but that’s really at the heart of how we think about experiences related to depression and anxiety.”

If that is right, doctors might figure out how to interrupt that cycle with deep-brain stimulation or electroshock therapy for people with major depressive and anxiety disorders, Watson says. “If this is the part of the brain that makes you feel bad, maybe you could reverse how that’s firing and get yourself to feel better,” he says, adding it will be a long slog before this knowledge could be used in the clinic. “You would need to show that the network correlates with depression and bipolar episodes,” he says, “Then study [this therapy] in rats and maybe, if you could convince patients, try studying it in people.”