Functions Exported by RvSpectMLBase
General purpose
Base.length
— MethodReturn number of times/ChunkLists in a ChunkListTimeseries
Base.length
— MethodReturn number of chunks in ChunkList
RvSpectMLBase.absorption_line
— Methodabsorption_line(x; mid, width, depth)
Return a Gaussian absorption line profile evaluated at x.
RvSpectMLBase.apply_doppler_boost!
— Function`apply_doppler_boost!(spectrum, doppler_factor)`
`apply_doppler_boost!(spectra, df)`
Apply Doppler boost to spectra's λ's and update its metadata[:doppler_factor], so it will know how to undo the transform.
Arguments:
spectrum::AbstractSpectra
: spectrum to be boosteddoppler_factor
: boost factor (1 = noop)
or:
spectra
: spectra to be boosteddf
: DataFrame provides:drift
and:ssb_rv
(in m/s) for calculating the Doppler boost for each spectrum
Returns spectrum/spectra with λ boosted TODO: Improve documentation formatting. This can serve as a template.
RvSpectMLBase.calc_doppler_factor
— Functioncalc_doppler_factor(rv; v_perp)
calc_doppler_factor(; z)
Return the Doppler boost factor (non-relativistic) for rv in m/s.
RvSpectMLBase.calc_normalization
— MethodCalc normalization of spectra based on average flux in a ChunkList.
RvSpectMLBase.calc_normalization
— MethodCalc normalization of chunk based on average flux in a ChunkOfSpectrum.
RvSpectMLBase.calc_normalization_var_weighted
— MethodCalc normalization of spectra based on average flux in a ChunkList using inverse variance weighting.
RvSpectMLBase.calc_normalization_var_weighted
— MethodCalc normalization of chunk based on average flux in a ChunkOfSpectrum using inverse variance weighting.
RvSpectMLBase.code_to_include_param_jl
— Methodcode_to_include_param_jl( ; path_to_search, filename, verbose )
Returns a Code object. After res = code_toread_param_jl( path_to_search )
, execute eval(res)
to actually include the param.jl file. This is useful since it allows variables to be placed into caller's namespace.
Warning: Malicious users could insert arbitrary code into param.jl. Don't be a malicous user.
RvSpectMLBase.extract_chunklist_timeseries_with_subset_obs
— MethodMake a ChunkListTimeseries containing a subset of observations from an existing ChunkListTimeseries
RvSpectMLBase.filter_bad_chunks
— MethodReturn (chunktimeseries) that have been trimmed of any chunks that are bad based on any spectra in the chunktimeseries. For now just checks for NaNs. Instruments can provide their own checks. Inputs:
chunk_timeseries
: ChunkListTimeseries
Optional arguemnts:
verbose
: print debugging info (false)
Returns:
- ChunkListTimeseries that has removed problematic chunks.
RvSpectMLBase.find_line_best
— FunctionReturn (pixels, order_idx) pair that contain "best" region of spectra, based on highest SNR.
RvSpectMLBase.find_orders_in_range
— MethodReturn list of all order indices that include any wavelengths between goallo and goalhi
RvSpectMLBase.find_orders_with_line
— MethodReturn list of all order indices that contain a pixel with wavelength lambda
RvSpectMLBase.find_orders_with_line
— MethodReturn list of all order indices that contain all pixels with wavelengths between goallo and goalhi
RvSpectMLBase.find_pixels_for_line_in_chunk
— MethodFind pixels included in a range of wavelengths
RvSpectMLBase.findall_line
— FunctionReturn list of (pixels, order_idx) pairs that contain pixels with desireed wavelengths. Excludes locations that contain any pixels with var == NaN.
RvSpectMLBase.get_inst
— MethodReturn instrument associated with spectrum
RvSpectMLBase.get_inst
— MethodReturn instrument associated with first spectrum in array
RvSpectMLBase.get_order_info
— MethodReturn DataFrame with information about which pixels and wavelengths to use from each order
RvSpectMLBase.get_λ_range
— MethodReturn the largest minimum wavelength and smallest maximum wavelength of a spectrum.
RvSpectMLBase.get_λ_range
— MethodReturn the largest minimum wavelength and smallest maximum wavelength across an array of spectra. Calls getλrange(AbstractSpectra2D) that should be specialized for each instrument.
RvSpectMLBase.make_chunk_list_around_lines
— Methodmake_chunk_list_around_lines( spectra, line_list)
Return a ChunkList of best regions of spectrum with lines in lineline. linelist is a DataFrame containing :lambdalo and :lambdahi. Pads edges by Δ.
RvSpectMLBase.make_grid_for_chunk
— Methodmake_grid_for_chunk
Create a range with equal spacing between points with end points set based on union of all chunks in timeseries.
Arguments:
- timeseries: ChunkListTimeseries
- chunk index:
- oversample_factor: (1)
RvSpectMLBase.make_orders_into_chunks
— Functionmake_orders_into_chunks
Return a ChunkList with a region of spectrum from each order in orderstouse.
Arguments
- spectra<:AbstractSpectra
- inst: Instrument trait that provides default values
Optional arguments
- orderstouse: Range or Array (orderstouse(inst))
- pixelstouse: Array of Ranges (each from mincol to maxcol)
or
- mincol: (mincol_default(inst,order)) and
- maxcol: (maxcol_default(inst,order))
RvSpectMLBase.make_vec_metadata_from_spectral_timeseries
— MethodExtract the metadata from a time series of spectra and return it as an array.
RvSpectMLBase.normalize_spectra!
— MethodNormalize each spectrum based on sum of fluxes in chunk_timeseries region of each spectrum.
RvSpectMLBase.normalize_spectrum!
— MethodNormalize spectrum, multiplying fluxes by scale_fac.
RvSpectMLBase.num_chunks
— MethodNumber of chunks in first chunklist in chunklist_timeseries.
RvSpectMLBase.num_times
— MethodReturn number of times/ChunkLists in a ChunkListTimeseries
RvSpectMLBase.read_data_paths
— Methodread_data_paths( ; path_to_search, filename, verbose )
Looks for datapaths.jl and includes it to set datapaths
Warning: Malicious users could insert arbitrary code into data_paths.jl. Don't be a malicous user.
RvSpectMLBase.set_rv_est!
— MethodCreate/update metadata entry rv_est for each observation in a ChunkListTimeseries
Functions to be Provided for Each Instrument
RvSpectMLBase.InstrumentsCommon.get_pixel_range
— FunctionReturns integer range of min and maximum pixels to use for specified instrument and order.
RvSpectMLBase.InstrumentsCommon.orders_to_use_default
— MethodReturns range of order indices to be used by default for the specified instrument
Example Instrument
RvSpectMLBase.TheoreticalInstrument.generate_spectra_timeseries
— Methodgenerate_spectra_timeseries(line_list, inst; time, rv, ssbz, snr_per_pixel, line_width, add_noise )
Generate a time series of spectra using times, a line_list (as DataFrame with columns lambda and weight) and a theoretical instrument. Optionally, specify times, rv's, barycentric corrections, etc.
RvSpectMLBase.TheoreticalInstrument.generate_spectrum
— Methodgenerate_spectrum(line_list, inst; time, rv, ssbz, snr_per_pixel, line_width, add_noise )
Generate a spectrum using a line_list (as DataFrame with columns lambda and weight) and theoretical instrument. Optionally, specify times, rv's, barycentric corrections, etc.