Broadening

broaden is a module to perform broadening of the stellar spectra.

Two mechanisms are used to broaden the spectra:

Rotational broadening

  • Convolution of the spectra with a rotational broadening function with a given velocity vsini (in km/s). The default limb darkening coefficient is ´epsilon= 0.6´.
eniric.broaden.rotational_convolution(*args, **kwargs)[source]

Memoized version of rotational_convolution(wavelength:numpy.ndarray, extended_wav:numpy.ndarray, extended_flux:numpy.ndarray, vsini:float, *, epsilon:float=0.6, normalize:bool=True, num_procs:Union[int, joblib.parallel.Parallel, NoneType]=None, verbose:bool=True) -> numpy.ndarray

Perform Rotational convolution.

Parameters:
  • wavelength (ndarray) – Wavelength array.
  • extended_wav (ndarray) – Extended wavelength array to avoid boundary issues.
  • extended_flux (ndarray) – Photon flux for the extended wavelength array.
  • vsini (float) – Rotational velocity in km/s.
  • epsilon (float) – Limb darkening coefficient. Default is 0.6.
  • normalize (bool) – Area normalize the broadening kernel. This corrects for kernel area with unequal wavelength spacing. Default is True.
  • num_procs (int, None or joblib.parallel.Parallel.) – Number of processes to use, n_job parameter in joblib. If num_procs = 1, then a single core is used. Can also be a joblib.parallel.Parallel instance. Default is None.
  • verbose (bool) – Show the tqdm progress bar. Default is True.
Returns:

convolved_flux – The convolved flux evaluated at the wavelength array.

Return type:

ndarray

Rotation kernel

eniric.broaden.rotation_kernel(delta_lambdas: numpy.ndarray, delta_lambda_l: float, vsini: float, epsilon: float) → numpy.ndarray[source]

Rotation kernel for a given line center.

Parameters:
  • delta_lambdas (array) – Wavelength difference from the line center lambda.
  • delta_lambda_l (float) – Maximum line shift of line center by vsini.
  • vsini (float) – Projected rotational velocity in km/s.
  • epsilon (float) – Linear limb-darkening coefficient, between 0 and 1.
Returns:

kernel – Rotational kernel.

Return type:

array

Notes

Gray, D. F. (2005). The Observation and Analysis of Stellar Photospheres. 3rd ed. Cambridge University Press.

Instrumental broadening

  • Convolution by a Gaussian with a FWHM equivalent to the resolving power R at each wavelength. The convolution is extended either side to a fwhm_lim of 5 by default.
eniric.broaden.resolution_convolution(*args, **kwargs)[source]

Memoized version of resolution_convolution(wavelength:numpy.ndarray, extended_wav:numpy.ndarray, extended_flux:numpy.ndarray, R:float, *, fwhm_lim:float=5.0, normalize:bool=True, num_procs:Union[int, joblib.parallel.Parallel, NoneType]=None, verbose:bool=True) -> numpy.ndarray

Perform Resolution convolution.

Parameters:
  • wavelength (ndarray) – Wavelength array.
  • extended_wav (ndarray) – Extended wavelength array to avoid boundary issues.
  • extended_flux (ndarray) – Photon flux for the extended wavelength array.
  • R (float) – Resolution of Guassian instrumental profile.
  • fwhm_lim (float) – FWHM limit for instrument broadening. Default is 5.0.
  • normalize (bool) – Area normalize the broadening kernel. This corrects for kernel area with unequal wavelength spacing. Default is True.
  • num_procs (int, None or joblib.parallel.Parallel.) – Number of processes to use, n_job parameter in joblib. If num_procs = 1, then a single core is used. Can also be a joblib.parallel.Parallel instance.
  • verbose (bool) – Show the tqdm progress bar. Default is True.
Returns:

convolved_flux – The convolved flux evaluated at the wavelength array.

Return type:

ndarray

Gaussian kernel

eniric.broaden.unitary_gaussian(x: Union[range, int, numpy.ndarray], center: Union[float, int, str], fwhm: Union[float, int, str]) → numpy.ndarray[source]

Gaussian kernal of area 1.

Parameters:
  • x (array-like) – Position array.
  • center (float) – Central position of Gaussian.
  • fwhm (float) – Full Width at Half Maximum.
Returns:

kernel – Gaussian kernel.

Return type:

array-like

Circular Fibre

This is the convolution kernel for a circular fibre. .. autofunction:: oned_circle_kernel

When analyzing the spectral libraries, rotational broadening is preformed first, followed by the instrumental broadening.

Our convolution functions use wavelength dependent kernels and do not require uniform spacing between points, unlike PyAstronomy. This means our convolutions are slower but are more precise. We compare the convolutions in the Convolution_speeds.ipynb notebook.

Combined convolution

Resolution following rotation

eniric.broaden.convolution(*args, **kwargs)[source]

Memoized version of convolution(wav:numpy.ndarray, flux:numpy.ndarray, vsini:float, R:float, band:str=’All’, *, epsilon:float=0.6, fwhm_lim:float=5.0, num_procs:Union[int, joblib.parallel.Parallel, NoneType]=None, normalize:bool=True, verbose:bool=True)

Perform rotational then Instrumental broadening with convolutions.

Parameters:
  • wav (ndarray) – Wavelength array.
  • flux (ndarray) – Flux array.
  • vsini (float) – Rotational velocity in km/s.
  • R (int) – Resolution of instrumental profile.
  • band (str) – Wavelength band to choose, default is “All”.
  • epsilon (float) – Limb darkening coefficient. Default is 0.6.
  • fwhm_lim (float) – FWHM limit for instrument broadening. Default is 5.0.
  • normalize (bool) – Area normalize the broadening kernel. This corrects for kernel area with unequal wavelength spacing. Default is True.
  • num_procs (int, None or joblib.parallel.Parallel.) – Number of processes to use, n_job parameter in joblib. If num_procs = 1, then a single core is used. Can also be a joblib.parallel.Parallel instance.
  • verbose (bool) – Show the tqdm progress bar. Default is True.
Returns:

  • wav_band (ndarray) – Wavelength for the selected band.
  • flux_band (ndarray) – Original flux for the selected band.
  • flux_conv (ndarray) – Convolved flux for the selected band.

Caching

Convolution results are cached using joblib, see https://joblib.readthedocs.io/en/latest/memory.html

Caching of the convolution stages is performed to avoid re-computation of this slow component when possible using ``joblib.Memory` <https://joblib.readthedocs.io/en/latest/memory.html>`_. The caching directory defaults to ~/.joblib but can be changed in the configuration file config.yaml.

Caching can be disabled by setting location=None in config.yml.