Poirazi-Lab / mouse2afc

GNU General Public License v3.0
1 stars 4 forks source link

Reflect inputs/outputs on PyBpod emulator GUI #6

Closed HenryJFlynn closed 5 months ago

HenryJFlynn commented 1 year ago

Background:

In the MATLAB protocol, if a mouse pokes in/out or a light or valve is triggered, that change is reflected in the Bpod console. That does not happen with the equivalent emulator GUI in PyBpod. The PyBpod emulator can cause changes to the hardware (if the user pokes with the emulator, the software interprets it as if the mouse poked) but changes on the hardware cannot cause a change in the emuator

Bpod console: image

Pybpod emulator: image

Goal:

Make the changes which happen on the experimental hardware also happen in the PyBpod GUI emulator, similar to the MATLAB feature

stumpychloe commented 5 months ago

When editing in "emulator_gui.py" specifically the definition "__button_on_click_evt" it causes the error "socket.error: [Errno 48] Address already in use". The issue with this error is that GUI cant detect what if different in the code that caused this so its difficult to fix.

stumpychloe commented 5 months ago

When the device is pluged into the computer it out puts this error when trying to load the board.

image

stumpychloe commented 5 months ago

To fix the issue of "could not open port' I followed the first step of the installing and updating pybpod documentation by executing this line of code "sudo usermod -a -G dialout [your username]" then restarting the computer

After restarting and running the bpod this error occurred when trying to load the board.

image

ckarageorgkaneen commented 5 months ago

When editing in "emulator_gui.py" specifically the definition "__button_on_click_evt" it causes the error "socket.error: [Errno 48] Address already in use". The issue with this error is that GUI cant detect what if different in the code that caused this so its difficult to fix.

Fixed by https://github.com/ckarageorgkaneen/pybpod-api/pull/5 :smiley:

ckarageorgkaneen commented 5 months ago

To fix the issue of "could not open port' I followed the first step of the installing and updating pybpod documentation by executing this line of code "sudo usermod -a -G dialout [your username]" then restarting the computer

After restarting and running the bpod this error occurred when trying to load the board.

image

Hmmm that's weird.

stumpychloe commented 5 months ago

pybpod protocol works when the device is plugged into its left port which resolves the issue of failed connectivity. While running the protocol You can input the pokes but you are unable to see what the correct choice is. This is because the GUI is not displaying which LED is clicked. I now want to make the GUI display the LED output and the valve output.

ckarageorgkaneen commented 5 months ago

pybpod protocol works when the device is plugged into its left port which resolves the issue of failed connectivity. While running the protocol You can input the pokes but you are unable to see what the correct choice is. This is because the GUI is not displaying which LED is clicked. I now want to make the GUI display the LED output and the valve output.

Makes sense. Now just gotta figure out how to make the device code communicate the data to the GUI emulator server like the emulator code does.

stumpychloe commented 5 months ago

After some digging I found where the data for the outputs is coming from by having a print statement that prints the channel name and value.

ex: ['stdout', '2024-04-25 11:43:32.706292', '', '', 'Output value: 3.0 Output name: PWM2', '']

I now plan to make the GUI to split this data and have it click the button the coordinates with the data like how its done in emulator mode.

stumpychloe commented 5 months ago

After going through the emulator mode client-server GUI code with @ckarageorgkaneen, these are the next steps:

stumpychloe commented 5 months ago

Issue closed by https://github.com/ckarageorgkaneen/pybpod-api/pull/6 and https://github.com/ckarageorgkaneen/pybpod-gui-plugin-emulator/pull/1