Skip to content

Commit

Permalink
fs datatype checked to be integer
Browse files Browse the repository at this point in the history
  • Loading branch information
AminAlam committed May 21, 2024
1 parent 3505d18 commit d2e2f82
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions elecphys/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ def convert_mat_to_npz(mat_file: str, output_npz_folder: str,
data = mat_file_contents['data']
fs = mat_file_contents['fs']

# if fs is not a scalar, take the first element
if not np.isscalar(fs):
fs = fs[0]

# if fs is not an integer and cannot be converted to integer, raise error
if not isinstance(fs, int):
try:
fs = int(fs)
except ValueError:
raise ValueError('Sampling frequency must be an integer')

for ch_num in tqdm(range(data.shape[0])):
ch_name = f'Ch{ch_num+1}'
if notch_filter_freq == 0:
Expand Down

0 comments on commit d2e2f82

Please sign in to comment.