Calculate CCFs

Calculate CCFs

Functions

EchelleCCFs.calc_ccf_and_var_chunk!Method

calc_ccf_and_var_chunk!( chunk, ccf_plan ) Convenience function to compute CCF and variance of each "CCF pixel" for one chunk of spectrum, evaluated using maskshape and line list from `ccfplan`.

Inputs:

  • ccf_out: AbstractArray to store output
  • ccf_var_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • var: AbstractArray with variance to use for each pixel (overides value in chunk)
  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Returns Named Tuple with:

  • ccf_out:
  • ccf_var_out:
EchelleCCFs.calc_ccf_and_var_chunkMethod

calc_ccf_and_var_chunk( chunk, ccf_plan ) Convenience function to compute CCF and variance of each "CCF pixel" for one chunk of spectrum, evaluated using maskshape and line list from `ccfplan`.

Inputs:

  • ccf_out: AbstractArray to store output
  • ccf_var_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • var: AbstractArray with variance to use for each pixel (overides value in chunk)

-assumesorted`: if true, skips checking the linelist is sorted by wavelength

Returns Named Tuple with:

  • ccf_out:
  • ccf_var_out:
EchelleCCFs.calc_ccf_and_var_chunklistMethod

calc_ccf_and_var_chunklist ( chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_ccf_chunk!Method

calc_ccf_chunk!( ccf_out, chunk, ccf_plan ) Convenience function to compute CCF for one chunk of spectrum, evaluated using mask_shape and line list from ccf plan

Inputs:

  • ccf_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Returns:

  • ccf_out
EchelleCCFs.calc_ccf_chunkMethod

calc_ccf_chunk( chunk, ccf_plan ) Convenience function to compute CCF for one chunk of spectrum.

Inputs:

  • ccf_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength
  • calc_ccf_var: if true also computes estimate of variance for each value of ccf

Returns:

  • CCF for one chunk of spectrum, evaluated using mask_shape and line list from ccf plan
EchelleCCFs.calc_ccf_chunklistMethod

calc_ccf_chunklist ( chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_ccf_chunklist_timeseriesMethod

calc_ccf_chunklist_timeseries( chunklist_timeseries, line_list ) Convenience function to compute CCF for a timeseries of spectra, each with a chunklist. Uses multiple threads if avaliable.

Inputs:

  • chunklist_timeseries

Optional Arguments:

  • ccf_plan (BasicCCFPlan())
  • verbose (false)

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the ccfplan. Note that the ccfplan provided is used as a template for creating a custom ccfplan for each chunk that only includes lines that reliably appear in that order for all spectra in the chunklisttimeseries.

EchelleCCFs.calc_ccf_templateMethod

calcccftemplate( ccfs, [ccfvars] ; assumenormalized = false ) Calculates ccf template Warning: uses maximum CCF for normalization, unless you normalize manually.

EchelleCCFs.calc_ccf_v_gridMethod

calc_ccf_v_grid( plan ) Return range where CCF is to be evaluated, Centered around plan.vcenter going up to at least plan.vmax in steps of size plan.v_step. Units based on those in plan.

EchelleCCFs.calc_order_ccf_and_vars_chunklist!Method

calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.

Inputs:

  • chunklist_timeseries:
  • list_of_ccf_plans: ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

A 2-d array containing the CCF at each (velocity, chunk)

EchelleCCFs.calc_order_ccf_and_vars_chunklistMethod

calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.

Inputs:

  • chunklist_timeseries:
  • list_of_ccf_plans: ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

A 2-d array containing the CCF at each (velocity, chunk)

EchelleCCFs.calc_order_ccfs_chunklist!Method

calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.

Inputs:

  • chunklist_timeseries:
  • list_of_ccf_plans: ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

A 2-d array containing the CCF at each (velocity, chunk)

EchelleCCFs.calc_order_ccfs_chunklistMethod

calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.

Inputs:

  • chunklist_timeseries:
  • list_of_ccf_plans: ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

A 2-d array containing the CCF at each (velocity, chunk)

EchelleCCFs.ccf_1D!Method
`ccf_1D!(ccf_out, λs, fluxes; ccf_plan )`

Compute the cross correlation function of a spectrum with a mask. Generalized version that should work with different mask shapes.

Inputs:

  • ccf_out: 1-d array of size length(calcccfv_grid(plan)) to store output
  • λs: 1-d array of wavelengths
  • fluxes: 1-d array of fluxes

Optional Arguments:

  • plan: parameters for computing ccf (BasicCCFPlan())
EchelleCCFs.ccf_1D!Method
`ccf_1D!(ccf_out, ccf_var_out, λs, fluxes, var; ccf_plan )`

Compute the cross correlation function of a spectrum with a mask. Generalized version that should work with different mask shapes.

Inputs:

  • ccf_out: 1-d array of size length(calcccfv_grid(plan)) to store output
  • ccf_var_out: 1-d array of size length(calcccfv_grid(plan)) to store output
  • λs: 1-d array of wavelengths
  • fluxes: 1-d array of fluxes
  • var: 1-d array of flux variances

Optional Arguments:

  • plan: parameters for computing ccf (BasicCCFPlan())
EchelleCCFs.ccf_1D!Method
`ccf_1D!(ccf_out, ccf_covar_out, λs, fluxes, var; ccf_plan )`

Compute the cross correlation function of a spectrum with a mask. Generalized version that should work with different mask shapes. WIP: Generalized version to compute covariance matrix for ccf and optionally to account for LSF

Inputs:

  • ccf_out: 1-d array of size length(calcccfv_grid(plan)) to store output
  • ccf_covar_out: 2-d array of size length(calcccfv_grid(plan))^2 to store output
  • λs: 1-d array of wavelengths
  • fluxes: 1-d array of fluxes
  • var: 1-d array of flux variances

Optional Arguments:

  • plan: parameters for computing ccf (BasicCCFPlan())
EchelleCCFs.ccf_1DMethod
`ccf_1D( λs, fluxes; ccf_plan )`
Compute the cross correlation functions of spectra with a mask.

Inputs:

  • λs: 1-d array of wavelengths
  • fluxes: 2-d array of fluxes, individual spectra along first dim

Optional Arguments:

  • ccf_plan: parameters for computing ccf (BasicCCFPlan())

Returns:

  • 2-d array of size (length(calcccfv_grid(plan)), size(flux, 2))
EchelleCCFs.ccf_1DMethod
`ccf_1D( λs, fluxes; ccf_plan )`
Compute the cross correlation function of a spectrum with a mask.

Inputs:

  • λs: 1-d array of wavelengths
  • fluxes: 1-d array of fluxes

Optional Arguments:

  • ccf_plan: parameters for computing ccf (BasicCCFPlan())

Returns:

  • 1-d array of size length(calcccfv_grid(plan))
EchelleCCFs.ccf_1DMethod
`ccf_1D( λs, fluxes, vars; ccf_plan )`

Compute the cross correlation function of a spectrum with a mask and its variance^1. ^1 = This version computes the diagonal terms for the ccf variance and neglects covariances due to the line spread function. Can roughly compensate by scaling up the ccfvarscale from the default of 1. WARNING: Still needs more testing.

Inputs:

  • λs: 1-d array of wavelengths
  • fluxes: 1-d array of fluxes

Optional Arguments:

  • ccf_plan: parameters for computing ccf (BasicCCFPlan())

Returns:

  • 1-d array of size length(calcccfv_grid(plan))

Types

EchelleCCFs.AbstractCCFPlanType

A struct implementing a specific plans describing where the CCF is to be evaluated should be a subtype of AbstractCCFPlan.

EchelleCCFs.BasicCCFPlanType

Basic plan for computing the CCF roughly between vcenter-vmax and vcenter+vmax with step size v_step.

EchelleCCFs.BasicCCFPlanMethod

BasicCCFPlan

Optional arguments:

  • midpoint: (default_v_center)
  • step: (default_v_step)
  • max: (default_v_max)
EchelleCCFs.BasicLineListType

A basic line list for passing to compute CCFs. Contains (views into) arrays specifying the minimum and maximum wavelength range and weight for each line.

EchelleCCFs.CosCCFMaskType

CosCCFMask Cosine mask with one parameter, it's quarter period, i.e., where to truncate it, as a velocity in m/s. Mask weights are stored separately in a line list.

EchelleCCFs.GaussianCCFMaskType

GaussianCCFMask A truncated Gaussian mask with two parameters, its standard deviation and where to truncate it, both as a velocity in m/s. Mask weights are stored separately in a line list.

EchelleCCFs.SuperGaussianCCFMaskType

SuperGaussianCCFMask A truncated Gaussian mask with two parameters, its standard deviation and where to truncate it, both as a velocity in m/s. Mask weights are stored separately in a line list.

TODO: Replace Gaussian with super-Gaussian Warning: Not implemented/tested yet.

EchelleCCFs.TopHatCCFMaskType

TopHatCCFMask The standard tophat mask with one parameter, it's half width as a velocity in m/s. Mask weights are stored separately in a line list.

Internals

EchelleCCFs.calc_ccf_and_covar_chunk!Method

calc_ccf_and_covar_chunk!( chunk, ccf_plan ) Convenience function to compute CCF and covariance of each pair of "CCF pixels" for one chunk of spectrum, evaluated using maskshape and line list from `ccfplan`.

Inputs:

  • ccf_out: AbstractArray to store output
  • ccf_covar_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • var: AbstractArray with variance to use for each pixel (overides value in chunk)
  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Returns Named Tuple with:

  • ccf_out:
  • ccf_covar_out:
EchelleCCFs.calc_ccf_and_covar_chunkMethod

calc_ccf_and_covar_chunk( chunk, ccf_plan ) Convenience function to compute CCF and covariance of each pair of "CCF pixels" for one chunk of spectrum, evaluated using maskshape and line list from `ccfplan`.

Inputs:

  • ccf_out: AbstractArray to store output
  • ccf_covar_out: AbstractArray to store output
  • chunk: ChunkOfSpectrum to compute CCF for
  • ccf_plan: for now, just a BasicCCFPlan that provides linelist, maskshape and other parameters for calculating CCF

Optional Arguments:

  • var: AbstractArray with variance to use for each pixel (overides value in chunk)

-assumesorted`: if true, skips checking the linelist is sorted by wavelength

Returns Named Tuple with:

  • ccf_out:
  • ccf_covar_out:
EchelleCCFs.calc_ccf_and_covar_chunklist!Method

calc_ccf_and_covar_chunklist! ( ccf_out, ccf_cocovar_out, chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_ccf_and_covar_chunklistMethod

calc_ccf_and_covar_chunklist ( chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_ccf_and_var_chunklist!Method

calc_ccf_and_var_chunklist! ( ccf_out, ccf_var_out, chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_ccf_chunklist!Method

calc_ccf_chunklist! ( ccfs_out, chunklist, ccf_plans ) Convenience function to compute CCF based on a spectrum's chunklist.

Inputs:

  • chunklist
  • vector of ccf plans (one for each chunk)

Optional Arguments:

  • assume_sorted: if true, skips checking the line_list is sorted by wavelength

Return:

CCF summed over all chunks in a spectrum's chunklist, evaluated using the line list and mask_shape from the ccf plan for each chunk.

EchelleCCFs.calc_doppler_factorMethod

calc_doppler_factor(vel)` Compute the longitudinal relativistic doppler factor given a velocity in meters per second.

EchelleCCFs.calc_order_ccf_and_var_chunklist_timeseriesMethod

calc_order_ccf_and_var_chunklist_timeseries( chunklist_timeseries, ccf_plan ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) of each spectrum in a timeseries. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk. Uses multiple threads if avaliable.

Inputs:

  • chunklist_timeseries

Optional Arguments:

  • ccf_plan (BasicCCFPlan())

Return:

A 3-d array containing the CCF at each (velocity, chunk, spectrum) Note that the ccfplan provided is used as a template for creating a custom ccfplan for each chunk that only includes lines that reliably appear in that order for all spectra in the chunklist_timeseries.

EchelleCCFs.calc_order_ccf_chunklist_timeseriesMethod

calc_order_ccf_chunklist_timeseries( chunklist_timeseries, ccf_plan ) Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) of each spectrum in a timeseries. CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk. Uses multiple threads if avaliable.

Inputs:

  • chunklist_timeseries

Optional Arguments:

  • ccf_plan (BasicCCFPlan())

Return:

A 3-d array containing the CCF at each (velocity, chunk, spectrum) Note that the ccfplan provided is used as a template for creating a custom ccfplan for each chunk that only includes lines that reliably appear in that order for all spectra in the chunklist_timeseries.

EchelleCCFs.merge_chunksMethod

Return DataFrame with specifications for each chunk which will contain one or more lines. Input: line_list a DataFrame with: - lambda_lo, lambda_hi, lambda, depth Output: DataFrame with - lambda_lo & lambda_hi: boundaries for chunk - lambda & line_depths: arrays with info about each line

EchelleCCFs.project_mask!Method

project_mask!( output, λs, ccf_plan; shift_factor )

Compute the projection of the mask onto the 1D array of wavelengths (λs) at a given shift factor (default: 1). The mask is computed from the ccfplan, including a linelist and maskshape (default: tophat). Assumes plan.linelist is already sorted.

EchelleCCFs.read_linelist_espressoMethod
Read line list in ESPRESSO csv format.

ESPRESSO format: lambda and weight. convertairto_vacuum determines whether to convert to vacuum wavelengths. Warning: ESPRESSO masks don't provide line depth and sometimes include one entry for a blend of lines.

EchelleCCFs.read_linelist_rvspectmlMethod

Read line list in csv format. format: lambda, weight, lambdalo, lambdaahi. Assumes air to vacuumb wavelength conversion has already been applied.

EchelleCCFs.read_linelist_valdMethod

Read line list in VALD csv format. VALD format: lambdalo, lambdaahi and depth. convertairto_vacuum determines whether to convert to vacuum wavelengths.

EchelleCCFs.read_mask_espressoMethod
Read mask in ESPRESSO csv format.

ESPRESSO format: lambda and weight. Warning: ESPRESSO masks don't provide line depth and sometimes include one entry for a blend of lines.

EchelleCCFs.λ_air_to_vacMethod

Convert air wavelength (in Å) to vacuum wavelength Ref: https://www.astro.uu.se/valdwiki/Air-to-vacuum%20conversion VALD3 tools use the following solution derived by N. Piskunov

EchelleCCFs.λ_vac_to_airMethod

Convert vacuum wavelength (in Å) to air wavelength Ref: Donald Morton (2000, ApJ. Suppl., 130, 403) via https://www.astro.uu.se/valdwiki/Air-to-vacuum%20conversion