abscal.wfc3.util_grism_cross_correlate

This file takes two input spectra and determines the best cross-correlation between them. It uses a correlation algorithm developed by Ralph Bohlin.

Authors

  • Brian York (all python code)

  • Ralph Bohlin (original IDL code)

Use

This file is intended to be called from reduce_grism_coadd.py, although it can be used by direct import:

from abscal.wfc3.util_grism_cross_correlate import cross_correlate

offset, correlation_matrix = cross_correlate(spec1, spec2, table_row, args, **kwargs)

The following parameters can be set via the keyword arguments:

ishift: int, default 0

Approximate initial shift. The correlation search will start here.

width: int, default 15

Size (in pixels) of the correlation search region

i1: int, default 0

First pixel of the spectrum to use in correlation search

i2: int, default -1

Last pixel of the spectrum to use in correlation search. Negative values are counting from the end of the array, as per python convention.

Module Contents

Functions

cross_correlate(s1, s2, row, **kwargs)

Cross-correlates two spectra.

abscal.wfc3.util_grism_cross_correlate.cross_correlate(s1, s2, row, **kwargs)

Cross-correlates two spectra.

Parameters:
  • s1 (numpy.ndarray) – First spectrum

  • s2 (numpy.ndarray) – Second spectrum

  • row (astropy.table.Table) – Single-element table with metadata on s1

  • kwargs (dict) – Potential overrides to cross-correlation parameters and command-line arguments

Returns:

  • offset (float) – Best found pixel offset

  • corr (np.ndarray) – Correlation matrix