petitRADTRANS.ccf.ccf_core

Core cross-correlation-related functions.

Module Contents

Functions

co_add_cross_correlation(cross_correlation, ...)

cross_correlate(array_1, array_2)

Cross-correlate two 1-D arrays.

cross_correlate_matrices(matrix_1, matrix_2)

Cross-correlate two N-D arrays.

petitRADTRANS.ccf.ccf_core.co_add_cross_correlation(cross_correlation, velocities_ccf, co_added_velocities)
petitRADTRANS.ccf.ccf_core.cross_correlate(array_1, array_2)

Cross-correlate two 1-D arrays.

Args:

array_1: first array array_2: second array

Returns:

The cross-correlation values.

petitRADTRANS.ccf.ccf_core.cross_correlate_matrices(matrix_1, matrix_2)

Cross-correlate two N-D arrays. The cross-correlation is performed over the last dimension of the matrices. NaNs are ignored and replaced by zeros. For matrices of shape e.g. (2, 3, 10, 1000), the result is a matrix of shape (2, 3, 10). This is equivalent, but faster, to: >>> ccf = np.zeros((2, 3, 10)) >>> for i in range(2): … for j in range(3): … for k in range(10): … ccf[i, j, k] = cross_correlate(matrix_1[i, j, k, :], matrix_2[i, j, k, :])

For 1-D arrays, cross_correlate is faster, but NaNs are not treated. Arguments matrix_1 and matrix_2 can be 1-D arrays, in that case NaNs are treated then cross_correlate() is used. The NaN treatment is rather slow, so cross_correlate is still faster if no NaN are in the arrays.

Args:

matrix_1: first matrix matrix_2: second matrix

Returns:

The cross-correlation values.