4. Cross-Correlation Function¶
- pcassie.ccf.doppler_shift(wave_arr, velocity)[source]¶
Doppler shift the wavelength array by a velocity (in m/s).
- Parameters:
wave_arr (array) – 1d wavelengths array (in any units, e.g., nm or µm)
velocity (float) – Velocity in m/s
- Returns:
Doppler-shifted wavelengths
- Return type:
array
- pcassie.ccf.ccf(all_pca, all_wave, v_shift_range, sim_wave, sim_flux, speed=True, verbose=False)[source]¶
Loops through all detectors and spectra to compute the cross-correlation function of each spectrum with the simulated spectrum.
- Parameters:
all_pca (list) – PCA removed spectra with dimensions (n detectors x n spectra x wavelength grid).
all_wave (list) – Wavelength arrays (n detectors x wavelength grid) for the corresponding PCA subtracted spectra.
v_shift_range (array) – 1d array of velocity shifts to sample. Should be structured such that the array has a step of 1 km/s, e.g. np.linspace(-100_000, 100_000, 201) with units of meters.
sim_wave (array) – Simulated wave array.
sim_flux (array) – Simulated flux array.
speed (boolean) – If True, uses numpy for interpolation (much faster). If False, uses scipy’s interp1d (more accurate). I reccomend using numpy for PCA sampling and scipy for science data.
- Returns:
2d cross-correlation function array (n spectra x v_shift)
- Return type:
array
- pcassie.ccf.orbital_phase(t, T_not, P_orb)[source]¶
Calculates the orbital phase as phi(t) = (t - T_not) / P_orb where phi(t) is phase as a function of time, t is time, T_not is the mid-transit time, and P_orb is the orbital period. Please ensure units match.
- pcassie.ccf.orbit_velocity(a, P_orb)[source]¶
Calculates orbital velocity as v_orb = 2*pi*a / P_orb where a is the semi-major axis and P_orb is the orbital period. Please ensure units match.
- pcassie.ccf.rv_amplitude(a, P_orb, i)[source]¶
Calculates the radial velocity amplitude as: Kp = v_orb * sin(i) where v_orb is the orbital velocity, i is the inclination, a is the semi-major axis, and P_orb is the orbital period. See orbit_velocity for the calculation of v_orb. Please ensure units match.
- pcassie.ccf.doppler_correction(a, P_orb, i, t, T_not, v_sys, v_bary, Kp=None, verbose=False)[source]¶
a in au, P_orb in days, i in degrees t in MJD T_not in MJD (mid-transit time) v_sys in km/s v_bary in km/s Kp in m/s, if None, will compute from a, P_orb, i
- pcassie.ccf.compute_vbary_timeseries(ra_deg, dec_deg, times_utc, location)[source]¶
Compute v_bary(t) for a target at (ra, dec) and a time array.
- Parameters:
ra_deg (float) – RA in degrees
dec_deg (float) – Dec in degrees
times_utc (array-like) – List or array of UTC times (ISO strings or float MJD)
location (EarthLocation) – Astropy EarthLocation (observatory)
- Returns:
Barycentric velocities (km/s) for each time
- Return type:
np.ndarray
- pcassie.ccf.doppler_correct_ccf(summed_ccf, v_shift_range, mjd_obs, ra, dec, location, a, P_orb, i, T_not, v_sys, Kp=None, verbose=False)[source]¶
Corrects the full cross-correlation array for the Doppler shift according to Vp = Kp*sin[2*pi*phi(t)] + v_sys + v_bary where Vp is the velocity correction, v_sys is the systems radial velocity, and v_bary is the barcentric correction. Refer to rv_amplitude and orbital_phase for the definitions of Kp and phi(t)
- pcassie.ccf.remove_out_of_transit(transit_start_end, grid, mjd_obs)[source]¶
remove spectra outside of ingress (transit start) and egress (trasnit end).
- pcassie.ccf.run_ccf_on_detector_segments(all_wave, all_pca, v_shift_range, segment_indices, sim_wave, sim_flux, mjd_obs, ra, dec, location, a, P_orb, i, T_not, v_sys, transit_start_end, verbose=False)[source]¶
Full pipeline to runn cross-correlation analysis on your full dataset (n detectors x n spectra x wavelength range)