Skip to content

Commit

Permalink
if echotime is invalid, catch it
Browse files Browse the repository at this point in the history
  • Loading branch information
sinhaharsh committed Nov 21, 2023
1 parent fdb984a commit 089d807
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions protocol/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2054,11 +2054,15 @@ def from_dict(self, params_dict):
def set_echo_times(self, echo_times, echo_number=None):
"""Sets the echo times for a multi-echo sequence."""

if len(echo_times) > 1:
self.multi_echo = True
else:
self.multi_echo = False
self.multi_echo = len(echo_times) > 1

try:
self['EchoTime'] = MultiValueEchoTime(echo_times)
except (TypeError, ValueError):
self['EchoTime'] = MultiValueEchoTime(Invalid)

self['EchoTime'] = MultiValueEchoTime(echo_times)
if echo_number is not None:
self['EchoNumber'] = MultiValueEchoNumber(echo_number)
try:
self['EchoNumber'] = MultiValueEchoNumber(echo_number)
except (TypeError, ValueError):
self['EchoNumber'] = MultiValueEchoNumber(Invalid)

0 comments on commit 089d807

Please sign in to comment.