Skip to content

Commit

Permalink
Merge pull request #6 from ELGarulli/3-suppress-attributeerror-when-i…
Browse files Browse the repository at this point in the history
…terating-through-multiple-stream-names-in-tdt

Closes #3
  • Loading branch information
ELGarulli authored Feb 1, 2024
2 parents fc9eddf + 86c7dc3 commit 11e5ef0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion neurokin/experiments/neural_correlates.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def get_neural_correlates_dict(neural_path,
raw, fs = get_neural_ch(neural_path, channel_of_interest, name)
is_valid_name = True
break
except:
except (AttributeError, TypeError):
pass
if not is_valid_name:
raise Exception("All stream names were invalid")
Expand Down
7 changes: 3 additions & 4 deletions neurokin/utils/neural/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def import_tdt_channel_data(folderpath, ch=0, t1=0, t2=-1, stream_name="Wav1", s
raw = stored.data
fs = stored.fs

except AttributeError:
print(f"No stream named {stream_name}, please specify the correct stream_name \n "
f"Please chose from: {data.streams.__dict__.keys()}")
except AttributeError(f"No stream named {stream_name}, please specify the correct stream_name \n "
f"Please chose from: {data.streams.__dict__.keys()}"):
return

s1 = 0
Expand All @@ -83,7 +82,7 @@ def import_tdt_channel_data(folderpath, ch=0, t1=0, t2=-1, stream_name="Wav1", s
return
stim_data = stim_data[..., s1:s2]

if fs_sync is None:
if fs_sync is not None:
if fs_sync != fs:
print("Warning: sync frequency is different from the data frequency")

Expand Down

0 comments on commit 11e5ef0

Please sign in to comment.