A theory of neural dimensionality, dynamics, and measurement