imr-framework / pypulseq

Pulseq in Python
https://pypulseq.readthedocs.io
GNU Affero General Public License v3.0
112 stars 58 forks source link

Possible bug in sequence.py #105

Closed tblazey closed 1 year ago

tblazey commented 1 year ago

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

(https://github.com/imr-framework/pypulseq/blob/c246ff9ff0018ab9b5a6b4add3850f068f61b034/pypulseq/Sequence/sequence.py#L1475-L1479)

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

tblazey commented 1 year ago

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

sravan953 commented 1 year ago

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

btasdelen commented 1 year ago

Fixed with #110.