imr-framework / pypulseq

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

Shape check for arbitrary rf/grad #22

Closed Mmj94 closed 4 years ago

Mmj94 commented 5 years ago

Is your feature request related to a problem? Please describe. If a waveform of shape (1,x) is used to construct arbitrary rf or gradient events they cannot be successfully added to a block.

Describe the solution you'd like Perform shape checking

sravan953 commented 4 years ago

Could you share code to reproduce this?

Mmj94 commented 4 years ago
`from pypulseq.opts import Opts  
from pypulseq.Sequence.sequence import Sequence
from pypulseq.make_arbitrary_rf import make_arbitrary_rf

import numpy as np
import math

system = Opts(max_grad=32, grad_unit='mT/m', max_slew=130, slew_unit='T/m/s', grad_raster_time=10e-6, rf_raster_time= 10e-6)
seq = Sequence(system)

rf = np.ones((1, 300), dtype=complex)
#rf = np.ones((300, 1), dtype=complex)

rf_waveform, _ = make_arbitrary_rf(flip_angle=90 * 180 / math.pi, system=system, signal=rf)
seq.add_block(rf_waveform)`
            
Mmj94 commented 4 years ago

Running the code above as it is, it would break. However, if you run the second rf line instead that is now commented, it will go through.

sravan953 commented 4 years ago

Thank you! Commit 0f55671aaa41beb5bc56c39e3c437aed31fcbc1a should have fixed this. Please let me know so I can close the issue.

Mmj94 commented 4 years ago

Yes, this fixes the above problem. You can close the issue.