Image Movement Kernel (photometry.ImageMovementKernel)

class photometry.ImageMovementKernel(warpmode='euclidian', image_ref=None, wcs_ref=None)[source]

Bases: object

__init__(warpmode='euclidian', image_ref=None, wcs_ref=None)[source]

Initialize ImageMovementKernel.

Parameters:
  • warpmode (string) – Options are 'unchanged', 'translation', 'euclidian' and 'wcs'. Default is 'euclidian'.
  • image_ref (2D ndarray) – Reference image used
apply_kernel(xy, kernel)[source]

Application of warp matrix to pixel coordinates

Parameters:
  • xy (2D ndarray) – 2D array of image positions to be transformed.
  • kernel (1D ndarray) – The kernel to transform against.
Returns:

Change in positions compared to reference.

Return type:

ndarray

Code author: Mikkel N. Lund

Code author: Rasmus Handberg <rasmush@phys.au.dk>

calc_kernel(image, number_of_iterations=10000, termination_eps=1e-06)[source]

Calculates the position movement kernel for a given image. This kernel is a set of numbers that can be passed to apply_kernel to calculate the movement of a star at specific coordinates.

Calculation of Enhanced Correlation Coefficient (ECC) Maximization using OpenCV.

Parameters:
  • image (ndarray) – Image to calculate kernel for.
  • number_of_iterations (integer, optional) – Specify the number of iterations.
  • termination_eps (float, optional) – Specify the threshold of the increment in the correlation coefficient between two iterations.
Returns:

Return type:

ndarray

Code author: Mikkel N. Lund

Code author: Rasmus Handberg <rasmush@phys.au.dk>

interpolate(time, xy)[source]

Interpolate in the kernel time-series provided in load_series() to obtain movment a arbitrery time.

Parameters:
  • time (float) – Timestamp to return movement for.
  • xy (2D array) – row and column positions to be modified.
Returns:

Array with the same size as xy containing the
changes to rows and columns. These can be added

to xy to yield the new positions.

Return type:

numpy.ndarray

Raises:

ValueError – If timeseries has not been provided.

jitter(time, column, row)[source]

Calculate the change to a given position as a function of time.

Parameters:
  • time (ndarray) – Array of timestamps to calculate position changes for.
  • column (float) – Column position at reference time.
  • row (float) – Row position at reference time.
Returns:

2D array with changes in column and row for each timestamp.

Return type:

ndarray

load_series(times, kernels)[source]

Load time-series of kernels and create interpolator.

The interpolator (interpolator()) can be used to obtain movements at a arbitrery timestamp within the timestamps provided in times.

Parameters:
  • time (1D array) – Timestamps to be interpolated against. Timestamps must be sorted.
  • kernels (2D array) – List of kernels.
Raises:

ValueError – If kernels have the wrong shape.

N_PARAMS = {'euclidian': 3, 'translation': 2, 'unchanged': 0, 'wcs': 1}