Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift distorted PSFs back to correct detector position #229

Merged
merged 5 commits into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions webbpsf/distortion.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import copy

import astropy.convolution
import astropy.io.fits as fits
import copy
import numpy as np
import poppy
import pysiaf
from scipy.interpolate import griddata
from scipy.ndimage.interpolation import rotate

import poppy


def _get_default_siaf(instrument, aper_name):
""" Store the default SIAF values for distortion and rotation """
Expand Down Expand Up @@ -98,6 +96,10 @@ def apply_distortion(hdulist_or_filename=None, fill_value=0):
# Going from Idl to Sci this way allows us to add in the distortion
xsci, ysci = aper.idl_to_sci(xidl, yidl)

# 6) Shift the sci indices so they match the PSF's position again (moved slightly off from pysiaf calculation)
xsci += xpix_center - np.median(xsci)
ysci += ypix_center - np.median(ysci)

# ###############################################
# Create an array of indices (in pixels) that the final data will be interpolated on to
# 1) Set up blank indices (in pixels)
Expand Down