Functions

Functions Exported by RvSpectML

General purpose

binspectraconsecutive Bins consecutive spectra from a SpectralTimeSeriesCommonWavelengths object

WARNING: Simply takes consecutive spectra, so some bins may be from spectra that weren't taken close together. TODO: Create version that pays attention to timestamps.

binspectramax_Δt Bins spectra from a SpectralTimeSeriesCommonWavelengths object with a maximum spacing between observation times

binspectranightly Bins spectra from a SpectralTimeSeriesCommonWavelengths object with a maximum spacing between observation times

bintimesconsecutive( times, n ) Computes mean times from conseuctive bins of n times (to go with binconsecutivespectra). Returns floor(length(times)/n) elements.

WARNING: Simply takes consecutive times, so some bins may be from spectra that weren't taken close together. TODO: Create version that pays attention to timestamps.

numerical_deriv( x, y) Calculate simple estimate of numerical derivative

rmsrvwithin_night(times, rvs) Return RMS of RVs taken within the same night

RV-Related Algorithms

Modules = [ RvSpectML.DCPCA, RvSpectML.LineFinder] #, RvSpectML.PPCA ]
Private = false
Order = [:function ]

Interpolation Algorithms

interp_chunk_to_grid_linear!( flux_out, var_out, chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • flux_out: (results stored into this array)
  • var_out: (results stored into this array)
  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

interp_chunk_to_grid_linear( chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Returns

  • flux_out

interp_chunk_to_grid_linear!( flux_out, var_out, chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • flux_out: (results stored into this array)
  • var_out: (results stored into this array)
  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

`interpchunktoshiftedgridlinear( chunkofspectrum, wavelengths, boostfactor ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

Return interpolator for variances in spectra.

interp_chunk_to_grid_sinc!( flux_out, var_out, chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using sinc interpolation.

Arguments:

  • flux_out: (results stored into this array)
  • var_out: (results stored into this array)
  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

interp_chunk_to_grid_sinc( chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using sinc interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Returns

  • flux_out

interp_chunk_to_shifted_grid_sinc!( flux_out, var_out, chunk_of_spectrum, wavelengths, boost_factor ) Return spectra interpolated onto a grid of points using sinc interpolation.

Arguments:

  • flux_out: (results stored into this array)
  • var_out: (results stored into this array)
  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

interp_chunk_to_shifted_grid_sinc( chunk_of_spectrum, wavelengths, boost_factor ) Return spectra interpolated onto a grid of points using sinc interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

Original author: Joe Ninan Converted to Julia and optimized by Christian Gilbertson Further adapted/optimized by Eric Ford Additional optimizations possible by preallocating arrasy for minargs, Nminargs, minvalues, FilterValues and OldYCoords.

construct_gp_posterior(xobs, yobs; sigmasq_obs, use_logx, use_logy, smooth_factor, boost_factor ) Inputs:

  • xobs: x locations where data is provided
  • yobs: y values of data to condition on

Optional Inputs:

  • sigmasq_obs: variances for y values being conditioned on
  • use_logx: If true, take log's of x values before fitting GP
  • use_logy: If true, perform log transform on y's
  • smooth_factor: scales GP hyperparameters so as to result in smoother GP posterior (1)
  • boostfactor: scales xobs by 1/boostfactor (1)

Returns:

  • Posterior GP at locations xpred given training data

construct_gp_prior() Returns a GP prior using a Matern 5/2 kernel and specified parameters Optional Inputs:

  • smoothfactorσ²: Multiplies variance for GP kernel (1)
  • smoothfactorl: Multiplies length scale for GP kernel (1)
  • σ²: Variance for GP kernel (0.5)
  • l: length scale for GP kernel (5.8e-5)

interp_chunk_to_grid_gp_temporal( chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Returns

  • flux_out

interp_chunk_to_grid_gp_temporal( chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to

Returns

  • flux_out

interp_chunk_to_grid_gp_temporal!( flux_out, var_out, chunk_of_spectrum, wavelengths ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • flux_out: (results stored into this array)
  • var_out: (results stored into this array)
  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

`interpchunktoshiftedgridgptemporal( chunkofspectrum, wavelengths, boost_factor ) Return spectra interpolated onto a grid of points using linear interpolation.

Arguments:

  • chunkofspectrum
  • wavelengths: AbstractRange or AbstractArray of locations where chunk is to be interpolated to
  • boostfactor: divide wavelengths by boostfactor

Optional Arguments:

  • Filter: Vector with pre-allocated workspace (if length>=1)

Returns

  • flux_out

predictgpmean(gp, xpred ; uselogx, uselogy) Inputs:

  • gp:
  • xpred: Locations to predict GP at

Optional inputs:

  • use_logx: If true, apply log transform to xpred before evaluating GP

Returns vector of means of GP posterior at locations in xpred.

Other

preparelinelist( linelistfn, spectra, pipeline; Δvtoavoidtellurics, vcentertoavoidtellurics )