imr-framework/pypulseq

Possible bug in sequence.py

tblazey opened this issue · 3 comments

Hi,

I noticed that the adc times returned by waveforms_and_times in sequence.py are rather large. I think the issue starts at line 1475 of sequence.py

(

t_adc.extend(
np.arange(block.adc.num_samples)
+ 0.5 * block.adc.dwell
+ block.adc.delay
+ curr_dur
)

I think the np.arange call needs to be multiplied by block.adc.dwell and then half the dwell time should be added. I hope I am referencing the most current version of pypulseq. Apologies for not doing that last time.

Thanks,

-Tyler

HI,

Below is some simple code that reproduces the issue:

#Create sequence object
import pypulseq as pp
seq = pp.Sequence()

#Create adc event
seq.add_block(pp.make_adc(2048, dwell=1/25E3))

#Show adc time points
_, _, _, t_adc, _ = seq.waveforms_and_times()
print(t_adc)

The current behavior gives a minimum time of 2e-05 and a maximum time of 2.04700002e+03. With the change I put in #108, the range is 2e-05 to 8.190e-02.

Thanks,

-Tyler

Thanks for reporting this bug and also submitting a bug-fix PR!

Fixed with #110.