Add Kehl ENDOR pulse sequences#80
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e28cb98f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if spinSys("CS_used")==true | ||
| CS_zz(m)=(sin(theta))^2*(cos(phi))^2*CS(3*m-2,1)... |
There was a problem hiding this comment.
Rotate CS tensors for every ENDOR nucleus
In field-domain powder simulations with multiple ENDOR nuclei and CS_used true, CS_zz is filled only once after the preceding for m=1:Ni_ENDOR loop, so m is left at the final nucleus and all earlier nuclei keep a zero chemical-shift contribution. The downstream ENDOR calculations index CS_zz(mm) for each nucleus, so their resonances are computed without their CS shifts in this mode.
Useful? React with 👍 / 👎.
| if isKey(values,'use_Bterm') | ||
| opt("Bterm")=values("use_Bterm"); |
There was a problem hiding this comment.
Honour the documented Bterm option key
All simulation code reads opt("Bterm"), and the added example populates values('Bterm'), but kehl_set_opt only checks for values('use_Bterm'); consequently a caller setting values('Bterm')=true silently gets opt("Bterm")=false, and none of the B-term branches run. This makes the option ineffective under the key exposed by the rest of the new API.
Useful? React with 👍 / 👎.
|
Follow-up update for the Kehl ENDOR examples:
Validation run locally:
|
|
Follow-up refactor update:
Validation run locally:
|
|
Follow-up parameter-pruning update:
Validation run locally:
|
|
Permutation-equivalence test requested in Slack:
Results against the unpermuted setup:
Result file: No source changes were needed for this test; the current inference from |
|
Inlining update pushed as What changed:
Validation:
Note: I started the full unthrottled graphical example functions as an extra check, but they were still running after several minutes; I stopped that run and used the reduced regression/permutation suites above as the acceptance tests for this commit. |
|
Refactoring update pushed as What changed:
Validation:
Numerical note:
|
|
Reference test figures updated from the current What I changed:
Validation:
No source-code changes were needed for this update. |
|
Update pushed as What changed:
Validation:
The older references made with legacy Kehl nuclear gamma values are now superseded by the Spinach isotope database path. |
|
Update pushed as What changed:
Validation:
I did not keep a compatibility wrapper; the helper is gone and all remaining state-vector conversions call Spinach directly. |
|
Update pushed as What changed:
Validation:
|
|
Update pushed as I corrected the architecture boundary I misunderstood earlier. What changed:
Validation:
GitHub reports no PR checks configured for the branch. |
|
Updated PR #80 with commit This slice removes the Validation:
|
|
Updated PR #80 with commit This pulls the non-trivial physics/helper subfunctions out of Validation:
|
|
Updated the Kehl ENDOR refactor with commit What changed:
Validation:
I left the small RF-frame |
|
Implemented the Hamiltonian-basis refactor requested here. Summary:
Validation run locally:
Commit: |
|
Hardening pass pushed in Summary:
Validation:
Note: local MATLAB on this host intermittently reports a known allocator crash after printing successful completion during some |
|
Full-system Kehl ENDOR refactor pushed in Summary:
Validation run locally:
I did not run the full unthrottled powder examples in this pass; after removing the reduced subsystem branch, the full state-space versions are expected to be much heavier. The reduced full-system gates above exercise the all-sequence and frequency-domain paths without reintroducing Kehl's own state-space reduction. |
|
Spinach-relaxation refactor pushed in Summary:
Validation run locally:
I did not rerun the full unthrottled powder examples in this slice; the targeted gates above cover the changed relaxation path without launching the heavy full-state-space powder jobs. |
|
Native Zeeman-Liouville refactor pushed in Summary:
Implementation note:
Validation run locally:
I did not rerun full unthrottled powder examples in this slice; the reduced full-system gates above cover the changed Liouville execution path without launching the heavy full powder jobs. |
|
Kehl ENDOR Liouville EPR-selection refactor pushed in What changed:
Validation:
|
|
Kehl operator-basis removal update pushed in Changes:
Validation run:
Confession / gates not run:
|
|
Kehl unused-signature cleanup pushed in Changes:
Validation run:
Confession / gates not run:
|
|
Kehl initial-state helper removal pushed in Changes:
Validation run:
Confession / gates not run:
|
|
Implemented the Kehl unit-normalisation pass requested in Slack. Commit: Summary:
Validation:
|
|
Implemented the follow-up Kehl ENDOR refactor in Summary:
Validation:
|
Summary
experiments/esr_hyperfine/examples/esr_sol_pulsed/endor_kehl_context()with pulse-sequence handles (@endor_kehl_mims,@endor_kehl_time) in the standard Spinach context stylespin_system; fundamental constants come fromspin_system.tols, and nuclear magnetogyric ratios now come directly from Spinachspin()with conversion from rad/s/T to Hz/T by division by2*piendor_kehl_mims.m,endor_kehl_time.m,endor_kehl_davies.m,endor_kehl_spinlock.m,endor_kehl_tensor.m, andendor_kehl_cp.mkehl_spin_label.m,kehl_nuc_gamma.m,kehl_mat_to_lbra.m,kehl_lket_to_mat.m, andkehl_spin_ops.mhilb2liouv(...,'statevec')directly; Liouville-ket-to-Hilbert-matrix recovery now uses directreshape(vec,sqrt(size(vec,1)),sqrt(size(vec,1)))operator()and the initial electron state from Spinachstate()through a reduced Spinach operator systemexptparameter bucket has been removed; sequence-specific pulse/RF/axis setup now appends fields toparametersinside the individualendor_kehl_*sequence filesendor_kehl_context.mis now a thin sequence-agnostic wrapper; non-trivial physics helpers were extracted to standalonekehl_*files, including spin-data extraction, EPR orientation selection, pulse-profile scaling, EPR-axis preparation, and line broadeningValidation
git diff --cached --checkbefore commit, and cleangit statusafter pushendor_kehl_context.mis 134 lines and contains only the public wrapper, trivialsequence_handle(), and inputgrumble()spinSys,spinOps,kehl_spin_ops,expt,parameters.expt,context_experiment, orcp_axisreferences remain in Kehl/context/example filesendor_kehl_context.mtmp/spinach_kehl_context_extract_allseq_20260508.mat[1 5 3 2 4], ENDOR[4 3 5]: Mims max_abs1.3322676295501878e-15, time max_abs8.3266726846886741e-17[5 2 1 4 3], ENDOR[2 5 4]: Mims max_abs8.8817841970012523e-16, time max_abs8.3266726846886741e-17The older references generated before the Spinach isotope/vectorisation/sequence-handle/direct-operator/parameter-field/context-extraction refactors are intentionally superseded by the current handle-based figures above.