For the calculation of the BC, a slight modification of a procedure from PyAstronomy is presented below. The script BC.py (download here) uses the module pyasl from PyAstronomy. The coordinates of the object and the observer as well as the time of observation as JD are required.
The script considers two practically important cases:
1. you want to calculate the BC for one spectrum. The input data is queried one after the other (Part I).
2. you have a series of 1d spectra of an object for which BC corrections are to be calculated. Then the observer and object coordinates are constant, only the observation time varies. Then it is easier to use part II of the script and enter the parameters in the script (comment out part I before).
In addition to the BC and heliocentric correction, many (interesting) intermediate values are output beforehand. This can be changed by setting the debug parameter to False.