Skip to content

Commit

Permalink
add Trues
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Jan 28, 2025
1 parent a62dca5 commit c409c80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/pynwb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,21 @@ def _check_time_series_dimension(self):
"""Check that the 0th dimension of data equals the length of timestamps, when applicable.
"""
if self.timestamps is None:
return
return True

data_shape = get_data_shape(data=self.fields["data"], strict_no_data_load=True)
timestamps_shape = get_data_shape(data=self.fields["timestamps"], strict_no_data_load=True)

# skip check if shape of data or timestamps cannot be computed
if data_shape is None or timestamps_shape is None:
return
return True

# skip check if length of the first dimension is not known
if data_shape[0] is None or timestamps_shape[0] is None:
return
return True

if data_shape[0] == timestamps_shape[0]:
return
return True

return (
"%s '%s': Length of data does not match length of timestamps. Your data may be transposed. "
Expand Down
14 changes: 7 additions & 7 deletions src/pynwb/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _check_image_series_dimension(self):
is provided. Otherwise, this function calls the parent class' _check_time_series_dimension method.
"""
if self.external_file is not None:
return
return True
return super()._check_time_series_dimension()

def _check_external_file_starting_frame_length(self):
Expand All @@ -150,9 +150,9 @@ def _check_external_file_starting_frame_length(self):
the number of files in 'external_file'.
"""
if self.external_file is None:
return
return True
if get_data_shape(self.external_file) == get_data_shape(self.starting_frame):
return
return True

return (
"%s '%s': The number of frame indices in 'starting_frame' should have "
Expand All @@ -164,9 +164,9 @@ def _check_external_file_format(self):
Check that format is 'external' when external_file is specified.
"""
if self.external_file is None:
return
return True
if self.format == "external":
return
return True

return "%s '%s': Format must be 'external' when external_file is specified." % (
self.__class__.__name__,
Expand All @@ -178,9 +178,9 @@ def _check_external_file_data(self):
Check that data is an empty array when external_file is specified.
"""
if self.external_file is None:
return
return True
if get_data_shape(self.data)[0] == 0:
return
return True

return (
"%s '%s': Either external_file or data must be specified (not None), but not both."
Expand Down

0 comments on commit c409c80

Please sign in to comment.