ephys-link 2.0.0b5__py3-none-any.whl → 2.0.0b9__py3-none-any.whl

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.
@@ -0,0 +1,86 @@
1
+ """Commonly used conversion functions."""
2
+
3
+ from vbl_aquarium.models.unity import Vector4
4
+
5
+
6
+ def scalar_mm_to_um(mm: float) -> float:
7
+ """Convert scalar values of millimeters to micrometers.
8
+
9
+ Args:
10
+ mm: Scalar value in millimeters.
11
+
12
+ Returns:
13
+ Scalar value in micrometers.
14
+ """
15
+ return mm * 1_000
16
+
17
+
18
+ def vector_mm_to_um(mm: Vector4) -> Vector4:
19
+ """Convert vector values of millimeters to micrometers.
20
+
21
+ Args:
22
+ mm: Vector in millimeters.
23
+
24
+ Returns:
25
+ Vector in micrometers.
26
+ """
27
+ return mm * 1_000
28
+
29
+
30
+ def um_to_mm(um: Vector4) -> Vector4:
31
+ """Convert micrometers to millimeters.
32
+
33
+ Args:
34
+ um: Length in micrometers.
35
+
36
+ Returns:
37
+ Length in millimeters.
38
+ """
39
+ return um / 1_000
40
+
41
+
42
+ def vector4_to_array(vector4: Vector4) -> list[float]:
43
+ """Convert a [Vector4][vbl_aquarium.models.unity.Vector4] to a list of floats.
44
+
45
+ Args:
46
+ vector4: [Vector4][vbl_aquarium.models.unity.Vector4] to convert.
47
+
48
+ Returns:
49
+ List of floats.
50
+ """
51
+ return [vector4.x, vector4.y, vector4.z, vector4.w]
52
+
53
+
54
+ def list_to_vector4(float_list: list[float | int]) -> Vector4:
55
+ """Convert a list of floats to a [Vector4][vbl_aquarium.models.unity.Vector4].
56
+
57
+ Args:
58
+ float_list: List of floats.
59
+
60
+ Returns:
61
+ First four elements of the list as a Vector4 padded with zeros if necessary.
62
+ """
63
+
64
+ def get_element(this_array: list[float | int], index: int) -> float:
65
+ """Safely get an element from an array.
66
+
67
+ Return 0 if the index is out of bounds.
68
+
69
+ Args:
70
+ this_array: Array to get the element from.
71
+ index: Index to get.
72
+
73
+ Returns:
74
+ Element at the index or 0 if the index is out of bounds.
75
+ """
76
+ try:
77
+ return this_array[index]
78
+ except IndexError:
79
+ return 0.0
80
+
81
+ return Vector4(
82
+ x=get_element(float_list, 0),
83
+ y=get_element(float_list, 1),
84
+ z=get_element(float_list, 2),
85
+ w=get_element(float_list, 3),
86
+ )
@@ -0,0 +1,65 @@
1
+ """Program startup helper functions."""
2
+
3
+ from importlib import import_module
4
+ from inspect import getmembers, isclass
5
+ from pkgutil import iter_modules
6
+
7
+ from packaging.version import parse
8
+ from requests import ConnectionError, ConnectTimeout, get
9
+
10
+ from ephys_link.__about__ import __version__
11
+ from ephys_link.utils.base_binding import BaseBinding
12
+ from ephys_link.utils.console import Console
13
+ from ephys_link.utils.constants import ASCII, BINDINGS_DIRECTORY
14
+
15
+
16
+ def preamble() -> None:
17
+ """Print the server startup preamble."""
18
+ print(ASCII) # noqa: T201
19
+ print(__version__) # noqa: T201
20
+ print() # noqa: T201
21
+ print("This is the Ephys Link server window.") # noqa: T201
22
+ print("You may safely leave it running in the background.") # noqa: T201
23
+ print("To stop it, close this window or press CTRL + Pause/Break.") # noqa: T201
24
+ print() # noqa: T201
25
+
26
+
27
+ def check_for_updates(console: Console) -> None:
28
+ """Check for updates to the Ephys Link.
29
+
30
+ Args:
31
+ console: Console instance for printing messages.
32
+ """
33
+ try:
34
+ response = get("https://api.github.com/repos/VirtualBrainLab/ephys-link/tags", timeout=10)
35
+ latest_version = str(response.json()[0]["name"]) # pyright: ignore [reportAny]
36
+ if parse(latest_version) > parse(__version__):
37
+ console.critical_print(f"Update available: {latest_version} (current: {__version__})")
38
+ console.critical_print("Download at: https://github.com/VirtualBrainLab/ephys-link/releases/latest")
39
+ except (ConnectionError, ConnectTimeout):
40
+ console.error_print(
41
+ "UPDATE", "Unable to check for updates. Ignore updates or use the the -i flag to disable checks.\n"
42
+ )
43
+
44
+
45
+ def get_bindings() -> list[type[BaseBinding]]:
46
+ """Get all binding classes from the bindings directory.
47
+
48
+ Returns:
49
+ List of binding classes.
50
+ """
51
+ return [
52
+ binding_type
53
+ for module in iter_modules([BINDINGS_DIRECTORY])
54
+ for _, binding_type in getmembers(import_module(f"ephys_link.bindings.{module.name}"), isclass)
55
+ if issubclass(binding_type, BaseBinding) and binding_type != BaseBinding
56
+ ]
57
+
58
+
59
+ def get_binding_display_to_cli_name() -> dict[str, str]:
60
+ """Get mapping of display to CLI option names of the available platform bindings.
61
+
62
+ Returns:
63
+ Dictionary of platform binding display name to CLI option name.
64
+ """
65
+ return {binding_type.get_display_name(): binding_type.get_cli_name() for binding_type in get_bindings()}
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: ephys-link
3
+ Version: 2.0.0b9
4
+ Summary: A Python Socket.IO server that allows any Socket.IO-compliant application to communicate with manipulators used in electrophysiology experiments.
5
+ Project-URL: Documentation, https://virtualbrainlab.org/ephys_link/installation_and_use.html
6
+ Project-URL: Issues, https://github.com/VirtualBrainLab/ephys-link/issues
7
+ Project-URL: Source, https://github.com/VirtualBrainLab/ephys-link
8
+ Author-email: Kenneth Yang <kjy5@uw.edu>
9
+ Maintainer-email: Kenneth Yang <kjy5@uw.edu>
10
+ License-Expression: GPL-3.0-only
11
+ License-File: LICENSE
12
+ Keywords: electrophysiology,ephys,manipulator,neuroscience,neurotech,new-scale,sensapex,socket-io,virtualbrainlab
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Intended Audience :: Healthcare Industry
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
26
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
27
+ Requires-Python: <3.14,>=3.10
28
+ Requires-Dist: aiohttp==3.11.11
29
+ Requires-Dist: colorama==0.4.6
30
+ Requires-Dist: keyboard==0.13.5
31
+ Requires-Dist: packaging==24.2
32
+ Requires-Dist: platformdirs==4.3.6
33
+ Requires-Dist: pyserial==3.5
34
+ Requires-Dist: python-socketio[asyncio-client]==5.12.1
35
+ Requires-Dist: requests==2.32.3
36
+ Requires-Dist: rich==13.9.4
37
+ Requires-Dist: sensapex==1.400.3
38
+ Requires-Dist: vbl-aquarium==1.0.0b3
39
+ Description-Content-Type: text/markdown
40
+
41
+ # Electrophysiology Manipulator Link
42
+
43
+ [![PyPI version](https://badge.fury.io/py/ephys-link.svg)](https://badge.fury.io/py/ephys-link)
44
+ [![Deploy Documentation](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/deploy-docs.yml)
45
+ [![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
46
+ [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
47
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
48
+ [![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
49
+
50
+ <!-- [![Build](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/build.yml/badge.svg)](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/build.yml) -->
51
+
52
+ The [Electrophysiology Manipulator Link](https://github.com/VirtualBrainLab/ephys-link)
53
+ (or Ephys Link for short) is a Python [Socket.IO](https://socket.io/docs/v4/#what-socketio-is) server that allows any
54
+ Socket.IO-compliant application (such
55
+ as [Pinpoint][Pinpoint])
56
+ to communicate with manipulators used in electrophysiology experiments.
57
+
58
+ <img width="100%" src="https://github.com/VirtualBrainLab/ephys-link/assets/82800265/0c7c60b1-0926-4697-a461-221554f82de1" alt="Manipulator and probe in pinpoint moving in sync">
59
+
60
+ # Installation
61
+
62
+ ## Launch from Pinpoint (Recommended)
63
+
64
+ Pinpoint comes bundled with the correct version of Ephys Link. If you are using Pinpoint on the same computer your
65
+ manipulators are connected to, you can launch the server from within Pinpoint. Follow the instructions in
66
+ the [Pinpoint documentation](https://virtualbrainlab.org/pinpoint/tutorials/tutorial_ephys_link.html#configure-and-launch-ephys-link).
67
+
68
+ ## Install as Standalone Executable
69
+
70
+ 1. Download the latest standalone executable or zip from
71
+ the [releases page](https://github.com/VirtualBrainLab/ephys-link/releases/latest).
72
+ 2. Double-click the executable file to start.
73
+
74
+ # Documentation and More Information
75
+
76
+ Complete documentation including API usage and development installation can be
77
+ found on the [Virtual Brain Lab Documentation page][docs] for Ephys Link.
78
+
79
+ # Citing
80
+
81
+ If this project is used as part of a research project you should cite
82
+ the [Pinpoint repository](https://github.com/VirtualBrainLab/Pinpoint). Please email
83
+ Dan ([dbirman@uw.edu](mailto:dbirman@uw.edu)) if you have questions.
84
+
85
+ Please reach out to Kenneth ([kjy5@uw.edu](mailto:kjy5@uw.edu)) for questions
86
+ about the Electrophysiology Manipulator Link server. Bugs may be reported
87
+ through the issues tab.
88
+
89
+ [Pinpoint]: https://github.com/VirtualBrainLab/Pinpoint
90
+
91
+ [docs]: https://virtualbrainlab.github.io/ephys-link/
@@ -0,0 +1,25 @@
1
+ ephys_link/__about__.py,sha256=fcPPQ4XJ4PzvYjX6RTK2dC_L1a9gTZZrtLk8mryO2C0,24
2
+ ephys_link/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ ephys_link/__main__.py,sha256=sbFdC6KJjTfXDgRraU_fmGRPcF4I1Ur9PRDiD86dkRI,1449
4
+ ephys_link/back_end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ ephys_link/back_end/platform_handler.py,sha256=PSlBa2_jM073uaF3MvCd-_a7XXEeTfn5KXJ7aPEwMVk,12149
6
+ ephys_link/back_end/server.py,sha256=mb3K3pXSO-gHaSj1CGJ0v3CSOW5YCi-p0EOKoySRzKQ,10322
7
+ ephys_link/bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ ephys_link/bindings/fake_binding.py,sha256=VCmKZha113kiHSmOZzKLfbaa8iXobefJFQPI3eCzuZE,2343
9
+ ephys_link/bindings/mpm_binding.py,sha256=UdrWXiz16zJ7PSQBnYNtpTXs_1chbE_v1tvzeP7PrPk,10681
10
+ ephys_link/bindings/ump_4_binding.py,sha256=_ZEMT6B4aEqJHdwSElnkOnaXxG7wwKeUgsHZ5T6ekgg,5345
11
+ ephys_link/front_end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ ephys_link/front_end/cli.py,sha256=isIJs_sZbz7VbNvLgi-HyDlE-TyKD12auDhMTxAkWQU,3099
13
+ ephys_link/front_end/gui.py,sha256=MDcrTS_Xz9bopAgamh4HknqRC10W8E6eOS3Kss_2ZKQ,6864
14
+ ephys_link/resources/libum.dll,sha256=YaD4dwiSNohx-XxHjx2eQWPOBEVvUIXARvx37e_yqNw,316316
15
+ ephys_link/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ ephys_link/utils/base_binding.py,sha256=9ScaIXLwhAgHP4jLIG5LUf1AYjF_Jmf0nRH606_mXEQ,5399
17
+ ephys_link/utils/console.py,sha256=52SYvXv_7Fx8QDL3RMFQoggQ1n5W93Yu5aU7uuJQgfg,3904
18
+ ephys_link/utils/constants.py,sha256=1aML7zBNTM5onVSf6NDrYIR33VJy-dIHd1lFORVBGbM,725
19
+ ephys_link/utils/converters.py,sha256=ZdVmIX-LHCwM__F0SpjN_mfNGGetr1U97xvHd0hf8T0,2038
20
+ ephys_link/utils/startup.py,sha256=jZVed78tuWjUuZqWVgii_zumDr87T-ikEtOFa6KTE_E,2500
21
+ ephys_link-2.0.0b9.dist-info/METADATA,sha256=IGGp1Wq6pI7YrTJKx71biBGNTrSaf8Vsk1Lg6p_647Y,4868
22
+ ephys_link-2.0.0b9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ ephys_link-2.0.0b9.dist-info/entry_points.txt,sha256=o8wV3AdnJ9o47vg9ymKxPNVq9pMdPq8UZHE_iyAJx-k,124
24
+ ephys_link-2.0.0b9.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
25
+ ephys_link-2.0.0b9.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.25.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any