Recentering the data for kernel analysis

Table of Contents

How does one center data prior to kernel-analysis?

1 initial setup

Let's assume the user has one image (a fits file, "myimage.fits") that ticks all the boxes for kernel-analysis. For this test, it should probably better be the image of a low-contrast large separation binary, not properly centered.

We also have the instrument model so that we can build the kernel-model.

import xara

import astropy.io.fits as pf

# load the image
img = pf.get_data("my_image.fits")

# creation of the KERNEL model
tgt = xara.KPO(fname="my_discrete_model.txt")

2 centering algorithm

For exploration purposes, the pipeline currently offers a couple of options, in the function called recenter0(), that will eventually replace the original recenter():

  • algo="COGI" means the centering algorithm will put the "center of gravity of the image" (hence COGI) at the center of the frame
  • algo="BCEN" means the centering algorithm will put the center of the brightest feature of the image at the center of the frame

We are going to produce two versions of the original image, using either option and then do the kernel-phase extraction but with the "recenter=False" option, since the recentering was previously done.

Note that in order to do the extraction, you need to feed the plate scale of your images, and the central wavelength (so that the code can compute the usual m2pix scaling factor).

img1 = xara.recenter0(img, algo="COGI", subpix=True, between=False)
img2 = xara.recenter0(img, algo="BCEN", subpix=True, between=False)

# visualize the Fourier-transform phase

plt.figure(1)
plt.imshow(myftphase(

tgt.extract_KPD_single_frame(img1, pscale, wl, target="centered with COGI", recenter=False)
tgt.extract_KPD_single_frame(img2, pscale, wl, target="centered with BCEN", recenter=False)

The result of both extractions should be compared to the result of the application of your current algorithm. I believe the results of the "BCEN" option will be identical.

3 subpixel recentering

Is sub-pixel scale centering of the data useful? The option can be turned off in the function call.

img3 = xara.recenter0(img, algo="BCEN", subpix=False, between=False)
img4 = xara.recenter0(img, algo="BCEN", subpix=True, between=False)

tgt.extract_KPD_single_frame(img3, pscale, wl, target="centered with COGI", recenter=False)
tgt.extract_KPD_single_frame(img4, pscale, wl, target="centered with BCEN", recenter=False)

plt.figure()
plt.plot(tgt.KPDT[2][0], tgt.KPDT[3][0], '.')

Assuming that you've performed all the steps before this final plot, you should have had 4 consecutive uses of the extract_KPD_single_frame() function which is why you should want to plot the result of data set #2 against #3 in order to compare the kernels extract with and without sub-pixel centering. In the few test cases I've run, the results were strictly identical.

4 confirm?

If you can confirm those observations with your test-case, I shall make the algo="BCEN" and subpix=False options the defaults for the kernel-phase extraction of all data.

Back to the documentation index

Author: Frantz Martinache

Created: 2018-12-18 Tue 17:32

Validate