From 1e3c1b633b902f2e6ae1e067161943135ff75970 Mon Sep 17 00:00:00 2001 From: Nadia Dencheva Date: Wed, 28 Sep 2016 10:12:21 -0400 Subject: Change deprecated fits calls --- stwcs/wcsutil/altwcs.py | 2 +- stwcs/wcsutil/wcscorr.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stwcs/wcsutil/altwcs.py b/stwcs/wcsutil/altwcs.py index 2d1565d..043d535 100644 --- a/stwcs/wcsutil/altwcs.py +++ b/stwcs/wcsutil/altwcs.py @@ -561,7 +561,7 @@ def convertAltWCS(fobj, ext, oldkey=" ", newkey=' '): cname = card else: cname = card.rstrip(oldkey) - hdr.rename_key(card, cname + newkey, force=True) + hdr.rename_keyword(card, cname + newkey, force=True) return hdr diff --git a/stwcs/wcsutil/wcscorr.py b/stwcs/wcsutil/wcscorr.py index 48a1978..e018ae0 100644 --- a/stwcs/wcsutil/wcscorr.py +++ b/stwcs/wcsutil/wcscorr.py @@ -409,7 +409,7 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None, active=True): if (old_nrows + new_nrows) > old_table.data.shape[0] - 1: pad_rows = 2 * new_nrows # if not, create a new table with 'pad_rows' new empty rows - upd_table = fits.new_table(old_table.columns, header=old_table.header, + upd_table = fits.from_columns(old_table.columns, header=old_table.header, nrows=old_table.data.shape[0] + pad_rows) else: upd_table = old_table @@ -542,7 +542,7 @@ def create_wcscorr(descrip=False, numrows=1, padding=0): dtype='S128'))) # Now create the new table from the column definitions - newtab = fits.new_table(fits.ColDefs(col_list), nrows=trows) + newtab = fits.from_columns(fits.ColDefs(col_list), nrows=trows) # The fact that setting .name is necessary should be considered a bug in # pyfits. # TODO: Make sure this is fixed in pyfits, then remove this -- cgit From 430e4ebf49e5b731b7549b8dba2b4b6866ba6f8a Mon Sep 17 00:00:00 2001 From: Nadia Dencheva Date: Wed, 28 Sep 2016 12:11:27 -0400 Subject: use correct call to create a table --- stwcs/wcsutil/wcscorr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stwcs/wcsutil/wcscorr.py b/stwcs/wcsutil/wcscorr.py index e018ae0..397e6a8 100644 --- a/stwcs/wcsutil/wcscorr.py +++ b/stwcs/wcsutil/wcscorr.py @@ -409,8 +409,8 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None, active=True): if (old_nrows + new_nrows) > old_table.data.shape[0] - 1: pad_rows = 2 * new_nrows # if not, create a new table with 'pad_rows' new empty rows - upd_table = fits.from_columns(old_table.columns, header=old_table.header, - nrows=old_table.data.shape[0] + pad_rows) + upd_table = fits.BinTableHDU.from_columns(old_table.columns, header=old_table.header, + nrows=old_table.data.shape[0] + pad_rows) else: upd_table = old_table pad_rows = 0 @@ -542,7 +542,7 @@ def create_wcscorr(descrip=False, numrows=1, padding=0): dtype='S128'))) # Now create the new table from the column definitions - newtab = fits.from_columns(fits.ColDefs(col_list), nrows=trows) + newtab = fits.BinTableHDU.from_columns(fits.ColDefs(col_list), nrows=trows) # The fact that setting .name is necessary should be considered a bug in # pyfits. # TODO: Make sure this is fixed in pyfits, then remove this -- cgit