If you want to determine the relative shift (e.g. due to the Doppler effect) of two overlapping spectral sections, one method is cross correlation. Here, the „target“ spectrum is systematically shifted over the „template“ and the overlapping area is calculated as an integral. This results in the cross correlation function, whose maximum means maximum overlap (coverage) and thus represents the most probable Doppler shift. Absorption lines, which are present in one spectrum, in the other not (e.g. terrestrial lines are not contained in a theoretical, calculated spectrum), disturb the evaluation, because they change the CC function. Terr. lines are also unfavorable if spectra measured at different points in time are compared barycentrically corrected, in which the star spectrum is Doppler shifted, but the terrestrial absorption lines are shifted in time with the barycentric correction. Therefore, it is better to use spectrum sections that contain weak or no terrestrial lines, to delete interfering lines (replace their flux by 1 = continuum) or to free the spectra as far as possible from the terrestrial absorptions („drying“).
For the determination of radial velocities of stars, a previous barycentric correction is required for all spectra involved.
To perform cross-correlations for fit-files and ascii-files, download the Pythonscript here.