Skip to content

Commit

Permalink
only necessary changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-goldman committed Sep 3, 2024
1 parent a414a05 commit 59fa5e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions stwcs/distortion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ def __init__(self, idcfile, date=None, chip=1, direction='forward',
self.refpix['PSCALE'] = np.float64(self.refpix['PSCALE']) * binned
self.cx = self.cx * binned
self.cy = self.cy * binned
self.refpix['XREF'] = np.float64(self.refpix['XREF']) / binned
self.refpix['YREF'] = np.float64(self.refpix['YREF']) / binned
self.refpix['XREF'] = self.refpix['XREF'] / binned
self.refpix['YREF'] = self.refpix['YREF'] / binned
self.refpix['XSIZE'] = self.refpix['XSIZE'] / binned
self.refpix['YSIZE'] = self.refpix['YSIZE'] / binned

Expand Down
4 changes: 2 additions & 2 deletions stwcs/updatewcs/makewcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def updateWCS(cls, ext_wcs, ref_wcs):
return {}

# promote scalars manually for Numpy 2.0+
ext_wcs = utils.promote_idctab_floats(ext_wcs)
ref_wcs = utils.promote_idctab_floats(ref_wcs)
ext_wcs.idcmodel.refpix['PSCALE'] = np.float64(ext_wcs.idcmodel.refpix['PSCALE'])
ref_wcs.idcmodel.refpix['PSCALE'] = np.float64(ref_wcs.idcmodel.refpix['PSCALE'])

ltvoff, offshift = cls.getOffsets(ext_wcs)

Expand Down
12 changes: 0 additions & 12 deletions stwcs/updatewcs/utils.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import os
import numpy as np
from stsci.tools import fileutil

import logging
logger = logging.getLogger("stwcs.updatewcs.utils")

def promote_idctab_floats(wcs):
"""
Promote scalars properly in Numpy 2.0, which was
automated in Numpy <2.0. Keys are values in the IDCTAB.
"""
keys = ['PSCALE', 'XREF', 'YREF', 'THETA']
for key in keys:
if wcs.idcmodel.refpix[key]:
wcs.idcmodel.refpix[key] = np.float64(wcs.idcmodel.refpix[key])
return wcs


def diff_angles(a, b):
"""
Expand Down

0 comments on commit 59fa5e2

Please sign in to comment.