“Lectures, classes, I can pretty much sleep anywhere,” Dr. Foreman said. “But it’s not usually a great sleep. It’s more the nodding off.”

Both doctors met at the end of a long workweek after Dr. Foreman had been up every night dealing with his son’s cold. As Dr. Foreman yawned, Dr. Bazil had a technician attach 25 multicolored plastic wires to Dr. Foreman’s head, connecting them to a monitor slightly larger than an iPod to track his brain waves. Then Dr. Foreman covered the wires with a long sock and a winter hat.

The pair got onto a southbound A train at 207th Street. After Dr. Foreman chose a corner seat, Dr. Bazil sat across from him to take notes. When the train left the station at 6:09 p.m., it seemed unlikely that Dr. Foreman would get any sleep. The train’s operator screeched the cars along as if she were training for Formula One. She shouted into the loudspeakers that her train was late, and peeled from stop to stop.

Dr. Foreman yawned, folded his arms, crossed his legs and shut his eyes. He opened his eyes when the train stopped. His eyes fluttered when several neurologists boarded and chatted over his shoulder. The train jostled. He opened his eyes and yawned deeply.

By 6:18 p.m., two minutes after Dr. Foreman left the 168th Street station, he looked as if he was falling asleep. He first held his head up and kept his arms crossed. But he let his head nod back and forth slightly. Then his head fell, and he dozed until 59th Street — no doubt aided by the uninterrupted run from 125th Street. As the doors opened at 59th Street, Dr. Foreman jumped up and hopped off the train.

After they briefly celebrated what looked like a successful subway nap, the doctors boarded an uptown train to see if Dr. Foreman could fall asleep again. Dr. Foreman found a seat lodged between two passengers. He put on his jacket hood, crossed his legs, folded his arms and let his head fall. While the conductor was quieter on this train, Dr. Foreman could not get back to sleep. At 145th Street, when a vendor stood before him and shouted that he was selling four DVDs for $10, Dr. Foreman opened his eyes widely.