Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[easy] utility function to test equality of two sets of tick markers. #1691

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions starfish/core/morphology/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import List, Mapping, MutableMapping, Optional, Tuple, Union

import numpy as np

from starfish.core.types import ArrayLike, Axes, Coordinates, Number


Expand Down Expand Up @@ -58,3 +60,19 @@ def _normalize_physical_ticks(
Coordinates(coord): coord_data
for coord, coord_data in physical_ticks.items()
}


def _ticks_equal(
left: Mapping,
right: Mapping,
) -> bool:
"""Given two sets of tick marks, return True if the two contain the same keys, and contain the
same data for each key. This works for both pixel ticks and physical ticks.
"""
if left.keys() != right.keys():
return False
for key in left.keys():
if not np.all(left[key] == right[key]):
return False

return True