From 2784fac462775aeed78b7b485d6de4f11c25fb47 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Thu, 12 Dec 2024 11:45:12 -0500 Subject: [PATCH 1/3] rdm compatibility, move romandeps test to CI workflows --- .github/workflows/ci_cron_weekly.yml | 20 ------------------- .github/workflows/ci_workflows.yml | 6 ++++++ jdaviz/configs/rampviz/plugins/parsers.py | 6 ++++++ .../ramp_extraction/ramp_extraction.py | 4 +++- jdaviz/conftest.py | 4 +--- pyproject.toml | 2 +- 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci_cron_weekly.yml b/.github/workflows/ci_cron_weekly.yml index 5ce2bb6a6c..664dea7664 100644 --- a/.github/workflows/ci_cron_weekly.yml +++ b/.github/workflows/ci_cron_weekly.yml @@ -54,23 +54,3 @@ jobs: python -m pip install tox - name: Test with tox run: tox -e py311-test-devdeps-romandeps - - ci_cron_tests_stable_roman: - name: Python 3.10 with stable versions of dependencies and Roman - runs-on: ubuntu-latest - if: (github.repository == 'spacetelescope/jdaviz' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Extra CI'))) - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - name: Set up python - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - with: - python-version: '3.10' - - name: Install base dependencies - run: | - python -m pip install --upgrade pip - python -m pip install tox - - name: Test with tox - run: tox -e py310-test-romandeps diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 3984f9d713..bf5d9b9848 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -72,6 +72,12 @@ jobs: toxposargs: --remote-data --run-slow allow_failure: true + - name: Python 3.11 with stable versions of dependencies and Roman + python: '3.11' + runs-on: ubuntu-latest + toxenv: py311-test-romandeps + allow_failure: true + steps: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/jdaviz/configs/rampviz/plugins/parsers.py b/jdaviz/configs/rampviz/plugins/parsers.py index 2444c584a9..4d30c8c90a 100644 --- a/jdaviz/configs/rampviz/plugins/parsers.py +++ b/jdaviz/configs/rampviz/plugins/parsers.py @@ -196,6 +196,12 @@ def _roman_3d_to_glue_data( data_reshaped = move_group_axis_last(data) diff_data_reshaped = move_group_axis_last(diff_data) + # if the ramp cube has no units, assume DN: + if getattr(data_reshaped, 'unit', None) is None: + assumed_unit = u.DN + data_reshaped <<= assumed_unit + diff_data_reshaped <<= assumed_unit + # load these cubes into the cache: app._jdaviz_helper.cube_cache[ramp_cube_data_label] = NDDataArray( data_reshaped diff --git a/jdaviz/configs/rampviz/plugins/ramp_extraction/ramp_extraction.py b/jdaviz/configs/rampviz/plugins/ramp_extraction/ramp_extraction.py index a2e3395abb..ed69cba190 100644 --- a/jdaviz/configs/rampviz/plugins/ramp_extraction/ramp_extraction.py +++ b/jdaviz/configs/rampviz/plugins/ramp_extraction/ramp_extraction.py @@ -342,7 +342,9 @@ def _extract_from_aperture(self, **kwargs): # after the fancy indexing above, axis=1 corresponds to groups, and # operations over axis=0 corresponds to individual pixels: axis=0 - ) << nddata.unit + ) + if nddata.unit is not None: + collapsed <<= nddata.unit def expand(x): # put the resulting 1D profile (counts vs. groups) into the diff --git a/jdaviz/conftest.py b/jdaviz/conftest.py index ec1fdc7a32..748a519905 100644 --- a/jdaviz/conftest.py +++ b/jdaviz/conftest.py @@ -64,9 +64,7 @@ def roman_level_1_ramp(): shape = (10, 25, 25) data_model = mk_datamodel(RampModel, shape=shape, dq=False) - data_model.data = u.Quantity( - 100 + 3 * np.cumsum(rng.uniform(size=shape), axis=0), u.DN - ) + data_model.data = 100 + 3 * np.cumsum(rng.uniform(size=shape), axis=0) return data_model diff --git a/pyproject.toml b/pyproject.toml index 98d2ccb61a..14beb14f6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,7 @@ docs = [ "sphinx_design" ] roman = [ - "roman_datamodels>=0.17.1", + "roman_datamodels>=0.22.0", ] [build-system] From 32b0425eacecb64eb1966661919c5ee63ce1caef Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:27:27 -0500 Subject: [PATCH 2/3] Fix ci_workflows.yml and let Roman use remote data --- .github/workflows/ci_workflows.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index bf5d9b9848..158f6d02d2 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -73,9 +73,10 @@ jobs: allow_failure: true - name: Python 3.11 with stable versions of dependencies and Roman + os: ubuntu-latest python: '3.11' - runs-on: ubuntu-latest toxenv: py311-test-romandeps + toxposargs: --remote-data allow_failure: true steps: From e1806210cdc73a0ae7546213465b9b570b8f4807 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Thu, 12 Dec 2024 15:22:38 -0500 Subject: [PATCH 3/3] remove remote-data --- .github/workflows/ci_workflows.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 158f6d02d2..76feaab5e0 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -76,7 +76,6 @@ jobs: os: ubuntu-latest python: '3.11' toxenv: py311-test-romandeps - toxposargs: --remote-data allow_failure: true steps: