imr-framework / pypulseq

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

Bug in makearbitrary_rf.py #3

Closed Mmj94 closed 5 years ago

Mmj94 commented 5 years ago

No option available when nargout=1 (no gz as output)

sravan953 commented 5 years ago

Could you clarify what you meant?

Mmj94 commented 5 years ago
if nargout > 1:
        if slice_thickness <= 0:
            raise ValueError('Slice thickness must be provided')
        if bandwidth <= 0:
            raise ValueError('Bandwidth of pulse must be provided')

        system.maxgrad = max_grad if max_grad > 0 else system.maxgrad
        system.max_slew = max_slew if max_slew > 0 else system.max_slew

        BW = bandwidth
        if time_bw_product > 0:
            BW = time_bw_product / duration

        amplitude = BW / slice_thickness
        area = amplitude * duration
        kwargs_for_trap = {"channel": 'z', "system": system, "flat_time": duration, "flat_area": area}
        gz = make_trapezoid(**kwargs_for_trap)

        t_fill = np.arange(1, round(gz.rise_time / 1e-6) + 1) * 1e-6
        rf.t = [t_fill, rf.t + t_fill[-1], t_fill + rf.t[-1] + t_fill[-1]]
        rf.signal = [np.zeros(len(t_fill)), rf.signal, np.zeros(len(t_fill))]

ADD:

 else:
        gz = None
sravan953 commented 5 years ago

Fixed in 67753e93f1ec9c145716c2ba796eac68e8ea5b38.