Would you be willing to spend each night in the company of 300,000 bats — all in the service of science?

UCLA biologist Kenneth Chapin did just that, for several weeks in 2012 and 2014, while conducting research in darkened caves in Puerto Rico. In addition to bats, the habitats were home to snakes, cockroaches and spiders.

He was studying whip spiders, a poorly understood relative of spiders and scorpions. Unlike other spiders, whip spiders do not build webs, and they have very long claws.

“They look terrifying, but are actually delicate, timid and afraid of you,” said Chapin, a UCLA doctoral candidate in ecology and evolutionary biology. “I was more excited than terrified.”

A whip spider made a prominent appearance in the movie version of “Harry Potter and the Goblet of Fire,” when a Hogwarts professor tortures the animal with magic. (In the J.K. Rowling book on which the movie is based, the creature is described as a spider that doesn’t actually exist in nature.)

Scientists know of more than 150 species of whip spiders, whose scientific name is Amblypygi.

Many of Chapin’s findings, along with those of other scientists, were published March 14 (PDF) in the cover article of the Journal of Arachnology. The report synthesizes more than 50 studies of whip spiders. Among the findings:

Whip spiders care for their young. After they mate, the female lays eggs and protects them. When babies hatch, they crawl onto their mother’s back; the mother carries them for a number of weeks, and in some species, may care for them for several months or more.

Fathers seem to have a limited, if any, role in the lives of their babies.

The spiders fight to protect their territory, and are aggressive with one another.

They eat crickets, cockroaches, grasshoppers, small lizards and hummingbirds. Some even eat members of their own species, often at the end of a fight between two adults.

Whip spiders are eaten by bats and large lizards.

They have a good sense of direction and can find their way back to their territory.

They live on all continents, especially in warmer climates, including in deserts, caves and tree trunks. In the U.S., they live in the Southwest and Florida.

Very little was known about whip spiders until 2000, said Chapin, who is interested in how they evolved to live in different environments.

His co-author is Eileen Hebets, a professor of biological sciences at the University of Nebraska, Lincoln.