imr-framework/pypulseq

Compatibility with Pulseq 1.3.1 broken

schuenke opened this issue · 1 comments

Describe the bug
Reading Pulseq 1.3.1 sequences does not work any more.

To Reproduce
Try to read any 1.3.1 sequence, e.g. the gre_example.seq

Expected behavior
PyPulseq 1.4.0 should be backwards compatible with Pulseq 1.3.1 files. The case is (supposed to be) catched in functions like Sequence.read() etc.

Detailed description
First of all, I get an error from https://github.com/imr-framework/pypulseq/blob/db19dda7088e91841f2e7aba34d2fdd8929ddab6/pypulseq/Sequence/read_seq.py#L224C44-L224C44, because rf_library has no attribute lenghts

As this seems not to be used, removing the line fixes this issue. Still, is lenghts in general supposed to be an attribute/property of EventLibrary? It's listed as a property here, but it's never defined or used?

However, the real issue IMO is the read_seq function, more precise in line 254-264.
The idea is to loop over the blocks and calculate the block durations to fill Sequence.block_durations, but within the get_block function in line 405, we (try to) set the duration of the block using the entries from Sequence.block_durations:

block.block_duration = self.block_durations[block_index]

which does not work for Pulseq 1.3.1 files, because we actually call get_block to calculate the block duration

I might have a look at this myself at some point, but wanted to keep it documented already.

I think I fixed this in PR #162 . The lengths issue was a remainder of my removing of the lengths field (because it was completely unused). And I think I fixed the other compatibility code, do give it a go with some other sequence files though.

The way I fixed it also should clear the way to completely remove delay_library from Sequence and reference to the delay event (e.g. in get_block), as they're unused now.