A Simple Code for Rotational Broadening of Broad Wavelength Range High-Dispersion Spectra

In high dispersion spectra of rotating bodies such as stars and planets, the rotation contributes significantly to, and sometimes dominates, the line broadening. We present a simple method for rotationally broadening large wavelength ranges of high-dispersion spectra. The broadening is rapid and scales linearly with the length of the spectrum array. For large wavelength ranges, the method is much faster than the popular convolution-based broadening. We provide the code implementation of this method in a publicly accessible repository.


INTRODUCTION
As faster and more intricate techniques for fitting and modeling high-dispersion spectra develop, one step in the calculation that is often overlooked is the rotational broadening of templates or models. A popular technique to rapidly broaden a small region of a spectrum is to convolve the spectrum by the kernel prescribed in Gray (2005).
Unfortunately this method typically relies on a wavelength grid that is sampled at constant dλ and computes the Doppler shifts in wavelength space. This is only valid for a small region of the spectrum, ∆v ∼ 3000 km s −1 , where the wavelength dependence of the Doppler shift is small and can be ignored.
In order to apply the method to larger wavelength ranges accurately, the spectrum must be separated into many smaller ∆v ∼ 3000 km s −1 arrays which are each broadened then reassembled into a single broadened spectrum. Even a single echelle order on Keck/HIRES or other similar highdispersion spectrographs must be separated into at least two segments for accurate convolutional broadening.
In this note we present a simple code which directly integrates the stellar (or planetary) disk, allowing for accurate rotational broadening across a broad wavelength range.

BROADENING BY DIRECT INTEGRATION
Rotational broadening by direct integration is relatively simple and the time taken for the broadening depends mainly linearly on the length of the vector being broadened.
We compute the broadening by projecting the spherical stellar surface onto the two-dimensional sky. We first segment the disk into polar coordinates, r and θ, with r ∈ [0, 1]. The radial grid size is given by N r , with the corresponding spacing dr = 1/N r , and the maximum number of θ steps in the outermost ring is given by N θ . At each radial point, the number of θ steps n θ (r) = rN θ , rounded to the nearest inte-ger, and dθ = (2π)/n θ . At each r, θ point, we then define the projected area by We also incorporate the a linear limb-darkening law, defined by the parameter , which ranges from 0 to 1, by rescaling the areas such that We then compute the projected velocity by v(r, θ) = v r sin(θ). To incorporate differential rotation, we adopt a solar-like differential rotation law by scaling the projected velocity according to: We can then integrate the disk by: where s(λ(v(r, θ))) is the spectrum interpolated onto the wavelength scale that has been Doppler shifted to the new velocityv. We then normalize bŷ to account for any under or over estimation of the disk area. We provide the code implementation of this method in 1 .
The accuracy of the method is a function of the resolution used in the disk integration (N r and N θ ) and the length of the spectrum being broadened. We provide in the code the default N r , N θ values for which the broadening is computed accurately but still rapidly in most cases.
We show the result of broadening a T eff = 5500 K PHOENIX (Husser et al. 2013) atmosphere model spectrum using direct integration versus convolution in Figure  1. We use the convolutional broadening code in the package PyAstronomy (Czesla et al. 2019) for this example. For the sake of comparing the accuracy of the methods across broad wavelength ranges, we use the "fast" version of convolution, wherein the spectrum is not subdivided. We do this to demonstrate the inaccurate results it produces for regions of the spectrum far from the central wavelength adopted in the convolution.
For the smaller ∆λ shown in Figure 1, the convolutional broadening produces an identical result to direct integration. In this case, the ∆λ is small enough to be valid for the kernel approximation and the "fast" convolution is essentially the same as the "slow" convolution. For the larger ∆λ, the "fast" convolution is insufficient to accurately reproduce the rotational broadening.
We also compare the computation times for direct integration compared with the more properly done "slow" convolution (subdividing the spectrum into smaller wavelength bins). For a fixed resolution, the computation time of integration scales approximately linearly with the length of the spectrum. This compares quite favorably with the exponential increase in computation time for convolution.
For a high-dispersion spectrum sampled at dλ < 0.1, a wavelength range of ∆λ ∼ 2000Å has ∼ 20000 points. The computation time of the convolutional broadening for an input this long is several minutes. While this may be acceptable for a single demonstration, it makes broadband fitting impossible.
An additional benefit of our implementation of the direct integration is that it does not reply on having an evenly sampled wavelength grid. The convolution method requires that the spectrum being convolved has a constant ∆λ throughout. However, this is not possible if the spectra are sampled at constant ∆v. If representing the data at a consistent resolution (R = λ/∆λ) across a broadband spectrum is important, the convolution method should not be used.

CONCLUSION
We encourage the use of our public, open-source rotational broadening code for anyone doing broadband highdispersion spectroscopy. The method is simple but powerful and effective. Integration Convolution Figure 1. Results from rotationally broadening spectra using the two methods, direct integration and convolution. Left: A 5500 K PHOENIX (Husser et al. 2013) atmosphere model, broadened to 30 km s −1 using the two methods and assuming a limb darkening coefficient of 0.6. We show a small piece of spectrum to better distinguish the individual line profiles. The wavelength ranges (∆λ) and mean wavelengths (λ) of each spectrum are given in the legend. Notice the "fast" convolution matches the direct integration almost perfectly when the wavelength range is small and the region of interest is near the center of that range. In that case, the result is the same as using the "slow" method. However, for the larger wavelength range, where we are now far from the mean central wavelength, the broadening accuracy is much worse. The direct integration case is computed on the ∆λ = 2800Å case. Right: The times for the two broadening method as a function of the length of the array being broadened. Notice the rapid increase in time for the convolution method compared to integration. The spectra shown are sampled at dλ ∼ 0.01, so ∆λ = 1000 is a 10 5 element array. The grid used for the integration has Nr = 10 and N θ = 100, the default values for our function.