Mary Shelley had idea for famous novel in response to a challenge from Lord Byron to begin a ghost story

Texas astronomers have used the light of the moon to highlight the hour of creation for Victor Frankenstein and his notorious monster – and defend the memory of their teenage creator, Mary Shelley.

The inspiration came in a waking dream between 2am and 3am on the morning of 16 June, 1816, during a stormy summer on Lake Geneva, they explain in the November issue of Sky and Telescope.

In the preface to the third edition of Frankenstein Shelley described a villa party: Lord Byron, Percy Shelley, herself and Byron's physician Polidori, and the famous challenge by Byron that each of them should begin a ghost story. She also described her repeated inability to come up with an idea until a moment of inspiration during a sleepless night in her dark room, behind closed shutters "with the moonlight struggling to get through".

And then, she continued: "I saw with shut eyes, but acute mental vision – I saw the pale student of unhallowed arts kneeling beside the thing he had put together. I saw the hideous phantasm of a man stretched out, and then, on the working of some powerful engine, show signs of life …"

The two poets soon lost interest. Polidori picked up an idea of Byron's and much later launched another genre with a Gothic thriller called The Vampyre. He also kept a diary of his days with Byron and some enigmatic entries have prompted scholars and biographers to suggest that to enhance sales Mary Shelley might have composed yet another fiction about the chronology of literary creation. Did Byron make his famous challenge on 16 June? Was Mary Shelley, only 18 at the time, writing the next day?

Or did she spend several days agonising and think of her tale on 22 June?

"Our calculations show that can't be right, because there wouldn't be any moonlight," says Donald Olson, from Texas State University in San Marcos. Just as astronomers can predict sunrise, lunar cycles and tides decades ahead, they can say when they happened centuries in the past. Prof Olson has already used astronomical tables and geographic reference points to fix the time, date and location of paintings by Edvard Munch and Vincent van Gogh; to propose revised timings for the Battle of Marathon in 490BC and Caesar's invasion of Britain in 55BC; and even to confirm a freak Breton tide mentioned in Chaucer's The Franklin's Tale.

In August 2010, Professor Olson, two colleagues and two students went to Lake Geneva to discover when moonlight would have hit the windows, and penetrated the shutters, of Mary Shelley's bedroom. The answer required a visit to the villa, still in private ownership, a study of the terrain, and perusal of weather records.

Shelley reports that she stayed up beyond the "witching hour" of midnight. By 22 June, the moon would then have been a waning crescent, masked by a hillside. But a bright, gibbous moon would have cleared the hillside to shine into Mary Shelley's bedroom window just before 2am on 16 June.

So Shelley's version of events is supported by evidence. Byron probably made his famous ghost story challenge somewhere between 10 and 13 June, 1816. On 15 June, according to both Polidori and Mary Shelley, the party talked about the "principle" of life. The monster and the tormented scientist were dreamed up in the small hours of that night.

"Mary Shelley wrote about moonlight shining through her window, and for 15 years I wondered if we could recreate that night," says Prof Olson. "We did recreate it. We see no reason to doubt her account."