imr-framework / pypulseq

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

UnboundLocalError in make_sinc_pulse.py #46

Closed schuenke closed 3 years ago

schuenke commented 3 years ago

Since https://github.com/imr-framework/pypulseq/commit/7542b39630c1c4cefc6eb5ded3ddb290a54e487c I get the error UnboundLocalError: local variable 'gz' referenced before assignment when creating an rf pulse with make_sinc_pulse.py.

This happens when I set return_gz = False or when I don't set any return_gz value and thus use the False default value.

sravan953 commented 3 years ago

Please let me know if pulling from the latest dev commit fixes this issue for you.

schuenke commented 3 years ago

The

    if return_gz:
        return rf, gz, gzr
    else:
        return rf

fixed the issue.

For consistency I would use the same if-else style in the _make_gausspulse.py as well.

Very minor thing: the default for return_gz is False, but the docstring reads return_gz:bool, default=True

sravan953 commented 3 years ago

Thanks @schuenke for bearing with me. The latest commits must have fixed this for good!

schuenke commented 3 years ago

Issue is fixed now. Thanks @sravan953 !