From 5f9d8d65cf2c1524254c778588d4699f5bc0691a Mon Sep 17 00:00:00 2001 From: Zach Burnett Date: Thu, 18 Jul 2024 12:24:20 -0400 Subject: [PATCH] replace usages of ``copy_arrays`` with ``memmap`` (#1316) --- CHANGES.rst | 2 ++ docs/roman/datamodels/datamodels_asdf.rst | 4 ++-- pyproject.toml | 2 +- romancal/linearity/linearity_step.py | 2 +- romancal/regtest/regtestdata.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5d1fa5e29..3497ed693 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -21,6 +21,8 @@ general - Rename highlevelpipeline to mosaic pipeline [#1249] +- replace usages of ``copy_arrays`` with ``memmap`` [#1316] + source_catalog -------------- - Add PSF photometry capability. [#1243] diff --git a/docs/roman/datamodels/datamodels_asdf.rst b/docs/roman/datamodels/datamodels_asdf.rst index e8dfff2d7..b75971ad1 100644 --- a/docs/roman/datamodels/datamodels_asdf.rst +++ b/docs/roman/datamodels/datamodels_asdf.rst @@ -65,7 +65,7 @@ To access the files via a python session, with rdm.open('r0000101001001001001_01101_0001_WFI16_cal.asdf') as model: - with asdf.open('r0000101001001001001_01101_0001_WFI16_cal.asdf', copy_arrays=True) as model: + with asdf.open('r0000101001001001001_01101_0001_WFI16_cal.asdf', memmap=False) as model: Once the files are loaded you can access various attributes. Below is a table @@ -103,7 +103,7 @@ The ASDF equivalent is If you trigger an error, "ValueError: assignment destination is read-only" - make sure the asdf file was opened with copy_arrays=True, or + make sure the asdf file was opened with memmap=False, or with mode='rw' You can also access and modify the data arrays diff --git a/pyproject.toml b/pyproject.toml index 0d1716169..6d50c58cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ classifiers = [ "Programming Language :: Python :: 3", ] dependencies = [ - "asdf >=2.15.0", + "asdf >=3.1.0", "asdf-astropy >=0.5.0", "astropy >=5.3.0", "crds >=11.16.16", diff --git a/romancal/linearity/linearity_step.py b/romancal/linearity/linearity_step.py index 6bd083281..6e42cde8b 100644 --- a/romancal/linearity/linearity_step.py +++ b/romancal/linearity/linearity_step.py @@ -36,7 +36,7 @@ def process(self, input): return input_model - lin_model = rdd.LinearityRefModel(self.lin_name, copy_arrays=True) + lin_model = rdd.LinearityRefModel(self.lin_name, memmap=False) # copy poly coeffs from linearity model so Nan's can be updated lin_coeffs = lin_model.coeffs diff --git a/romancal/regtest/regtestdata.py b/romancal/regtest/regtestdata.py index 94d7fad9f..8f950ef9f 100644 --- a/romancal/regtest/regtestdata.py +++ b/romancal/regtest/regtestdata.py @@ -755,7 +755,7 @@ def compare_asdf(result, truth, ignore=None, rtol=1e-05, atol=1e-08, equal_nan=T # lazy loading and memmory mapping open_kwargs = { "lazy_load": False, - "copy_arrays": True, + "memmap": False, } with ( asdf.open(result, **open_kwargs) as af0,