Skip to content

zk/cocos#10

Merged
ZanderKeith merged 20 commits into
mainfrom
zk/cocos
May 13, 2026
Merged

zk/cocos#10
ZanderKeith merged 20 commits into
mainfrom
zk/cocos

Conversation

@ZanderKeith
Copy link
Copy Markdown
Collaborator

Our goal is to deploy on several different devices, so we need to carefully handle all the different coordinate conventions used. I propose converting everything to COCOS 1 and use that internally. This PR does that like so:

  1. Two helper functions detect_cocos and convert_cocos.
    Given an arbitrary eqdsk, detect_cocos will determine which COCOS is being used.
    Then, convert_cocos will use the proper sign mapping to convert the eqdsk into the target COCOS

  2. On creation of EquilibriumField, the eqdsk is automatically converted to COCOS 1

Now during field line tracing we can always be confident we know the correct vector for the field lines based on the signs of B0 and Ip.

One lingering thing which we might want to address is our definition of 'helicity'. At the moment, we're saying helicity is synonymous with the sign of m/n, where positive values are parallel to the field lines and negative values are antiparallel. I'm not sure this is technically correct but we can simply rename this to be something else (like mn_sign or whatever), or we can revisit in the future.

@ZanderKeith ZanderKeith marked this pull request as ready for review May 11, 2026 14:34
@ZanderKeith ZanderKeith requested a review from chandrarn May 11, 2026 14:34
@ZanderKeith ZanderKeith marked this pull request as draft May 12, 2026 22:03
Copy link
Copy Markdown
Collaborator

@chandrarn chandrarn left a comment

Choose a reason for hiding this comment

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

COCOS conversion looks good, branch confirmed to run with TARS. Branch does not yet integrate into my one-equilibrium-reconstruction ChiSq fit code due to a difference in how the sensor names are interpreted (my branch still uses the C-Mod sensor naming convention), but this issue can be resolved on my end, or in a later commit.
Code is confirmed to work with gEQDSK files on my end, and produces a reasonable synthetic Mirnov signal output for a synthetic 1/1 mode.

Image

@ZanderKeith ZanderKeith marked this pull request as ready for review May 13, 2026 17:23
@ZanderKeith ZanderKeith merged commit 261c52b into main May 13, 2026
11 checks passed
@ZanderKeith ZanderKeith deleted the zk/cocos branch May 14, 2026 17:18
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.

2 participants