Bring changes from pywcs to astropy

Aside from bug fixes this PR changes the format of the detector to image (D2IM) correction.
The current format allows a D2IM correction in the form of a lookup table to be applied separately to each chip in a multichip detector.