Specutils offers a neat concept of the spectral_axis which makes it amenable to frequency or wavelength axes, and supports redshifting, etc. We currently use the radial_velocity= feature to let specutils do all the Doppler shifting for us. The problem is that specutils does handle the comparison of two spectra with radial velocities defined:
spec1.radial_velocity = 5*u.km/u.s
spec2.radial_velocity = 7*u.km/u.s
net_spec = spec1-spec2 # How will it handle the velocity?
net_spec.radial_velocity # shows 0.0 km/s
There's a kwarg that can nominally support a callable for what to do with these different spectral axes:
...but I haven't figure out how to make a callable that simply subtracts the Doppler shifted spectra? Other bugs have arisen from the use of radial_velocity and I am simply inclined to immediately make a zero-RV copy of each spectrum with a pristine spectral_axis set to the Doppler shifted wavelength as a permanent workaround. This hacky looking workaround appears to achieve this goal:
Specutils offers a neat concept of the
spectral_axis
which makes it amenable to frequency or wavelength axes, and supports redshifting, etc. We currently use theradial_velocity=
feature to let specutils do all the Doppler shifting for us. The problem is that specutils does handle the comparison of two spectra with radial velocities defined:There's a kwarg that can nominally support a callable for what to do with these different spectral axes:
...but I haven't figure out how to make a callable that simply subtracts the Doppler shifted spectra? Other bugs have arisen from the use of
radial_velocity
and I am simply inclined to immediately make a zero-RV copy of each spectrum with a pristine spectral_axis set to the Doppler shifted wavelength as a permanent workaround. This hacky looking workaround appears to achieve this goal:So I will inject this code directly after the methods that rouch the
radial_velocity