Skip to content

Commit

Permalink
roman_datamodels compatibility, move romandeps test to CI workflows (
Browse files Browse the repository at this point in the history
…spacetelescope#3353)

* rdm compatibility, move romandeps test to CI workflows

* Fix ci_workflows.yml

---------

Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
  • Loading branch information
bmorris3 and pllim authored Dec 12, 2024
1 parent 11fe951 commit 05e9afb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/ci_cron_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
toxposargs: --remote-data --run-slow
allow_failure: true

- name: Python 3.11 with stable versions of dependencies and Roman
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-romandeps
allow_failure: true

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
6 changes: 6 additions & 0 deletions jdaviz/configs/rampviz/plugins/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions jdaviz/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ docs = [
"sphinx_design"
]
roman = [
"roman_datamodels>=0.17.1",
"roman_datamodels>=0.22.0",
]

[build-system]
Expand Down

0 comments on commit 05e9afb

Please sign in to comment.