Skip to content

Enforce maxGrad/maxSlew in makeExtendedTrapezoid.m#245

Open
rmoskwa wants to merge 1 commit into
pulseq-admin:masterfrom
rmoskwa:fix/extended-trap-limit-checks
Open

Enforce maxGrad/maxSlew in makeExtendedTrapezoid.m#245
rmoskwa wants to merge 1 commit into
pulseq-admin:masterfrom
rmoskwa:fix/extended-trap-limit-checks

Conversation

@rmoskwa
Copy link
Copy Markdown
Contributor

@rmoskwa rmoskwa commented Apr 26, 2026

mr.makeExtendedTrapezoid performs no slew or amplitude check in its default (convert2arbitrary = false) branch. Shapes that exceed system.maxGrad or system.maxSlew are constructed silently. The convert2arbitrary = true branch already gets these checks via mr.makeArbitraryGrad, so the two calling modes diverge

To keep the errors consistent with convert2arbitrary, errors are in format of 'Slew rate violation (%.0f%%)' and 'Gradient amplitude violation (%.0f%%)'

Before opening this PR, I checked by running demo scripts successfully with the commit: writeTSE, writeHASTE, writeSpiral, and some others

@rmoskwa
Copy link
Copy Markdown
Contributor Author

rmoskwa commented Apr 26, 2026

Hmm...I traced through the tests a bit, failures are going through addGradients/rotate/transformFOV.

The failures do stem from genuine exceeded limits from ramp overlap. The culprit seems to be mr.addGradients. The proposed mr.makeExtendedTrapezoid check catches it downstream...which is not as helpful.

While I think a check inside mr.makeExtendedTrapezoid makes sense in case a user directly calls it, errors are more likely to spawn from a lack of checks inside mr.addGradients. Curious what maintainers think!

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.

1 participant