-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/vandeplaslab/koyo
- Loading branch information
Showing
7 changed files
with
95 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ dependencies = [ | |
"tabulate", | ||
"matplotlib", | ||
"psutil", | ||
"click-groups" | ||
"click-groups", | ||
] | ||
|
||
# extras | ||
|
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Affine transformation functions.""" | ||
|
||
from __future__ import annotations | ||
|
||
import numpy as np | ||
|
||
|
||
def transform_xy_coordinates( | ||
xy: np.ndarray, *, yx_affine: np.ndarray | None = None, xy_affine: np.ndarray | None = None | ||
) -> np.ndarray: | ||
"""Transform xy coordinates using either yx or xy affine matrix.""" | ||
if xy_affine is None and yx_affine is None: | ||
raise ValueError("Either xy_affine or yx_affine should be provided.") | ||
if xy_affine is not None and yx_affine is not None: | ||
raise ValueError("Only one of xy_affine or yx_affine should be provided.") | ||
xy = np.hstack([xy, np.ones((xy.shape[0], 1))]) | ||
if yx_affine is not None: | ||
xy = np.dot(xy, yx_affine.T) | ||
if xy_affine is not None: | ||
xy = np.dot(xy, xy_affine) | ||
xy = xy[:, :2] | ||
return xy |
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