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

Switch from list to Vector4 #347

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/ephys_link/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.0b2"
__version__ = "1.3.0"
28 changes: 14 additions & 14 deletions src/ephys_link/platforms/ump3_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ def _register_manipulator(self, manipulator_id: str) -> None:

self.manipulators[manipulator_id] = UMP3Manipulator(self.ump.get_device(int(manipulator_id)))

def _platform_space_to_unified_space(self, platform_position: list[float]) -> list[float]:
def _platform_space_to_unified_space(self, platform_position: Vector4) -> Vector4:
# unified <- platform
# +x <- +y
# +y <- -x
# +z <- -z
# +d <- +d/x

return [
platform_position[1],
self.dimensions[0] - platform_position[0],
self.dimensions[2] - platform_position[2],
platform_position[3],
]
return Vector4(
x=platform_position.y,
y=self.dimensions.x - platform_position.x,
z=self.dimensions.z - platform_position.z,
w=platform_position.w,
)

def _unified_space_to_platform_space(self, unified_position: list[float]) -> list[float]:
def _unified_space_to_platform_space(self, unified_position: Vector4) -> Vector4:
# platform <- unified
# +x <- -y
# +y <- +x
# +z <- -z
# +d/x <- +d

return [
self.dimensions[1] - unified_position[1],
unified_position[0],
self.dimensions[2] - unified_position[2],
unified_position[3],
]
return Vector4(
x=self.dimensions.y - unified_position.y,
y=unified_position.x,
z=self.dimensions.z - unified_position.z,
w=unified_position.w,
)