Measuring and modeling whole-brain neural dynamics in Caenorhabditis elegans