Skip to content

24-produce-radiation-distribution-observation-test - #27

Draft
rsweeney-cfs wants to merge 1 commit into
mainfrom
24-produce-radiation-distribution-observation-test
Draft

rsweeney-cfs wants to merge 1 commit into
mainfrom
24-produce-radiation-distribution-observation-test

Conversation

@rsweeney-cfs

Copy link
Copy Markdown
Collaborator

This is a test of the observation of a DIII-D elongated ring. This test was fully implemented by Claude. Ryan read through the changes and confirmed that the test successfully runs. Below is Claude's summary:

Screenshot 2026-06-25 at 8 57 05 AM

*The motivation for this test is to prepare for an additional radDist observation workflow that leverages a dense, 3D voxelized grid that is observed once and used for all future builds. This is expected to allow rapid radDist development between SPARC pulses, using reconstructed disruption equilibria.

@rsweeney-cfs rsweeney-cfs linked an issue Jun 25, 2026 that may be closed by this pull request

@MishaVeldhoen MishaVeldhoen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looks great to me!

Some thoughts on the voxelized 3D grid observe idea:

  • When comparing the matrix against the current approach, you might want to consider a dedicated check involving more structures, and more observes per structure, to reduce the effect of statistical noise.
  • I expect narrower structures to be more problematic in the comparison, those could help guide the resolution that you want your matrix to be.

Comment on lines +84 to +90
@pytest.fixture(scope="module")
def observed():
"""Build + observe once; shared across the assertions in this module."""
pytest.importorskip("cherab", reason="cherab not installed")
pytest.importorskip("raysect", reason="raysect not installed")
golden = _load_golden()
return golden, _build_and_observe(golden["_meta"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of a fixture, this helps with not having to rerun the observe for each test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MishaVeldhoen, regarding your above comment about voxelization, I agree that this is the first test of many that should exist to verify that its working properly when compared with the existing radiation structure building method. On the statistical noise, I believe you now have the solution where we can provide Raysect with the random seed, thereby making it reproducible. Narrower structures are a good idea. I captured the need for this 3D voxelization in this issue: #32.

@MishaVeldhoen

Copy link
Copy Markdown
Collaborator

@rsweeney-cfs In #30 I've introduced a pytest marker, which is the pytest way to label tests for the purpose of opting in or out. If that PR merges before this one, then it can adopt that too.

# `pytestmark` applies a marker to *every* test in this file. The `cherab` marker
# (registered in pyproject.toml) means "slow, needs cherab": these tests are
# deselected from a normal `pytest` run and execute only via `pytest -m cherab`.
pytestmark = pytest.mark.cherab

Also, with the change in that PR, this test could drop the high tolerance.

@jherf
jherf force-pushed the 24-produce-radiation-distribution-observation-test branch from 14a7a23 to d425d40 Compare August 27, 2026 17:07
@jherf
jherf marked this pull request as draft August 28, 2026 17:03
@jherf

jherf commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Please update with the latest branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Produce radiation distribution observation test

3 participants