From 04889b84d8963dc326564ef334a3e38a98d3fbd3 Mon Sep 17 00:00:00 2001 From: teald Date: Wed, 2 Apr 2025 16:02:36 -0700 Subject: [PATCH 1/4] fix(dragons): Undeprecate header attr This undeprecates the header attr for AstroData objects. It's unclear why I originally deprecated it---I think because of how the access shakes out in either case (see Issue #92). --- astrodata/core.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/astrodata/core.py b/astrodata/core.py index 20a834e..cbe81db 100644 --- a/astrodata/core.py +++ b/astrodata/core.py @@ -28,7 +28,6 @@ from .utils import ( assign_only_single_slice, astro_data_descriptor, - deprecated, normalize_indices, returns_list, ) @@ -431,17 +430,8 @@ def hdr(self): return headers[0] if self.is_single else FitsHeaderCollection(headers) @property - @deprecated( - "Access to headers through this property is deprecated and " - "will be removed in the future. Use '.hdr' instead." - ) def header(self): - """Return the headers for the PHU and each extension. - - .. warning:: - - This property is deprecated and will be removed in the future. - """ + """Return the headers for the PHU and each extension.""" return [self.phu] + [ndd.meta["header"] for ndd in self._nddata] @property From bc4ba1a354cb73133114138214df11600d060bfd Mon Sep 17 00:00:00 2001 From: teald Date: Wed, 2 Apr 2025 16:19:28 -0700 Subject: [PATCH 2/4] fix(test): Remove test for deprecated header attr --- tests/unit/test_deprecated.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/unit/test_deprecated.py b/tests/unit/test_deprecated.py index 0004256..f7ce707 100644 --- a/tests/unit/test_deprecated.py +++ b/tests/unit/test_deprecated.py @@ -49,11 +49,6 @@ def test_open(example_fits_file): astrodata.open(example_fits_file) -def test_deprecated_astrodata_header(ad): - with pytest.warns(AstroDataDeprecationWarning): - ad.header - - def test_deprecated_astrodatafactory_openFile(example_fits_file): with pytest.warns(AstroDataDeprecationWarning): astrodata.factory._openFile(example_fits_file) From 2f05a92c083e9b9cfda6403d02083e4bbc1ddbfa Mon Sep 17 00:00:00 2001 From: teald Date: Wed, 2 Apr 2025 16:26:06 -0700 Subject: [PATCH 3/4] fix(test): Rename and fix test for deprecated header attr --- tests/unit/test_fits.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/unit/test_fits.py b/tests/unit/test_fits.py index 1264441..824aad3 100644 --- a/tests/unit/test_fits.py +++ b/tests/unit/test_fits.py @@ -754,18 +754,13 @@ def test_header_collection(GMOSN_SPECT): @skip_if_download_none @pytest.mark.dragons_remote_data -def test_header_deprecated(GMOSN_SPECT): +def test_header_attr(GMOSN_SPECT): ad = astrodata.from_file(GMOSN_SPECT) - with pytest.warns(AstroDataDeprecationWarning): - warnings.simplefilter("always", AstroDataDeprecationWarning) - header = ad.header + assert header[0]["ORIGNAME"] == "N20170529S0168.fits" assert header[1]["EXTNAME"] == "SCI" assert header[1]["EXTVER"] == 1 - with pytest.warns(AstroDataDeprecationWarning): - warnings.simplefilter("always", AstroDataDeprecationWarning) - header = ad[0].header assert header[0]["ORIGNAME"] == "N20170529S0168.fits" From 440db71a09d1ab53772009d61e06050d2513d52f Mon Sep 17 00:00:00 2001 From: teald Date: Wed, 2 Apr 2025 16:29:22 -0700 Subject: [PATCH 4/4] fix(test): Fix test for deprecated header attr --- tests/unit/test_fits.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_fits.py b/tests/unit/test_fits.py index 824aad3..a7eaf99 100644 --- a/tests/unit/test_fits.py +++ b/tests/unit/test_fits.py @@ -754,13 +754,17 @@ def test_header_collection(GMOSN_SPECT): @skip_if_download_none @pytest.mark.dragons_remote_data -def test_header_attr(GMOSN_SPECT): +def test_header(GMOSN_SPECT): ad = astrodata.from_file(GMOSN_SPECT) + header = ad.header + assert header[0]["ORIGNAME"] == "N20170529S0168.fits" assert header[1]["EXTNAME"] == "SCI" assert header[1]["EXTVER"] == 1 + header = ad.header + assert header[0]["ORIGNAME"] == "N20170529S0168.fits"