def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):
    "\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity`\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity`\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        "
    if ((observer_shift is not None) and ((self.target is None) or (self.observer is None))):
        raise ValueError('Both an observer and target must be defined before applying a velocity shift.')
    for arg in [x for x in [target_shift, observer_shift] if (x is not None)]:
        if (isinstance(arg, u.Quantity) and (not arg.unit.is_equivalent((u.one, KMS)))):
            raise u.UnitsError("Argument must have unit physical type 'speed' for radial velocty or 'dimensionless' for redshift.")
    if (target_shift is None):
        if ((self._observer is None) or (self._target is None)):
            return self.replicate()
        target_shift = (0 * KMS)
    else:
        target_shift = u.Quantity(target_shift)
        if (target_shift.unit.physical_type == 'dimensionless'):
            target_shift = _redshift_to_velocity(target_shift)
        if ((self._observer is None) or (self._target is None)):
            return self.replicate(value=_apply_relativistic_doppler_shift(self, target_shift), radial_velocity=(self.radial_velocity + target_shift))
    if (observer_shift is None):
        observer_shift = (0 * KMS)
    else:
        observer_shift = u.Quantity(observer_shift)
        if (observer_shift.unit.physical_type == 'dimensionless'):
            observer_shift = _redshift_to_velocity(observer_shift)
    target_icrs = self._target.transform_to(ICRS())
    observer_icrs = self._observer.transform_to(ICRS())
    pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)
    target_velocity = (_get_velocities(target_icrs) + (target_shift * pos_hat))
    observer_velocity = (_get_velocities(observer_icrs) + (observer_shift * pos_hat))
    target_velocity = CartesianDifferential(target_velocity.xyz)
    observer_velocity = CartesianDifferential(observer_velocity.xyz)
    new_target = target_icrs.realize_frame(target_icrs.cartesian.with_differentials(target_velocity)).transform_to(self._target)
    new_observer = observer_icrs.realize_frame(observer_icrs.cartesian.with_differentials(observer_velocity)).transform_to(self._observer)
    init_obs_vel = self._calculate_radial_velocity(observer_icrs, target_icrs, as_scalar=True)
    fin_obs_vel = self._calculate_radial_velocity(new_observer, new_target, as_scalar=True)
    new_data = _apply_relativistic_doppler_shift(self, (fin_obs_vel - init_obs_vel))
    return self.replicate(value=new_data, observer=new_observer, target=new_target)
Apply a velocity shift to this spectral coordinate.

The shift can be provided as a redshift (float value) or radial
velocity (`~astropy.units.Quantity` with physical type of 'speed').

Parameters
----------
target_shift : float or `~astropy.units.Quantity`
    Shift value to apply to current target.
observer_shift : float or `~astropy.units.Quantity`
    Shift value to apply to current observer.

Returns
-------
`SpectralCoord`
    New spectral coordinate with the target/observer velocity changed
    to incorporate the shift. This is always a new object even if
    ``target_shift`` and ``observer_shift`` are both `None`.
def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):
    "\n        Apply a velocity shift to this spectral coordinate.\n\n        The shift can be provided as a redshift (float value) or radial\n        velocity (`~astropy.units.Quantity` with physical type of 'speed').\n\n        Parameters\n        ----------\n        target_shift : float or `~astropy.units.Quantity`\n            Shift value to apply to current target.\n        observer_shift : float or `~astropy.units.Quantity`\n            Shift value to apply to current observer.\n\n        Returns\n        -------\n        `SpectralCoord`\n            New spectral coordinate with the target/observer velocity changed\n            to incorporate the shift. This is always a new object even if\n            ``target_shift`` and ``observer_shift`` are both `None`.\n        "
    if ((observer_shift is not None) and ((self.target is None) or (self.observer is None))):
        raise ValueError('Both an observer and target must be defined before applying a velocity shift.')
    for arg in [x for x in [target_shift, observer_shift] if (x is not None)]:
        if (isinstance(arg, u.Quantity) and (not arg.unit.is_equivalent((u.one, KMS)))):
            raise u.UnitsError("Argument must have unit physical type 'speed' for radial velocty or 'dimensionless' for redshift.")
    if (target_shift is None):
        if ((self._observer is None) or (self._target is None)):
            return self.replicate()
        target_shift = (0 * KMS)
    else:
        target_shift = u.Quantity(target_shift)
        if (target_shift.unit.physical_type == 'dimensionless'):
            target_shift = _redshift_to_velocity(target_shift)
        if ((self._observer is None) or (self._target is None)):
            return self.replicate(value=_apply_relativistic_doppler_shift(self, target_shift), radial_velocity=(self.radial_velocity + target_shift))
    if (observer_shift is None):
        observer_shift = (0 * KMS)
    else:
        observer_shift = u.Quantity(observer_shift)
        if (observer_shift.unit.physical_type == 'dimensionless'):
            observer_shift = _redshift_to_velocity(observer_shift)
    target_icrs = self._target.transform_to(ICRS())
    observer_icrs = self._observer.transform_to(ICRS())
    pos_hat = SpectralCoord._normalized_position_vector(observer_icrs, target_icrs)
    target_velocity = (_get_velocities(target_icrs) + (target_shift * pos_hat))
    observer_velocity = (_get_velocities(observer_icrs) + (observer_shift * pos_hat))
    target_velocity = CartesianDifferential(target_velocity.xyz)
    observer_velocity = CartesianDifferential(observer_velocity.xyz)
    new_target = target_icrs.realize_frame(target_icrs.cartesian.with_differentials(target_velocity)).transform_to(self._target)
    new_observer = observer_icrs.realize_frame(observer_icrs.cartesian.with_differentials(observer_velocity)).transform_to(self._observer)
    init_obs_vel = self._calculate_radial_velocity(observer_icrs, target_icrs, as_scalar=True)
    fin_obs_vel = self._calculate_radial_velocity(new_observer, new_target, as_scalar=True)
    new_data = _apply_relativistic_doppler_shift(self, (fin_obs_vel - init_obs_vel))
    return self.replicate(value=new_data, observer=new_observer, target=new_target)