@u.quantity_input(velocity=(u.km / u.s))
def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False):
    "\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        "
    if ((self.observer is None) or (self.target is None)):
        raise ValueError('This method can only be used if both observer and target are defined on the SpectralCoord.')
    if isinstance(frame, SkyCoord):
        frame = frame.frame
    if isinstance(frame, BaseCoordinateFrame):
        if (not frame.has_data):
            frame = frame.realize_frame(CartesianRepresentation((0 * u.km), (0 * u.km), (0 * u.km)))
        if frame.data.differentials:
            if (velocity is not None):
                raise ValueError('frame already has differentials, cannot also specify velocity')
        else:
            if (velocity is None):
                differentials = ZERO_VELOCITIES
            else:
                differentials = CartesianDifferential(velocity)
            frame = frame.realize_frame(frame.data.with_differentials(differentials))
    if isinstance(frame, (type, str)):
        if isinstance(frame, type):
            frame_cls = frame
        elif isinstance(frame, str):
            frame_cls = frame_transform_graph.lookup_name(frame)
        if (velocity is None):
            velocity = (((0 * u.m) / u.s), ((0 * u.m) / u.s), ((0 * u.m) / u.s))
        elif (velocity.shape != (3,)):
            raise ValueError('velocity should be a Quantity vector with 3 elements')
        frame = frame_cls((0 * u.m), (0 * u.m), (0 * u.m), *velocity, representation_type='cartesian', differential_type='cartesian')
    observer = update_differentials_to_match(self.observer, frame, preserve_observer_frame=preserve_observer_frame)
    init_obs_vel = self._calculate_radial_velocity(self.observer, self.target, as_scalar=True)
    fin_obs_vel = self._calculate_radial_velocity(observer, self.target, as_scalar=True)
    new_data = _apply_relativistic_doppler_shift(self, (fin_obs_vel - init_obs_vel))
    new_coord = self.replicate(value=new_data, observer=observer)
    return new_coord
A new  `SpectralCoord` with the velocity of the observer altered,
but not the position.

If a coordinate frame is specified, the observer velocities will be
modified to be stationary in the specified frame. If a coordinate
instance is specified, optionally with non-zero velocities, the
observer velocities will be updated so that the observer is co-moving
with the specified coordinates.

Parameters
----------
frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`
    The observation frame in which the observer will be stationary. This
    can be the name of a frame (e.g. 'icrs'), a frame class, frame instance
    with no data, or instance with data. This can optionally include
    velocities.
velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional
    If ``frame`` does not contain velocities, these can be specified as
    a 3-element `~astropy.units.Quantity`. In the case where this is
    also not specified, the velocities default to zero.
preserve_observer_frame : bool
    If `True`, the final observer frame class will be the same as the
    original one, and if `False` it will be the frame of the velocity
    reference class.

Returns
-------
new_coord : `SpectralCoord`
    The new coordinate object representing the spectral data
    transformed based on the observer's new velocity frame.
@u.quantity_input(velocity=(u.km / u.s))
def with_observer_stationary_relative_to(self, frame, velocity=None, preserve_observer_frame=False):
    "\n        A new  `SpectralCoord` with the velocity of the observer altered,\n        but not the position.\n\n        If a coordinate frame is specified, the observer velocities will be\n        modified to be stationary in the specified frame. If a coordinate\n        instance is specified, optionally with non-zero velocities, the\n        observer velocities will be updated so that the observer is co-moving\n        with the specified coordinates.\n\n        Parameters\n        ----------\n        frame : str, `~astropy.coordinates.BaseCoordinateFrame` or `~astropy.coordinates.SkyCoord`\n            The observation frame in which the observer will be stationary. This\n            can be the name of a frame (e.g. 'icrs'), a frame class, frame instance\n            with no data, or instance with data. This can optionally include\n            velocities.\n        velocity : `~astropy.units.Quantity` or `~astropy.coordinates.CartesianDifferential`, optional\n            If ``frame`` does not contain velocities, these can be specified as\n            a 3-element `~astropy.units.Quantity`. In the case where this is\n            also not specified, the velocities default to zero.\n        preserve_observer_frame : bool\n            If `True`, the final observer frame class will be the same as the\n            original one, and if `False` it will be the frame of the velocity\n            reference class.\n\n        Returns\n        -------\n        new_coord : `SpectralCoord`\n            The new coordinate object representing the spectral data\n            transformed based on the observer's new velocity frame.\n        "
    if ((self.observer is None) or (self.target is None)):
        raise ValueError('This method can only be used if both observer and target are defined on the SpectralCoord.')
    if isinstance(frame, SkyCoord):
        frame = frame.frame
    if isinstance(frame, BaseCoordinateFrame):
        if (not frame.has_data):
            frame = frame.realize_frame(CartesianRepresentation((0 * u.km), (0 * u.km), (0 * u.km)))
        if frame.data.differentials:
            if (velocity is not None):
                raise ValueError('frame already has differentials, cannot also specify velocity')
        else:
            if (velocity is None):
                differentials = ZERO_VELOCITIES
            else:
                differentials = CartesianDifferential(velocity)
            frame = frame.realize_frame(frame.data.with_differentials(differentials))
    if isinstance(frame, (type, str)):
        if isinstance(frame, type):
            frame_cls = frame
        elif isinstance(frame, str):
            frame_cls = frame_transform_graph.lookup_name(frame)
        if (velocity is None):
            velocity = (((0 * u.m) / u.s), ((0 * u.m) / u.s), ((0 * u.m) / u.s))
        elif (velocity.shape != (3,)):
            raise ValueError('velocity should be a Quantity vector with 3 elements')
        frame = frame_cls((0 * u.m), (0 * u.m), (0 * u.m), *velocity, representation_type='cartesian', differential_type='cartesian')
    observer = update_differentials_to_match(self.observer, frame, preserve_observer_frame=preserve_observer_frame)
    init_obs_vel = self._calculate_radial_velocity(self.observer, self.target, as_scalar=True)
    fin_obs_vel = self._calculate_radial_velocity(observer, self.target, as_scalar=True)
    new_data = _apply_relativistic_doppler_shift(self, (fin_obs_vel - init_obs_vel))
    new_coord = self.replicate(value=new_data, observer=observer)
    return new_coord