I know that the speed/acceleration of a star can be measured using redshift/blueshift caused by the motion of stars, but I just learned that gravitation also causes redshift and blueshift. Would this not cause some uncertainty into the determining how fast a star is moving away from us? If so, how do astronomers take it into account? Specifically what I mean is, light coming out of a "gravity well" is redshifted if I'm not mistaken, so if a star is moving toward us, it's light should be blueshifted, but the gravitation also pushes it to be redshifted. Presumably there would be a case where the effects could cancel. So how do you acquire accurate measurements? Thanks!