-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove past PyNWB version references * explictly pin lower bound * restore accidental context removal * fix image test import * Update CHANGELOG.md Co-authored-by: Steph Prince <[email protected]> --------- Co-authored-by: CodyCBakerPhD <[email protected]> Co-authored-by: Steph Prince <[email protected]>
- Loading branch information
1 parent
bdf3548
commit e3cc7e2
Showing
9 changed files
with
72 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
"""Checks specific to the Images neurodata type.""" | ||
|
||
from packaging.version import Version | ||
from pynwb.base import Images | ||
from pynwb.image import IndexSeries | ||
|
||
from .._registration import Importance, InspectorMessage, register_check | ||
from ..utils import get_package_version | ||
|
||
# The Images neurodata type was unavailable prior to PyNWB v.2.1.0 | ||
if get_package_version(name="pynwb") >= Version("2.1.0"): | ||
from pynwb.base import Images | ||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=Images) | ||
def check_order_of_images_unique(images: Images): | ||
"""Check that all the values in the order_of_images field of an Images object are unique.""" | ||
if images.order_of_images is None: | ||
return | ||
if not len(set(images.order_of_images)) == len(images.order_of_images): | ||
return InspectorMessage(message="order_of_images should have unique values.") | ||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=Images) | ||
def check_order_of_images_len(images: Images): | ||
"""Check that all the values in the order_of_images field of an Images object are unique.""" | ||
if images.order_of_images is None: | ||
return | ||
if not len(images.order_of_images) == len(images.images): | ||
return InspectorMessage( | ||
message=f"Length of order_of_images ({len(images.order_of_images)}) does not match the number of " | ||
f"images ({len(images.images)})." | ||
) | ||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=IndexSeries) | ||
def check_index_series_points_to_image(index_series: IndexSeries): | ||
if index_series.indexed_timeseries is not None: | ||
return InspectorMessage( | ||
message="Pointing an IndexSeries to a TimeSeries will be deprecated. Please point to an Images " | ||
"container instead." | ||
) | ||
|
||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=Images) | ||
def check_order_of_images_unique(images: Images): | ||
"""Check that all the values in the order_of_images field of an Images object are unique.""" | ||
if images.order_of_images is None: | ||
return | ||
if not len(set(images.order_of_images)) == len(images.order_of_images): | ||
return InspectorMessage(message="order_of_images should have unique values.") | ||
|
||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=Images) | ||
def check_order_of_images_len(images: Images): | ||
"""Check that all the values in the order_of_images field of an Images object are unique.""" | ||
if images.order_of_images is None: | ||
return | ||
if not len(images.order_of_images) == len(images.images): | ||
return InspectorMessage( | ||
message=f"Length of order_of_images ({len(images.order_of_images)}) does not match the number of " | ||
f"images ({len(images.images)})." | ||
) | ||
|
||
|
||
@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=IndexSeries) | ||
def check_index_series_points_to_image(index_series: IndexSeries): | ||
if index_series.indexed_timeseries is not None: | ||
return InspectorMessage( | ||
message="Pointing an IndexSeries to a TimeSeries will be deprecated. Please point to an Images " | ||
"container instead." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.