DataSet

class jwst.wfs_combine.wfs_combine.DataSet(input_model_1, input_model_2, do_refine, flip_dithers, psf_size, blur_size, n_size)[source]

Bases: object

Two dithered input wavefront sensing images to be combined.

Parameters:
input_model_1JwstDataModel

First input datamodel

input_model_2JwstDataModel

Second input datamodel

do_refinebool

True if refined offset calculation and application is to be made

flip_dithersbool

True will cause the dithers to align in pixel coordinates for different filters

psf_sizefloat

Size of largest PSF

blur_sizefloat

Amount of smoothing to apply before finding the initial centroid

n_sizeint

Size of interpolation box

Methods Summary

apply_final_offsets()

Apply final offsets, aligning each array for image 2 to 1's frame.

create_aligned_2()

Align image 2 in image 1's frame.

create_combined(image1, image2)

Create combined image from aligned input images.

do_2d_shifts(a)

Create 2D output array by shifting 2D array input by (off_x, off_y).

do_all()

Execute all tasks for Wave Front Sensing Combination.

get_wcs_offsets()

Get the nominal offsets from the WCS information of each of the 2 input DataModel objects.

Methods Documentation

apply_final_offsets()[source]

Apply final offsets, aligning each array for image 2 to 1’s frame.

Returns:
data_2_andarray

Aligned SCI array (float) of image 2

dq_2_andarray

Aligned DQ array (int) of image 2

err_2_andarray

Aligned ERR array (float) of image 2

create_aligned_2()[source]

Align image 2 in image 1’s frame.

If refined offset determination is selected, do steps 1-7 else do 7 only:

  1. Create a smoothed image of the input SCI data of image 1. First create an image to smooth by first setting SCI pixels with bad DQ values equal to the mean of the good pixels. Then smooth this ‘repaired’ image using a Gaussian kernel of size BLUR_SIZE.

  2. Find the approximate centroid of this PSF, by taking all the pixels in this smoothed image that exceed 50% of the maximum of the smoothed image, and taking the mean of the coordinates of these pixels. The x- and y-mean defines the centroid location.

  3. Set the limits of the subarrays for interpolation by taking this centroid +/- psf_size and adding the BLUR_SIZE, taking the edges into account.

  4. Determine overlap of these interpolated images, and return nominally aligned, interpolated images.

  5. Around this nominal alignment, calculate refined (delta) offsets.

  6. Add the refined delta offsets to the nominal offsets.

  7. Do final alignment for original (not interpolated) image 2.

Returns:
model_2_aImageModel

Aligned model for input image 2.

create_combined(image1, image2)[source]

Create combined image from aligned input images.

In the combined image, the SCI pixel values are set by:

  1. for pixels that are good (based on DQ) in both images, use their average

  2. for pixels that are good in image 1 and bad in image 2, use image 1

  3. for pixels that are bad in image 1 and good in image 2, use image 2

  4. for pixels that are bad in both images, leave as default (0)

The DQ pixel values are set by:

  1. use pixels that are good in either image 1 or image 2

  2. for pixels that are bad in both images, add a ‘DO_NOT_USE’ value to the corresponding DQ value

The ERR pixel values are similarly set:

  1. for pixels that are good in both images, use their average (will modify later)

  2. for pixels that are good in image 1 and bad in image 2, use image 1

  3. for pixels that are bad in image 1 and good in image 2, use image 2

  4. for pixels that are bad in both images, leave as default (0)

The WCS of the output model is set to the WCS of the 1st input.

Parameters:
image1ImageModel

Aligned image from input 1

image2ImageModel

Aligned image from input 2

Returns:
data_combndarray

Combined SCI array (float)

dq_combndarray

Combined DQ array (int)

err_combndarray

Combined ERR array (float)

do_2d_shifts(a)[source]

Create 2D output array by shifting 2D array input by (off_x, off_y).

The output will have the same dimensions as the input.

Parameters:
andarray

Input array (float)

Returns:
bndarray

Shifted array of a (float)

do_all()[source]

Execute all tasks for Wave Front Sensing Combination.

Returns:
new_modelJwstDataModel

Combined input file data

get_wcs_offsets()[source]

Get the nominal offsets from the WCS information of each of the 2 input DataModel objects.

From the difference in pointings (in pixels) of the 2 images, round off to the nearest integers as the specifications require that the pointings will differ by exact integers.

Returns:
off_xint

Difference (image 2 - image 1) in pointing in pixels in the x-direction

off_yint

Difference (image 2 - image 1) in pointing in pixels in the y-direction