Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAR calculation gives error due to missing RF signal #221

Open
h3lg3 opened this issue Dec 17, 2024 · 0 comments
Open

SAR calculation gives error due to missing RF signal #221

h3lg3 opened this issue Dec 17, 2024 · 0 comments
Assignees

Comments

@h3lg3
Copy link
Contributor

h3lg3 commented Dec 17, 2024

Describe the bug
Using the example sequence write_epi.py for the SAR calculation with the pypulseq.SAR.SAR_calc.cal_SAR(seq) function results in an error.

"SAR_calc.py", line 107, in _SAR_from_seq
signal = rf.signal
AttributeError: 'NoneType' object has no attribute 'signal'

To Reproduce

from write_epi import main as write_epi
import pypulseq as pp 

write_epi(plot = False, write_seq = True, seq_filename = 'epi_pypulseq.seq')

pp.SAR.SAR_calc.calc_SAR('epi_pypulseq.seq')

I would propose to check in addition to line 105 of SAR_calc.py if the signal of the rf event is not none.
Instead of

if hasattr(block, "rf"):  # has rf
    rf = block.rf
    signal = rf.signal

use

if hasattr(block, "rf"):  # has rf 
    rf = block.rf
    if rf is not None:  # rf signal is not None
        signal = rf.signal

However, I have the feeling that the rf block is always present in the current version of pypulseq, in that case the first if statement is obsolete, if that is not the case please correct me.

Kind regards
Helge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants