If we want to correct a 1d spectrum in fits format barycentrically the script BC_dopplershift_1dspectrum_fit.py is suitable (download here).
The script corrects a 1d spectrum in fits format for the Barycentric
Correction. Displays both spectra in one graphic and writes 3 files
(fit, csv and dat) into the working directory.
The BC is noted in the generated fit.
The graphic is active. By selecting a small section, the original and the corrected spectrum can be distinguished by color: