hispecdrp.primitives.utils.ccf.ccf_tophat

Top-hat (finite-width) mask CCF utilities.

Functions

_bin_tophat(pixel_lo, pixel_hi, tophat_lo, ...)

Bin a top hat onto discrete pixel edges with area normalization.

_compute_ccf_tophat(wave, spec, spec_err, ...)

Numba core for compute_ccf_tophat().

_pixel_edges_from_wavelength_numba(wave)

Left/right wavelength edges for each pixel from monotonic centers.

compute_ccf_tophat(wave, spec, spec_err, ...)

Cross-correlation of a spectrum with a velocity-width top-hat line mask.

compute_ccf_tophat(wave, spec, spec_err, spec_dq, line_centers, line_weights, tophat_width, vel_window, vel_step, zb=0.0, vsys=0.0)[source]

Cross-correlation of a spectrum with a velocity-width top-hat line mask.

Each mask line is a rest-frame segment with constant velocity width tophat_width (m/s full width). At trial velocity v the segment is Doppler-mapped as \(\lambda_{\rm obs} = \lambda_{\rm rest}(1+v/c)/(1+z_b)\) and binned onto detector pixel edges (area-preserving). The CCF at each velocity is an inverse-variance weighted mean flux under the combined mask.

Parameters:
  • wave – Monotonic wavelength centers (µm or any consistent unit).

  • spec – Flux and 1-sigma uncertainty per pixel.

  • spec_err – Flux and 1-sigma uncertainty per pixel.

  • spec_dq – Data-quality flags (0 = good, nonzero = bad).

  • line_centers – Rest-frame line centers and weights.

  • line_weights – Rest-frame line centers and weights.

  • tophat_width – Full width of each top hat in m/s (rest frame).

  • vel_window – Total velocity span of the output grid (m/s).

  • vel_step – Uniform velocity step (m/s).

  • zb – Barycentric factor \(z_b\) (dimensionless).

  • vsys – Systemic velocity (m/s) at the center of vel_window.

Returns:

vel_grid, ccf, ccf_err – Trial velocities (m/s), CCF value, and formal uncertainty per velocity sample.