Skip to content

Mismatch in the section name for gradients in seq.read and seq.write #26

Closed
@tonggehua

Description

@tonggehua

Describe the bug
The seq.write function generates files that cannot be read by seq.read because the gradient section name is different between the two ([GRAD] according to the write function and [GRADIENTS] as expected by the read function).

To Reproduce
Run the following code (under Pypulseq 1.2.1):

from pypulseq.Sequence.sequence import Sequence
from pypulseq.make_sinc_pulse import make_sinc_pulse
from pypulseq.make_extended_trapezoid import make_extended_trapezoid
from pypulseq.opts import Opts
from math import pi

system = Opts()
seq = Sequence()
g = make_extended_trapezoid(channel='x',times=[0,0.01],amplitudes=[1,2],system=system)
seq.add_block(g)
seq.write('test.seq')
seq2 = Sequence()
seq2.read('test.seq')

Expected behavior
The sequence should be read without generating an error.

Error message
When run, this error appears:

  File "(personal system path)\pypulseq\Sequence\read_seq.py", line 57, in read
    raise ValueError(f'Unknown section code: {section}')
ValueError: Unknown section code: [GRADIENTS]

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Pro
  • Version: pypulseq 1.2.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions