mouse_joystick_interface_python
Python interface to the Dudman lab Mouse Joystick Rig.
https://github.com/janelia-python/mouse_joystick_interface_python
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.3%) to scientific vocabulary
Repository
Python interface to the Dudman lab Mouse Joystick Rig.
Basic Info
Statistics
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
About
markdown
- Python Package Name: mouse_joystick_interface
- Description: Python interface to the Dudman lab Mouse Joystick Rig.
- Version: 5.0.1
- Python Version: 3.10
- Release Date: 2023-12-07
- Creation Date: 2023-10-17
- License: BSD-3-Clause
- URL: https://github.com/janelia-python/mouse_joystick_interface_python
- Author: Peter Polidoro
- Email: peter@polidoro.io
- Copyright: 2023 Howard Hughes Medical Institute
- References:
- https://github.com/janelia-kicad/mouse_joystick_controller
- Dependencies:
- modular_client
- flatten_json
Example Usage
Python
Operation Systems
All
```python from mousejoystickinterface import MouseJoystickInterface dev = MouseJoystickInterface() # Automatically find device if available
abort_assay prematurely stops a running assay and leaves the rig ready to start a new assay
dev.abort_assay()
start_assay is the main method that starts the assay, collects assay data, and saves data files
dev.startassay(setpath='~/set_example.csv') ```
Linux Specific
```python from mousejoystickinterface import MouseJoystickInterface dev = MouseJoystickInterface(use_ports=['/dev/ttyACM0']) # Linux specific port
abort_assay prematurely stops a running assay and leaves the rig ready to start a new assay
dev.abort_assay()
start_assay is the main method that starts the assay, collects assay data, and saves data files
dev.startassay(setpath='~/set_example.csv') ```
Windows Specific
```python from mousejoystickinterface import MouseJoystickInterface dev = MouseJoystickInterface(use_ports=['COM3']) # Windows specific port
abort_assay prematurely stops a running assay and leaves the rig ready to start a new assay
dev.abort_assay()
start_assay is the main method that starts the assay, collects assay data, and saves data files
dev.startassay(setpath='~/set_example.csv') ```
MacOS Specific
```python from mousejoystickinterface import MouseJoystickInterface dev = MouseJoystickInterface(use_ports=['/dev/tty.usbmodem262471']) # Mac OS X specific port
abort_assay prematurely stops a running assay and leaves the rig ready to start a new assay
dev.abort_assay()
start_assay is the main method that starts the assay, collects assay data, and saves data files
dev.startassay(setpath='~/set_example.csv') ```
Optional methods
python
dev.mouse_joystick_controller.get_property_values(['ALL'])
dev.mouse_joystick_controller.repeat_aborted_trial('setValue',False)
dev.mouse_joystick_controller.get_assay_status()
dev.mouse_joystick_controller.move_joystick_to_base_position()
dev.mouse_joystick_controller.move_joystick_to_reach_position()
duration = 10
count = 1
dev.mouse_joystick_controller.activate_lickport(duration,count)
dev.mouse_joystick_controller.get_trial_timing_data()
dev.mouse_joystick_controller.abort_trial()
Before First Use
python
dev.mouse_joystick_controller.set_properties_to_defaults(['ALL'])
Example Set CSV Input File
| repeat_trial_count | pull_torque | lickport_reward_duration | zero_torque_reward_delay | reach_position.0 | reach_position.1 | |-------------------- |------------ |-------------------------- |--------------------------- |----------------- |----------------- | | 2 | 50 | 100 | 0 | 20 | 200 | | 3 | 75 | 120 | 0 | 30 | 300 | | 2 | 0 | 100 | 3 | 5 | 200 |
Example Trials CSV Ouput File
| finished_trial_count | successful_trial_count | trial_aborted | assay_aborted | pull_threshold | set_in_assay | repeat_set_count | block_in_set | block_count | trial_in_block | block.repeat_trial_count | block.pull_torque | block.lickport_reward_duration | block.zero_torque_reward_delay | block.reach_position.0 | block.reach_position.1 | trial_start | mouse_ready | joystick_ready | pull | push | timeout | trial_abort | |---------------------- |------------------------ |-------------- |-------------- |--------------- |-------------- |------------------ |-------------- |------------ |---------------- |-------------------------- |------------------ |-------------------------------- |--------------------------------- |----------------------- |----------------------- |------------ |------------ |--------------- |---- |---- |------- |------------ | | | | | | | | | | | | | | | | | | | | | | | | |
Installation
https://github.com/janelia-python/python_setup
GNU/Linux
Drivers
GNU/Linux computers usually have all of the necessary drivers already installed, but users need the appropriate permissions to open the device and communicate with it.
Udev is the GNU/Linux subsystem that detects when things are plugged into your computer.
Udev may be used to detect when a device is plugged into the computer and automatically give permission to open that device.
If you plug a sensor into your computer and attempt to open it and get an error such as: "FATAL: cannot open /dev/ttyACM0: Permission denied", then you need to install udev rules to give permission to open that device.
Udev rules may be downloaded as a file and placed in the appropriate directory using these instructions:
Download rules into the correct directory
sh curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rulesRestart udev management tool
sh sudo service udev restartUbuntu/Debian users may need to add own “username” to the “dialout” group
sh sudo usermod -a -G dialout $USER sudo usermod -a -G plugdev $USERAfter setting up rules and groups
You will need to log out and log back in again (or reboot) for the user group changes to take effect.
After this file is installed, physically unplug and reconnect your board.
Python Code
The Python code in this library may be installed in any number of ways, chose one.
pip
sh python3 -m venv ~/venvs/mouse_joystick_interface source ~/venvs/mouse_joystick_interface/bin/activate pip install mouse_joystick_interfaceguix
Setup guix-janelia channel:
https://github.com/guix-janelia/guix-janelia
sh guix install python-mouse-joystick-interface
Windows
Python Code
The Python code in this library may be installed in any number of ways, chose one.
pip
sh python3 -m venv C:\venvs\mouse_joystick_interface C:\venvs\mouse_joystick_interface\Scripts\activate pip install mouse_joystick_interface
Conda/Spyder
sh
conda update conda
conda create -n mouse_joystick_interface
conda activate mouse_joystick_interface
conda install pip
pip install mouse_joystick_interface
pip install spyder
Development
Clone Repository
sh
git clone git@github.com:janelia-python/mouse_joystick_interface_python.git
cd mouse_joystick_interface_python
Guix
Install Guix
Edit metadata.org
sh
make -f .metadata/Makefile metadata-edits
Tangle metadata.org
sh
make -f .metadata/Makefile metadata
Develop Python package
sh
make -f .metadata/Makefile guix-dev-container
exit
Test Python package using ipython shell
sh
make -f .metadata/Makefile guix-dev-container-ipython
import mouse_joystick_interface
exit
Test Python package installation
sh
make -f .metadata/Makefile guix-container
exit
Upload Python package to pypi
sh
make -f .metadata/Makefile upload
Test direct device interaction using serial terminal
```sh make -f .metadata/Makefile guix-dev-container-port-serial # PORT=/dev/ttyACM0
make -f .metadata/Makefile PORT=/dev/ttyACM1 guix-dev-container-port-serial
? # help [C-a][C-x] # to exit ```
Docker
Install Docker Engine
https://docs.docker.com/engine/
Develop Python package
sh
make -f .metadata/Makefile docker-dev-container
exit
Test Python package using ipython shell
sh
make -f .metadata/Makefile docker-dev-container-ipython
import mouse_joystick_interface
exit
Test Python package installation
sh
make -f .metadata/Makefile docker-container
exit
Owner
- Name: Janelia Python
- Login: janelia-python
- Kind: organization
- Repositories: 2
- Profile: https://github.com/janelia-python
Janelia Python Packages
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"license": "https://spdx.org/licenses/BSD-3-Clause",
"codeRepository": "https://github.com/janelia-python/mouse_joystick_interface_python",
"dateCreated": "2023-10-17",
"dateModified": "2023-12-05",
"name": "mouse_joystick_interface",
"version": "5.0.1",
"description": "Python interface to the Dudman lab Mouse Joystick Rig.",
"programmingLanguage": [
"Python 3"
],
"author": [
{
"@type": "Person",
"givenName": "Peter",
"familyName": "Polidoro",
"email": "peter@polidoro.io",
"affiliation": {
"@type": "Organization",
"name": "Howard Hughes Medical Institute"
}
}
]
}
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- peterpolidoro (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- mouse_joystick_interface-dev latest build
- flatten_json *
- modular_client *
- flatten-json ==0.1.14
- inflection ==0.5.1
- modular-client ==8.4.3
- pyserial ==3.5
- serial-interface ==2.3.1
- six ==1.16.0
- sre-yield ==1.2