From 6c76e1f5cf4b564c78097a81447cf7eac7595ef8 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 12 Mar 2025 23:04:51 -0700 Subject: [PATCH] Add R90 and R180 constants for rotation shorthand --- masque/__init__.py | 2 ++ masque/utils/__init__.py | 2 ++ masque/utils/transform.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/masque/__init__.py b/masque/__init__.py index 93eabdc..dbd0670 100644 --- a/masque/__init__.py +++ b/masque/__init__.py @@ -83,6 +83,8 @@ from .builder import ( from .utils import ( ports2data as ports2data, oneshot as oneshot, + R90 as R90, + R180 as R180, ) diff --git a/masque/utils/__init__.py b/masque/utils/__init__.py index 11391a5..f33142f 100644 --- a/masque/utils/__init__.py +++ b/masque/utils/__init__.py @@ -25,6 +25,8 @@ from .transform import ( normalize_mirror as normalize_mirror, rotate_offsets_around as rotate_offsets_around, apply_transforms as apply_transforms, + R90 as R90, + R180 as R180, ) from .comparisons import ( annotation2key as annotation2key, diff --git a/masque/utils/transform.py b/masque/utils/transform.py index e2ea9aa..dfb6492 100644 --- a/masque/utils/transform.py +++ b/masque/utils/transform.py @@ -9,6 +9,11 @@ from numpy.typing import NDArray, ArrayLike from numpy import pi +# Constants for shorthand rotations +R90 = pi / 2 +R180 = pi + + @lru_cache def rotation_matrix_2d(theta: float) -> NDArray[numpy.float64]: """