Calculate CCFs
Calculate CCFs
Functions
EchelleCCFs.calc_ccf_and_var_chunk!
— Methodcalc_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 outputccf_var_out
:AbstractArray
to store outputchunk
: ChunkOfSpectrum to compute CCF forccf_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_chunk
— Methodcalc_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 outputccf_var_out
:AbstractArray
to store outputchunk
: ChunkOfSpectrum to compute CCF forccf_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_chunklist
— Methodcalc_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!
— Methodcalc_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 outputchunk
: ChunkOfSpectrum to compute CCF forccf_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_chunk
— Methodcalc_ccf_chunk( chunk, ccf_plan )
Convenience function to compute CCF for one chunk of spectrum.
Inputs:
ccf_out
:AbstractArray
to store outputchunk
: ChunkOfSpectrum to compute CCF forccf_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 wavelengthcalc_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_chunklist
— Methodcalc_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_timeseries
— Methodcalc_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_template
— Methodcalcccftemplate( ccfs, [ccfvars] ; assumenormalized = false ) Calculates ccf template Warning: uses maximum CCF for normalization, unless you normalize manually.
EchelleCCFs.calc_ccf_v_grid
— Methodcalc_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_length_ccf_v_grid
— Methodcalc_length_ccf_v_grid( plan )
Return number of points in the velocity grid (without needing to create the range).
EchelleCCFs.calc_normalized_ccfs
— Methodcalcnormalizedccfs( ccfs ) Normalizes each spectrum by its maximum value.
EchelleCCFs.calc_order_ccf_and_vars_chunklist!
— Methodcalc_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_chunklist
— Methodcalc_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!
— Methodcalc_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
— Methodcalc_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 wavelengthsfluxes
: 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 outputccf_var_out
: 1-d array of size length(calcccfv_grid(plan)) to store outputλs
: 1-d array of wavelengthsfluxes
: 1-d array of fluxesvar
: 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 outputccf_covar_out
: 2-d array of size length(calcccfv_grid(plan))^2 to store outputλs
: 1-d array of wavelengthsfluxes
: 1-d array of fluxesvar
: 1-d array of flux variances
Optional Arguments:
plan
: parameters for computing ccf (BasicCCFPlan())
EchelleCCFs.ccf_1D
— Method`ccf_1D( λs, fluxes; ccf_plan )`
Compute the cross correlation functions of spectra with a mask.
Inputs:
λs
: 1-d array of wavelengthsfluxes
: 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_1D
— Method`ccf_1D( λs, fluxes; ccf_plan )`
Compute the cross correlation function of a spectrum with a mask.
Inputs:
λs
: 1-d array of wavelengthsfluxes
: 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_1D
— Method`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 wavelengthsfluxes
: 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.AbstractCCFMaskShape
— TypeA struct implementing a specific mask shapes should be a subtype of AbstractCCFMaskShape.
EchelleCCFs.AbstractCCFPlan
— TypeA struct implementing a specific plans describing where the CCF is to be evaluated should be a subtype of AbstractCCFPlan.
EchelleCCFs.AbstractLineList
— TypeA struct implementing a line list should be a subtype of AbstractLineList.
EchelleCCFs.BasicCCFPlan
— TypeBasic plan for computing the CCF roughly between vcenter-vmax and vcenter+vmax with step size v_step.
EchelleCCFs.BasicCCFPlan
— MethodBasicCCFPlan
Optional arguments:
midpoint
: (default_v_center
)step
: (default_v_step
)max
: (default_v_max
)
EchelleCCFs.BasicLineList
— TypeA 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.BasicLineList
— MethodBasicLineList( λ, weight )
EchelleCCFs.CosCCFMask
— TypeCosCCFMask 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.CosCCFMask
— MethodFunctor for returning PSF for Δv <= half_width.
EchelleCCFs.CosCCFMask
— MethodCosCCFMask( inst )
EchelleCCFs.GaussianCCFMask
— TypeGaussianCCFMask 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.GaussianCCFMask
— MethodFunctor for returning PSF for Δv <= half_width.
EchelleCCFs.GaussianCCFMask
— MethodGaussianCCFMask( inst ; scale_factor )
EchelleCCFs.SuperGaussianCCFMask
— TypeSuperGaussianCCFMask 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.SuperGaussianCCFMask
— MethodSuperGaussianCCFMask( inst ; scale_factor )
EchelleCCFs.SuperGaussianCCFMask
— MethodFunctor for returning PSF for Δv <= half_width.
EchelleCCFs.TopHatCCFMask
— TypeTopHatCCFMask 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.
EchelleCCFs.TopHatCCFMask
— TypeTopHatCCFMask( full_width )
`
EchelleCCFs.TopHatCCFMask
— MethodFunctor for returning constant for any Δv <= width.
EchelleCCFs.TopHatCCFMask
— MethodTopHatCCFMask( inst )
Base.length
— MethodReturn length of line list.
EchelleCCFs.calc_ccf_and_covar_chunk!
— Methodcalc_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 outputccf_covar_out
:AbstractArray
to store outputchunk
: ChunkOfSpectrum to compute CCF forccf_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_chunk
— Methodcalc_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 outputccf_covar_out
:AbstractArray
to store outputchunk
: ChunkOfSpectrum to compute CCF forccf_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!
— Methodcalc_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_chunklist
— Methodcalc_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!
— Methodcalc_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!
— Methodcalc_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_factor
— Methodcalc_doppler_factor(vel)
` Compute the longitudinal relativistic doppler factor given a velocity in meters per second.
EchelleCCFs.calc_order_ccf_and_var_chunklist_timeseries
— Methodcalc_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_timeseries
— Methodcalc_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.find_overlapping_chunks
— MethodReturn indices of any chunks in df that have overlapping lambda_hi[i]
and lambda_lo[i+1]
.
EchelleCCFs.fit_ccf_normalizations
— Methodcalcnormalizedccfs( ccfs ) Normalizes each spectrum by fitting a line to the region outside the center
EchelleCCFs.merge_chunks
— MethodReturn 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!
— Methodproject_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_espresso
— MethodRead 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_rvspectml
— MethodRead line list in csv format. format: lambda, weight, lambdalo, lambdaahi. Assumes air to vacuumb wavelength conversion has already been applied.
EchelleCCFs.read_linelist_vald
— MethodRead line list in VALD csv format. VALD format: lambdalo, lambdaahi and depth. convertairto_vacuum determines whether to convert to vacuum wavelengths.
EchelleCCFs.read_mask_espresso
— MethodRead 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.read_mask_vald
— MethodRead mask in VALD csv format. VALD format: lambda_lo
, lambdaa_hi
and depth
.
EchelleCCFs.λ_air_to_vac
— MethodConvert 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_air
— MethodConvert 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