ephys-link 2.0.1__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {ephys_link-2.0.1 → ephys_link-2.0.2}/PKG-INFO +1 -1
  2. ephys_link-2.0.2/src/ephys_link/__about__.py +1 -0
  3. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/bindings/fake_binding.py +2 -1
  4. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/bindings/mpm_binding.py +15 -9
  5. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/bindings/ump_4_binding.py +2 -1
  6. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/base_binding.py +2 -1
  7. ephys_link-2.0.1/src/ephys_link/__about__.py +0 -1
  8. {ephys_link-2.0.1 → ephys_link-2.0.2}/.gitignore +0 -0
  9. {ephys_link-2.0.1 → ephys_link-2.0.2}/LICENSE +0 -0
  10. {ephys_link-2.0.1 → ephys_link-2.0.2}/README.md +0 -0
  11. {ephys_link-2.0.1 → ephys_link-2.0.2}/ephys_link.spec +0 -0
  12. {ephys_link-2.0.1 → ephys_link-2.0.2}/mkdocs.yml +0 -0
  13. {ephys_link-2.0.1 → ephys_link-2.0.2}/pyproject.toml +0 -0
  14. {ephys_link-2.0.1 → ephys_link-2.0.2}/scripts/__init__.py +0 -0
  15. {ephys_link-2.0.1 → ephys_link-2.0.2}/scripts/gen_ref_pages.py +0 -0
  16. {ephys_link-2.0.1 → ephys_link-2.0.2}/scripts/logger_test.py +0 -0
  17. {ephys_link-2.0.1 → ephys_link-2.0.2}/scripts/move_tester.py +0 -0
  18. {ephys_link-2.0.1 → ephys_link-2.0.2}/scripts/server_tester.py +0 -0
  19. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/__init__.py +0 -0
  20. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/__main__.py +0 -0
  21. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/back_end/__init__.py +0 -0
  22. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/back_end/platform_handler.py +0 -0
  23. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/back_end/server.py +0 -0
  24. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/bindings/__init__.py +0 -0
  25. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/front_end/__init__.py +0 -0
  26. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/front_end/cli.py +0 -0
  27. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/front_end/gui.py +0 -0
  28. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/resources/libum.dll +0 -0
  29. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/__init__.py +0 -0
  30. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/console.py +0 -0
  31. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/constants.py +0 -0
  32. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/converters.py +0 -0
  33. {ephys_link-2.0.1 → ephys_link-2.0.2}/src/ephys_link/utils/startup.py +0 -0
  34. {ephys_link-2.0.1 → ephys_link-2.0.2}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ephys-link
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: A Python Socket.IO server that allows any Socket.IO-compliant application to communicate with manipulators used in electrophysiology experiments.
5
5
  Project-URL: Documentation, https://virtualbrainlab.org/ephys_link/installation_and_use.html
6
6
  Project-URL: Issues, https://github.com/VirtualBrainLab/ephys-link/issues
@@ -0,0 +1 @@
1
+ __version__ = "2.0.2"
@@ -57,8 +57,9 @@ class FakeBinding(BaseBinding):
57
57
  async def get_shank_count(self, manipulator_id: str) -> int:
58
58
  return 1
59
59
 
60
+ @staticmethod
60
61
  @override
61
- def get_movement_tolerance(self) -> float:
62
+ def get_movement_tolerance() -> float:
62
63
  return 0.001
63
64
 
64
65
  @override
@@ -62,12 +62,11 @@ class MPMBinding(BaseBinding):
62
62
  "AN",
63
63
  )
64
64
 
65
- # Server cache lifetime (60 FPS).
66
- CACHE_LIFETIME = 1 / 60
65
+ # Server data update rate (30 FPS).
66
+ SERVER_DATA_UPDATE_RATE = 1 / 30
67
67
 
68
68
  # Movement polling preferences.
69
69
  UNCHANGED_COUNTER_LIMIT = 10
70
- POLL_INTERVAL = 0.1
71
70
 
72
71
  # Speed preferences (mm/s to use coarse mode).
73
72
  COARSE_SPEED_THRESHOLD = 0.1
@@ -113,7 +112,8 @@ class MPMBinding(BaseBinding):
113
112
  manipulator_data: dict[str, float] = await self._manipulator_data(manipulator_id)
114
113
  stage_z: float = manipulator_data["Stage_Z"]
115
114
 
116
- await sleep(self.POLL_INTERVAL) # Wait for the stage to stabilize.
115
+ # Wait for the stage to stabilize.
116
+ await sleep(self.SERVER_DATA_UPDATE_RATE)
117
117
 
118
118
  return Vector4(
119
119
  x=manipulator_data["Stage_X"],
@@ -139,8 +139,9 @@ class MPMBinding(BaseBinding):
139
139
  async def get_shank_count(self, manipulator_id: str) -> int:
140
140
  return int((await self._manipulator_data(manipulator_id))["ShankCount"]) # pyright: ignore [reportAny]
141
141
 
142
+ @staticmethod
142
143
  @override
143
- def get_movement_tolerance(self) -> float:
144
+ def get_movement_tolerance() -> float:
144
145
  return 0.01
145
146
 
146
147
  @override
@@ -180,7 +181,7 @@ class MPMBinding(BaseBinding):
180
181
  and unchanged_counter < self.UNCHANGED_COUNTER_LIMIT
181
182
  ):
182
183
  # Wait for a short time before checking again.
183
- await sleep(self.POLL_INTERVAL)
184
+ await sleep(self.SERVER_DATA_UPDATE_RATE)
184
185
 
185
186
  # Update current position.
186
187
  current_position = await self.get_position(manipulator_id)
@@ -219,9 +220,13 @@ class MPMBinding(BaseBinding):
219
220
  )
220
221
 
221
222
  # Wait for the manipulator to reach the target depth or be stopped or get stuck.
222
- while not self._movement_stopped and not abs(current_depth - depth) <= self.get_movement_tolerance():
223
+ while (
224
+ not self._movement_stopped
225
+ and not abs(current_depth - depth) <= self.get_movement_tolerance()
226
+ and unchanged_counter < self.UNCHANGED_COUNTER_LIMIT
227
+ ):
223
228
  # Wait for a short time before checking again.
224
- await sleep(self.POLL_INTERVAL)
229
+ await sleep(self.SERVER_DATA_UPDATE_RATE)
225
230
 
226
231
  # Get the current depth.
227
232
  current_depth = (await self.get_position(manipulator_id)).w
@@ -281,10 +286,11 @@ class MPMBinding(BaseBinding):
281
286
  )
282
287
 
283
288
  # Helper functions.
289
+
284
290
  async def _query_data(self) -> dict[str, Any]: # pyright: ignore [reportExplicitAny]
285
291
  try:
286
292
  # Update cache if it's expired.
287
- if get_running_loop().time() - self.cache_time > self.CACHE_LIFETIME:
293
+ if get_running_loop().time() - self.cache_time > self.SERVER_DATA_UPDATE_RATE:
288
294
  # noinspection PyTypeChecker
289
295
  self.cache = (await get_running_loop().run_in_executor(None, get, self._url)).json()
290
296
  self.cache_time = get_running_loop().time()
@@ -77,8 +77,9 @@ class Ump4Binding(BaseBinding):
77
77
  error_message = "UMP-4 does not support getting shank count"
78
78
  raise AttributeError(error_message)
79
79
 
80
+ @staticmethod
80
81
  @override
81
- def get_movement_tolerance(self) -> float:
82
+ def get_movement_tolerance() -> float:
82
83
  return 0.001
83
84
 
84
85
  @override
@@ -99,8 +99,9 @@ class BaseBinding(ABC):
99
99
  Number of shanks on the manipulator.
100
100
  """
101
101
 
102
+ @staticmethod
102
103
  @abstractmethod
103
- def get_movement_tolerance(self) -> float:
104
+ def get_movement_tolerance() -> float:
104
105
  """Get the tolerance for how close the final position must be to the target position in a movement (mm).
105
106
 
106
107
  Returns:
@@ -1 +0,0 @@
1
- __version__ = "2.0.1"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes