Skip to main content

About

- 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-05
- Creation Date: 2023-10-17
- License: BSD-3-Clause
- URL: https://github.com/janelia-pypi/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

from mouse_joystick_interface import MouseJoystickInterface
dev = MouseJoystickInterface() # Might automatically find devices if available
# if devices not found automatically, specify ports directly
dev = MouseJoystickInterface(use_ports=['/dev/ttyACM0','/dev/ttyACM0']) # Linux specific ports
dev = MouseJoystickInterface(use_ports=['/dev/tty.usbmodem262471','/dev/tty.usbmodem262472']) # Mac OS X specific ports
dev = MouseJoystickInterface(use_ports=['COM3','COM4']) # Windows specific ports
# 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.start_assay(set_path='~/set_example.csv')

# optional mouse_joystick_controller methods
dev.mouse_joystick_controller.set_properties_to_defaults(['ALL'])
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()

Command Line

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-pypi/python_setup

GNU/Linux

  1. 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:

    99-platformio-udev.rules

  2. Download rules into the correct directory

    curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
    
  3. Restart udev management tool

    sudo service udev restart
    
  4. Ubuntu/Debian users may need to add own “username” to the “dialout” group

    sudo usermod -a -G dialout $USER
    sudo usermod -a -G plugdev $USER
    
  5. After 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.

  1. pip

    python3 -m venv ~/venvs/mouse_joystick_interface
    source ~/venvs/mouse_joystick_interface/bin/activate
    pip install mouse_joystick_interface
    
  2. guix

    Setup guix-janelia channel:

    https://github.com/guix-janelia/guix-janelia

    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.

  1. pip

    python3 -m venv C:\venvs\mouse_joystick_interface
    C:\venvs\mouse_joystick_interface\Scripts\activate
    pip install mouse_joystick_interface
    

Development

Clone Repository

git clone git@github.com:janelia-pypi/mouse_joystick_interface_python.git
cd mouse_joystick_interface_python

Guix

Install Guix

Install Guix

Edit metadata.org

make -f .metadata/Makefile metadata-edits

Tangle metadata.org

make -f .metadata/Makefile metadata

Develop Python package

make -f .metadata/Makefile guix-dev-container
exit

Test Python package using ipython shell

make -f .metadata/Makefile guix-dev-container-ipython
import mouse_joystick_interface
exit

Test Python package installation

make -f .metadata/Makefile guix-container
exit

Upload Python package to pypi

make -f .metadata/Makefile upload

Test direct device interaction using serial terminal

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

make -f .metadata/Makefile docker-dev-container
exit

Test Python package using ipython shell

make -f .metadata/Makefile docker-dev-container-ipython
import mouse_joystick_interface
exit

Test Python package installation

make -f .metadata/Makefile docker-container
exit

Metadata

Release files for mouse-joystick-interface 5.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mouse-joystick-interface 5.0.1
File Size Uploaded Provenance
mouse_joystick_interface-5.0.1.tar.gz 10.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mouse-joystick-interface 5.0.1
File Interpreter ABI Platform
mouse_joystick_interface-5.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / mouse_joystick_interface-5.0.1.tar.gz

Download URL mouse_joystick_interface-5.0.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b75fb8e0a544b893c05566fbdfd637c3b4140e5839bfa4f550e3d67d587c0955
BLAKE2b-256 checksum
How to use checksums
fa4c2d99d3baecf234dc43577a4536cc82146b66c6a56fbee2d8be22e6ea3c7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.9.6 requests/2.28.1 setuptools/67.6.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.7

Release files / mouse_joystick_interface-5.0.1-py3-none-any.whl

Download URL mouse_joystick_interface-5.0.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9369fc88667fbd5b008733304a72d4986ae73bb4614e8898a7d20caa9db49ccb
BLAKE2b-256 checksum
How to use checksums
4d1abd9d7cef500fddb54197fcb15697c735beb71a67e9b4611557d18077162b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.9.6 requests/2.28.1 setuptools/67.6.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.7

Security for mouse-joystick-interface 5.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page