HenryJFlynn / mouse2afc

The Mouse2AFC experimental neuroscience protocol.
GNU General Public License v3.0
0 stars 0 forks source link

Facilitate pybpod GUI for running protocol #7

Closed ckarageorgkaneen closed 1 year ago

ckarageorgkaneen commented 1 year ago

TODO:

HenryJFlynn commented 1 year ago

Trying to clone repo and sub modules doesn't work

henry@henry-Vostro-270:~/Documents$ git clone --recursive https://github.com/ckarageorgkaneen/pybpod.git  chris-pybpod
Cloning into 'chris-pybpod'...
remote: Enumerating objects: 1273, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 1273 (delta 5), reused 7 (delta 2), pack-reused 1261
Receiving objects: 100% (1273/1273), 8.85 MiB | 834.00 KiB/s, done.
Resolving deltas: 100% (733/733), done.
Submodule 'base - pybpod-api' (ssh://git@github.com/ckarageorgkaneen/pybpod-api.git) registered for path 'base/pybpod-api'
Submodule 'base - pybpod-gui-api' (https://github.com/pybpod/pybpod-gui-api.git) registered for path 'base/pybpod-gui-api'
Submodule 'base - pybpod-gui-plugin' (ssh://git@github.com/ckarageorgkaneen/pybpod-gui-plugin.git) registered for path 'base/pybpod-gui-plugin'
Submodule 'libs - logging-bootstrap' (https://bitbucket.org/fchampalimaud/logging-bootstrap.git) registered for path 'libraries/logging-bootstrap'
Submodule 'libs - pyforms-generic-editor' (https://bitbucket.org/fchampalimaud/pyforms-generic-editor.git) registered for path 'libraries/pyforms-generic-editor'
Submodule 'libs - pyforms-gui' (https://github.com/UmSenhorQualquer/pyforms-gui.git) registered for path 'libraries/pyforms-gui'
Submodule 'libs - safe-collaborative-architecture' (https://bitbucket.org/fchampalimaud/safe-collaborative-architecture.git) registered for path 'libraries/safe-collaborative-architecture'
Submodule 'plugins - pge-terminal' (https://bitbucket.org/fchampalimaud/pge-plugin-terminal.git) registered for path 'plugins/pge-plugin-terminal'
Submodule 'plugins - pybpod-gui-plugin-alyx' (https://github.com/pybpod/pybpod-gui-plugin-alyx) registered for path 'plugins/pybpod-gui-plugin-alyx'
Submodule 'plugins - pybpod-gui-plugin-emulator' (ssh://git@github.com/ckarageorgkaneen/pybpod-gui-plugin-emulator.git) registered for path 'plugins/pybpod-gui-plugin-emulator'
Submodule 'plugins - pybpod-gui-plugin-rotaryencoder' (https://github.com/pybpod/pybpod-gui-plugin-rotaryencoder.git) registered for path 'plugins/pybpod-gui-plugin-rotaryencoder'
Submodule 'plugins - pybpod-gui-plugin-session-history' (https://github.com/pybpod/pybpod-gui-plugin-session-history.git) registered for path 'plugins/pybpod-gui-plugin-session-history'
Submodule 'plugins - pybpod-gui-plugin-soundcard' (https://github.com/pybpod/pybpod-gui-plugin-soundcard.git) registered for path 'plugins/pybpod-gui-plugin-soundcard'
Submodule 'plugins - pybpod-gui-plugin-stmdiagram' (https://github.com/pybpod/pybpod-gui-plugin-stmdiagram.git) registered for path 'plugins/pybpod-gui-plugin-stmdiagram'
Submodule 'plugins - pybpod-gui-plugin-timeline' (https://github.com/pybpod/pybpod-gui-plugin-timeline.git) registered for path 'plugins/pybpod-gui-plugin-timeline'
Submodule 'plugins - pybpod-gui-plugin-trial-timeline' (https://github.com/pybpod/pybpod-gui-plugin-trial-timeline) registered for path 'plugins/pybpod-gui-plugin-trial-timeline'
Submodule 'plugins - pybpod-gui-plugin-waveplayer' (https://github.com/pybpod/pybpod-gui-plugin-waveplayer) registered for path 'plugins/pybpod-gui-plugin-waveplayer'
Cloning into '/home/henry/Documents/chris-pybpod/base/pybpod-api'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'ssh://git@github.com/ckarageorgkaneen/pybpod-api.git' into submodule path '/home/henry/Documents/chris-pybpod/base/pybpod-api' failed
Failed to clone 'base/pybpod-api'. Retry scheduled
Cloning into '/home/henry/Documents/chris-pybpod/base/pybpod-gui-api'...
remote: Enumerating objects: 1566, done.        
remote: Counting objects: 100% (16/16), done.        
remote: Compressing objects: 100% (13/13), done.        
remote: Total 1566 (delta 5), reused 9 (delta 3), pack-reused 1550        
Receiving objects: 100% (1566/1566), 250.80 KiB | 1.57 MiB/s, done.
Resolving deltas: 100% (1077/1077), done.
Cloning into '/home/henry/Documents/chris-pybpod/base/pybpod-gui-plugin'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'ssh://git@github.com/ckarageorgkaneen/pybpod-gui-plugin.git' into submodule path '/home/henry/Documents/chris-pybpod/base/pybpod-gui-plugin' failed
Failed to clone 'base/pybpod-gui-plugin'. Retry scheduled
Cloning into '/home/henry/Documents/chris-pybpod/libraries/logging-bootstrap'...
Cloning into '/home/henry/Documents/chris-pybpod/libraries/pyforms-generic-editor'...
Receiving objects: 100% (1060/1060), 690.53 KiB | 1.70 MiB/s, done.
Resolving deltas: 100% (578/578), done.
Cloning into '/home/henry/Documents/chris-pybpod/libraries/pyforms-gui'...
remote: Enumerating objects: 1426, done.        
remote: Counting objects: 100% (66/66), done.        
remote: Compressing objects: 100% (23/23), done.        
remote: Total 1426 (delta 26), reused 62 (delta 25), pack-reused 1360        
Receiving objects: 100% (1426/1426), 3.53 MiB | 1.52 MiB/s, done.
Resolving deltas: 100% (928/928), done.
Cloning into '/home/henry/Documents/chris-pybpod/libraries/safe-collaborative-architecture'...
Receiving objects: 100% (120/120), 19.26 KiB | 6.42 MiB/s, done.
Resolving deltas: 100% (51/51), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pge-plugin-terminal'...
Receiving objects: 100% (125/125), 102.58 KiB | 729.00 KiB/s, done.
Resolving deltas: 100% (56/56), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-alyx'...
remote: Enumerating objects: 410, done.        
remote: Counting objects: 100% (17/17), done.        
remote: Compressing objects: 100% (13/13), done.        
remote: Total 410 (delta 6), reused 10 (delta 4), pack-reused 393        
Receiving objects: 100% (410/410), 59.34 KiB | 1.21 MiB/s, done.
Resolving deltas: 100% (242/242), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-emulator'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'ssh://git@github.com/ckarageorgkaneen/pybpod-gui-plugin-emulator.git' into submodule path '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-emulator' failed
Failed to clone 'plugins/pybpod-gui-plugin-emulator'. Retry scheduled
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-rotaryencoder'...
remote: Enumerating objects: 350, done.        
remote: Total 350 (delta 0), reused 0 (delta 0), pack-reused 350        
Receiving objects: 100% (350/350), 349.81 KiB | 1.71 MiB/s, done.
Resolving deltas: 100% (216/216), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-session-history'...
remote: Enumerating objects: 212, done.        
remote: Total 212 (delta 0), reused 0 (delta 0), pack-reused 212        
Receiving objects: 100% (212/212), 28.49 KiB | 595.00 KiB/s, done.
Resolving deltas: 100% (122/122), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-soundcard'...
remote: Enumerating objects: 421, done.        
remote: Total 421 (delta 0), reused 0 (delta 0), pack-reused 421        
Receiving objects: 100% (421/421), 297.95 KiB | 510.00 KiB/s, done.
Resolving deltas: 100% (281/281), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-stmdiagram'...
remote: Enumerating objects: 59, done.        
remote: Total 59 (delta 0), reused 0 (delta 0), pack-reused 59        
Receiving objects: 100% (59/59), 13.61 KiB | 302.00 KiB/s, done.
Resolving deltas: 100% (17/17), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-timeline'...
remote: Enumerating objects: 137, done.        
remote: Total 137 (delta 0), reused 0 (delta 0), pack-reused 137        
Receiving objects: 100% (137/137), 18.85 KiB | 371.00 KiB/s, done.
Resolving deltas: 100% (71/71), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-trial-timeline'...
remote: Enumerating objects: 104, done.        
remote: Total 104 (delta 0), reused 0 (delta 0), pack-reused 104        
Receiving objects: 100% (104/104), 20.33 KiB | 416.00 KiB/s, done.
Resolving deltas: 100% (43/43), done.
Cloning into '/home/henry/Documents/chris-pybpod/plugins/pybpod-gui-plugin-waveplayer'...
remote: Enumerating objects: 121, done.        
remote: Total 121 (delta 0), reused 0 (delta 0), pack-reused 121        
Receiving objects: 100% (121/121), 37.63 KiB | 786.00 KiB/s, done.
Resolving deltas: 100% (48/48), done.
Cloning into '/home/henry/Documents/chris-pybpod/base/pybpod-api'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'ssh://git@github.com/ckarageorgkaneen/pybpod-api.git' into submodule path '/home/henry/Documents/chris-pybpod/base/pybpod-api' failed
Failed to clone 'base/pybpod-api' a second time, aborting
HenryJFlynn commented 1 year ago

https://github.com/desktop/desktop/issues/2344

HenryJFlynn commented 1 year ago

The sub modules could only be clonedwith ssh permission see https://github.com/pybpod/pybpod/commit/98c03e677a640de6c49cd1c178afc2071bc5c0f9

ckarageorgkaneen commented 1 year ago

My bad. Fixed by amending https://github.com/pybpod/pybpod/commit/98c03e677a640de6c49cd1c178afc2071bc5c0f9.

ckarageorgkaneen commented 1 year ago

For start-pybpod, see https://github.com/pybpod/pybpod/issues/91.

HenryJFlynn commented 1 year ago

Must update pip in the environment for any pip install ... to work properly

HenryJFlynn commented 1 year ago

trying to get the pybod gui ti successfully run the examples protocol 10_state_example

When my_bpod = Bpod(emulator_mode=...) is True nothing happens. Hit start, it runs for a few seconds then the gui resets. No output. No error. No nothing False or gibberish or gbf or ` instantly runs and resets. no output. no error. nothing, soBpod()` nothing happens

With clear errors in the protocol such as deleting half of the protocol, there is no error. In some of my proding i got it to pop this error but i haven't been able to reproduce it.

Traceback (most recent call last):
  File "/home/henry/Documents/pybpod-testing/Untitled project 7/tasks/10_state_example/10_state_example.py", line 2, in <module>
    my_bpod = Bpod(emulator_mode = dg98)
NameError: name 'dg98' is not defined
Traceback (most recent call last):
  File "/home/henry/Documents/pybpod-testing/Untitled project 7/tasks/10_state_example/10_state_example.py", line 3, in <module>
    sma = StateMachine(my_bpod)
  File "/home/henry/Documents/chris-pybpod/base/pybpod-api/pybpodapi/state_machine/state_machine_runner.py", line 20, in __init__
    StateMachineBuilder.__init__(self, bpod)
  File "/home/henry/Documents/chris-pybpod/base/pybpod-api/pybpodapi/state_machine/state_machine_base.py", line 52, in __init__
    self.state_timers = [0] * self.hardware.max_states  # list(float)
TypeError: can't multiply sequence by non-int of type 'NoneType'

This is with emulator mode enabled in the gui. Without, the protocol IO fails to open and crashes the program.

HenryJFlynn commented 1 year ago

when i first start the program

(pybpod-environment) henry@henry-Vostro-270:~/Documents/chris-pybpod/base/pybpod$ start-pybpod
/lib/x86_64-linux-gnu/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
ControlWeb will not work
QtWebEngine may be missing
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
libpng warning: iCCP: known incorrect sRGB profile
26/05/2023 02:44:40 | WARNING | 8756 | pyforms_generic_editor.plugins.loader | install_plugins | Plugins path was not defined by user
libGL error: MESA-LOADER: failed to open crocus: /usr/lib/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: crocus
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
HenryJFlynn commented 1 year ago

after trying: https://github.com/helloSystem/LinuxRuntime/issues/11

ERROR: ld.so: object '/usr/lib64/libfreetype.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib64/libfreetype.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
/lib/x86_64-linux-gnu/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
ControlWeb will not work
QtWebEngine may be missing
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
libpng warning: iCCP: known incorrect sRGB profile
26/05/2023 03:46:40 | WARNING | 11250 | pyforms_generic_editor.plugins.loader | install_plugins | Plugins path was not defined by user
libGL error: MESA-LOADER: failed to open crocus: /usr/lib/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: crocus
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
HenryJFlynn commented 1 year ago

just gonna ignore that error ^.

Current problems:

HenryJFlynn commented 1 year ago

also sometimes this happens image the task editor is blank. There should be code there

HenryJFlynn commented 1 year ago

just got the error e ignored in the board log. idk what is going on

HenryJFlynn commented 1 year ago

Steps start up and pybpod

  1. open pybpod folder inside terminal
  2. start-pybpod
  3. File --> Open Project --> select your project
  4. Go to boards --> Select Board --> select Emulator mode + click Console
  5. Go to Users --> Double click on desired user for this experiment
  6. Go to Project ->Experiment->ExperimentName->SetupName select board, protocol, and add subjects
  7. Click Test Protocol IO button
  8. run the protocol
HenryJFlynn commented 1 year ago

gui plugin must be at the end

image

HenryJFlynn commented 1 year ago

after changing user settings, protocols opened in the task editor are empty. Blank. There is no code.

ckarageorgkaneen commented 1 year ago

after changing user settings, protocols opened in the task editor are empty. Blank. There is no code.

If you revert the changes, does the code re-appear?

HenryJFlynn commented 1 year ago

going from ~/Documents/chris-pybpod/base/pybpod$ user_settings.py is created in Home, outside of Documents.

HenryJFlynn commented 1 year ago

pybpod gets its firmware and version from the api settings file. There is no way to easily change them as a user. To do this, we would like to add a snippet of code in board_com.py which takes the firmware and version type from a user_settings files which we specifiy

HenryJFlynn commented 1 year ago

another problem is that running the protocol light_chasing_examples... doesn't work properly. It requires a poke input which it never receives yet it runs.

HenryJFlynn commented 1 year ago

another problem is that running the protocol light_chasing_examples... doesn't work properly. It requires a poke input which it never receives yet it runs.

Once the proper firmware and version with correct number of ports are implemented in the gui, this protocol runs fine

ckarageorgkaneen commented 1 year ago

another problem is that running the protocol light_chasing_examples... doesn't work properly. It requires a poke input which it never receives yet it runs.

Once the proper firmware and version with correct number of ports are implemented in the gui, this protocol runs fine

awesome

HenryJFlynn commented 1 year ago

pybpod gets its firmware and version from the api settings file. There is no way to easily change them as a user. To do this, we would like to add a snippet of code in board_com.py which takes the firmware and version type from a user_settings files which we specifiy

I was wrong. We don't need to do this. Copy and pasting the desired settings into the user settings you can set in the gui works fine.

My setting look like this

SETTINGS_PRIORITY = 0

GENERIC_EDITOR_PLUGINS_LIST = ['pybpodgui_plugin', 'pybpod_gui_plugin_emulator']

TARGET_BPOD_FIRMWARE_VERSION = "8"
EMULATOR_BPOD_MACHINE_TYPE = 1

BPOD_BNC_PORTS_ENABLED = [True, True]
BPOD_WIRED_PORTS_ENABLED = [True, True, True, True]
BPOD_BEHAVIOR_PORTS_ENABLED = [True, True, True, False, False, False, False, False]

and I get this this

image

HenryJFlynn commented 1 year ago

problems with with the gui

  1. if you poke in or out too fast, it crashes
  2. if emulator mode isn't enables, it crashes
  3. if buttons are checked when the protocol ends, they remain checked.
  4. if you press Run Protocol and you can't run because you didn't save for examples, the button doesn't reset. It still looks pressed
HenryJFlynn commented 1 year ago

all the examples run fine except emulator_10_state_w_pwm_outputs_examples due to firmware requirements. I am looking past this as it is irrelevant and moving on to mouse2afc.

running emulator_mouse2afc_example, this is my complete output:

['__UUID4__', '8b305563-5c36-420b-9d10-4f4000850049']
['__CREATED-ON__', '2023-05-29 12:50:51.205583']
['__DEF-URL__', 'http://pybpod-api.readthedocs.org']
['__DEF-TEXT__', 'This file contains data recorded during a session from the PyBpod system']
['__SOFTWARE__', 'PyBpod API v1.8.2']
['__HAS-HEADER__']
['TYPE', 'PC-TIME', 'BPOD-INITIAL-TIME', 'BPOD-FINAL-TIME', 'MSG', '+INFO']
['INFO', '2023-05-29 12:50:51.206482', '', '', 'SERIAL-PORT', '']
['INFO', '2023-05-29 12:50:51.206549', '', '', 'PROTOCOL-NAME', 'emulator_mouse2afc_example']
['INFO', '2023-05-29 12:50:51.206575', '', '', 'CREATOR-NAME', '["csk", "9c98433a-110b-47a7-a0c8-80572324d10e", "local"]']
['INFO', '2023-05-29 12:50:51.206598', '', '', 'PROJECT-NAME', 'pybpod-project']
['INFO', '2023-05-29 12:50:51.206619', '', '', 'EXPERIMENT-NAME', 'Experiment_1']
['INFO', '2023-05-29 12:50:51.206640', '', '', 'BOARD-NAME', 'Board_1']
['INFO', '2023-05-29 12:50:51.206661', '', '', 'SETUP-NAME', 'Setup_1']
['INFO', '2023-05-29 12:50:51.206683', '', '', 'BPOD-GUI-VERSION', '']
['INFO', '2023-05-29 12:50:51.206702', '', '', 'NET-PORT', '36000']
['INFO', '2023-05-29 12:50:51.206725', '', '', 'SUBJECT-NAME', "['Mickey', 'f2ab9be6-1b0f-4c52-b78f-567f7dd06006']"]
['INFO', '2023-05-29 12:50:51.206761', '', '', 'This is a PYBPOD file. Find more info at http://pybpod.readthedocs.io', '']
['INFO', '2023-05-29 12:50:51.206784', '', '', 'BPOD-API-VERSION', '1.8.2']
['INFO', '2023-05-29 12:50:51.206803', '', '', 'SESSION-NAME', '20230529-125050']
['INFO', '2023-05-29 12:50:51.206822', '', '', 'SESSION-STARTED', '2023-05-29 12:50:51.205421']

b'Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.\n'
b'libGL error: MESA-LOADER: failed to open crocus: /usr/lib/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)\n'
b'libGL error: failed to load driver: crocus\n'
b'libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)\n'
b'libGL error: failed to load driver: swrast\n'
['stderr', '2023-05-29 12:50:54.117685', '', 'Before StateMatrix()', '', '']
['stderr', '2023-05-29 12:50:54.117934', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.119799', '', 'Traceback (most recent call last):\n', '', '']
['stderr', '2023-05-29 12:50:54.119942', '', '  File "/home/henry/Documents/chris-pybpod/base/pybpod-api/pybpodapi/state_machine/state_machine_base.py", line 221, in add_state\n', '', '']
['stderr', '2023-05-29 12:50:54.120295', '', '    ', '', '']
['stderr', '2023-05-29 12:50:54.120343', '', 'action_name', '', '']
['stderr', '2023-05-29 12:50:54.120378', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.120418', '', 'ValueError', '', '']
['stderr', '2023-05-29 12:50:54.120452', '', ': ', '', '']
['stderr', '2023-05-29 12:50:54.120483', '', "'Wire1' is not in list", '', '']
['stderr', '2023-05-29 12:50:54.120516', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.120546', '', '\nDuring handling of the above exception, another exception occurred:\n\n', '', '']
['stderr', '2023-05-29 12:50:54.120581', '', 'Traceback (most recent call last):\n', '', '']
['stderr', '2023-05-29 12:50:54.120616', '', '  File "/home/henry/Documents/pybpod-project/tasks/emulator_mouse2afc_example/emulator_mouse2afc_example.py", line 8, in <module>\n', '', '']
['stderr', '2023-05-29 12:50:54.120752', '', '    ', '', '']
['stderr', '2023-05-29 12:50:54.120791', '', 'Mouse2AFC(bpod).run()', '', '']
['stderr', '2023-05-29 12:50:54.120823', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.120855', '', '  File "/home/henry/Documents/mouse2afc/mouse2afc.py", line 99, in run\n', '', '']
['stderr', '2023-05-29 12:50:54.120998', '', '    ', '', '']
['stderr', '2023-05-29 12:50:54.121036', '', 'self._bpod, self._task_parameters, self._data, i_trial)', '', '']
['stderr', '2023-05-29 12:50:54.121070', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.121102', '', '  File "/home/henry/Documents/mouse2afc/state_matrix.py", line 537, in __init__\n', '', '']
['stderr', '2023-05-29 12:50:54.121381', '', '    ', '', '']
['stderr', '2023-05-29 12:50:54.121420', '', 'output_actions=(IncorrectChoice_Signal + WaitFeedbackStim))', '', '']
['stderr', '2023-05-29 12:50:54.121453', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.121485', '', '  File "/home/henry/Documents/chris-pybpod/base/pybpod-api/pybpodapi/state_machine/state_machine_base.py", line 229, in add_state\n', '', '']
['stderr', '2023-05-29 12:50:54.121670', '', '    ', '', '']
['stderr', '2023-05-29 12:50:54.121708', '', '+ " is an invalid output name."', '', '']
['stderr', '2023-05-29 12:50:54.121740', '', '\n', '', '']
['stderr', '2023-05-29 12:50:54.121775', '', 'pybpodapi.state_machine.state_machine_base', '', '']
['stderr', '2023-05-29 12:50:54.121808', '', '.', '', '']
['stderr', '2023-05-29 12:50:54.121839', '', 'SMAError', '', '']
['stderr', '2023-05-29 12:50:54.121871', '', ': ', '', '']
['stderr', '2023-05-29 12:50:54.121901', '', 'Error creating state: Punishment. Wire1 is an invalid output name.', '', '']
['stderr', '2023-05-29 12:50:54.121934', '', '\n', '', '']
HenryJFlynn commented 1 year ago

^^^ this is the for loop which is flagging the error

for action_name, action_value in output_actions:
            if action_name == "Valve":
                output_code = self.hardware.channels.output_channel_names.index(
                    OutputChannel.Valve + str(action_value)
                )
                output_value = 1

                """
                elif action_name == 'ValveState':
                    output_code  = self.hardware.channels.output_channel_names.index( OutputChannel.Valve+str(action_value))
                    output_value = math.pow(2, action_value - 1)
                """
            elif action_name == OutputChannel.LED:
                output_code = self.hardware.channels.output_channel_names.index(
                    ChannelName.PWM + str(action_value)
                )
                output_value = 255

            else:
                try:
                    output_code = self.hardware.channels.output_channel_names.index(
                        action_name
                    )
                except:
                    raise SMAError(
                        "Error creating state: "
                        + state_name
                        + ". "
                        + action_name
                        + " is an invalid output name."
                    )

my guess is that self.hardware.channels.output_channel_names is not set correctly.

leads me to channels.py and def setup_output_channels(self, hw_outputs, hardware): hw_outputs contains the list of valid outputs. Going deeper we find self.channels.setup_output_channels(self.outputs, self) is called in hardware.py. self.outputs is set in bpod_base with `self.bpod_modules = self._bpodcom_get_modules_info(self._hardware)

    self._hardware.setup(self.bpod_modules)`
HenryJFlynn commented 1 year ago

^^ should be notes that in the gui, Wire1 is a valid output

HenryJFlynn commented 1 year ago

^^ work around this is the problem output

elif task_parameters.IncorrectChoiceSignalType == \
                IncorrectChoiceSignalType.BeepOnWire_1:
            PunishmentDuration = 0.25
            IncorrectChoice_Signal = [('Wire1', 1)]

delete Wire1

elif task_parameters.IncorrectChoiceSignalType == \
                IncorrectChoiceSignalType.BeepOnWire_1:
            PunishmentDuration = 0.25
            IncorrectChoice_Signal = []

and mouse2afc runs.

HenryJFlynn commented 1 year ago

Found another work around for ^^. In the task parameter gui, don't select BeepOnWire_1

Similarly, this error can happens with the state WaitForPunishStart due to its output of Wire1OutError :

# Wire1 settings
        Wire1OutError = iff(task_parameters.Wire1VideoTrigger, [(
                            'Wire2', 2)], [])
        Wire1OutCorrectCondition = task_parameters.Wire1VideoTrigger and \
            data.Custom.CatchTrial[i_trial]
        Wire1OutCorrect = iff(Wire1OutCorrectCondition,
                              [('Wire2', 2)], [])

If these two options are not selected to avoid ('WireX','Y') as an output, the protocol runs fun. There issue is with the wire outputs

HenryJFlynn commented 1 year ago

pybpod gets its firmware and version from the api settings file. There is no way to easily change them as a user. To do this, we would like to add a snippet of code in board_com.py which takes the firmware and version type from a user_settings files which we specifiy

I was wrong. We don't need to do this. Copy and pasting the desired settings into the user settings you can set in the gui works fine.

My setting look like this

SETTINGS_PRIORITY = 0

GENERIC_EDITOR_PLUGINS_LIST = ['pybpodgui_plugin', 'pybpod_gui_plugin_emulator']

TARGET_BPOD_FIRMWARE_VERSION = "8"
EMULATOR_BPOD_MACHINE_TYPE = 1

BPOD_BNC_PORTS_ENABLED = [True, True]
BPOD_WIRED_PORTS_ENABLED = [True, True, True, True]
BPOD_BEHAVIOR_PORTS_ENABLED = [True, True, True, False, False, False, False, False]

and I get this this

image

I was wrong about being wrong. I got the protocol to run without Wire1 is an invalid output name by 1. Changing the api settings files firmware and machine type and 2. Keeping

> BPOD_BNC_PORTS_ENABLED = [True, True]
> BPOD_WIRED_PORTS_ENABLED = [True, True, True, True]
> BPOD_BEHAVIOR_PORTS_ENABLED = [True, True, True, False, False, False, False, False]

in user settings. For some reason without it, pybpod crashes. Specifcally the file inside /home/henry/Documents/chris-pybpod/base/pybpod-api/pybpodapi/settings.py

HenryJFlynn commented 1 year ago

I do not understand why it works or doesn't work.

HenryJFlynn commented 1 year ago

I would like to do the first idea of inputting a line or two to check for user settings which would then overwrite the current settings as to add the current firmware and number of ports etc. My problem is finding where the program gets its settings to begin with

HenryJFlynn commented 1 year ago

in board_com.py

# load bpod configuration template
        template = os.path.join(os.path.dirname(__file__), 'run_settings_template.py')
        bpod_settings = open(template, 'r').read().format(
            serialport=board.serial_port,
            bnp_ports=('BPOD_BNC_PORTS_ENABLED = {0}'.format(board.enabled_bncports) if board.enabled_bncports else ''),
            wired_ports=('BPOD_WIRED_PORTS_ENABLED = {0}'.format(board.enabled_wiredports) if board.enabled_wiredports else ''),
            behavior_ports=('BPOD_BEHAVIOR_PORTS_ENABLED = {0}'.format(board.enabled_behaviorports) if board.enabled_behaviorports else ''),
            session_name=session.name,
            netport=board_task.board.net_port,
            stream2stdout=not detached,
            project=session.project.name,
            experiment=session.setup.experiment.name,
            board=board_task.board.name,
            setup=session.setup.name,
            session=session.name,
            protocolname=board_task.task.name,
            session_path=os.path.abspath(session.path).encode('unicode_escape').decode(),
            subjects=','.join(list(map(lambda x: '"'+str(x)+'"', session.subjects))),
            user=json.dumps([session.user.name, str(session.user.uuid4), session.user.connection] if session.user.uuid4 else None),
            subject_extra=','.join(list(map(lambda x: '"'+str(x)+'"', xt_subject))),
            user_extra=xt_user,
            variables_names=','.join(["'"+var.name+"'" for var in board_task.variables]),
            bpod_firmware_version=conf.TARGET_BPOD_FIRMWARE_VERSION
        )

The bpod_firmware_version=conf.TARGET_BPOD_FIRMWARE_VERSION is read from the gui user settings

ckarageorgkaneen commented 1 year ago

in board_com.py

# load bpod configuration template
        template = os.path.join(os.path.dirname(__file__), 'run_settings_template.py')
        bpod_settings = open(template, 'r').read().format(
            serialport=board.serial_port,
            bnp_ports=('BPOD_BNC_PORTS_ENABLED = {0}'.format(board.enabled_bncports) if board.enabled_bncports else ''),
            wired_ports=('BPOD_WIRED_PORTS_ENABLED = {0}'.format(board.enabled_wiredports) if board.enabled_wiredports else ''),
            behavior_ports=('BPOD_BEHAVIOR_PORTS_ENABLED = {0}'.format(board.enabled_behaviorports) if board.enabled_behaviorports else ''),
            session_name=session.name,
            netport=board_task.board.net_port,
            stream2stdout=not detached,
            project=session.project.name,
            experiment=session.setup.experiment.name,
            board=board_task.board.name,
            setup=session.setup.name,
            session=session.name,
            protocolname=board_task.task.name,
            session_path=os.path.abspath(session.path).encode('unicode_escape').decode(),
            subjects=','.join(list(map(lambda x: '"'+str(x)+'"', session.subjects))),
            user=json.dumps([session.user.name, str(session.user.uuid4), session.user.connection] if session.user.uuid4 else None),
            subject_extra=','.join(list(map(lambda x: '"'+str(x)+'"', xt_subject))),
            user_extra=xt_user,
            variables_names=','.join(["'"+var.name+"'" for var in board_task.variables]),
            bpod_firmware_version=conf.TARGET_BPOD_FIRMWARE_VERSION
        )

The bpod_firmware_version=conf.TARGET_BPOD_FIRMWARE_VERSION is read from the gui user settings

Put more custom settings in the GUI user settings. Then put a breakpoint after this statement and run a protocol. When the breakpoint is reached, print the contents of conf. If all the custom settings that you added are in there, then they are in fact picked up.

HenryJFlynn commented 1 year ago

See https://github.com/HenryJFlynn/pybpod-gui-api/issues/1 for the fix to Error creating state: Punishment. Wire1 is an invalid output name

HenryJFlynn commented 1 year ago

Currently the pybpod task parameters settings are so that there is little to no time to make a choice. You centerpoke and before you can pokeout the trial is over. Gonna try to fix this by updating the config.py to reflect the settings in the matlab gui.

HenryJFlynn commented 1 year ago

Differences between matlab task parameter gui and pybpod

  1. pybpod has no settings for a second experiment
  2. location of certain values
  3. pybpod has no isOptoTrial visible in gui
HenryJFlynn commented 1 year ago

Currently the pybpod task parameters settings are so that there is little to no time to make a choice. You centerpoke and before you can pokeout the trial is over. Gonna try to fix this by updating the config.py to reflect the settings in the matlab gui.

This didn't help and made things worse

HenryJFlynn commented 1 year ago
['stderr', '2023-05-31 11:43:40.798847', '', 'Before StateMatrix()', '', '']
['stderr', '2023-05-31 11:43:40.798933', '', '\n', '', '']
['stderr', '2023-05-31 11:43:40.800174', '', 'Before send_state_machine()', '', '']
['stderr', '2023-05-31 11:43:40.800325', '', '\n', '', '']
['stderr', '2023-05-31 11:43:40.805836', '', 'Before run_state_machine()', '', '']
['stderr', '2023-05-31 11:43:40.805992', '', '\n', '', '']
['TRIAL', '2023-05-31 11:43:40.806068', '', '', 'New trial', '']
['EVENT', '2023-05-31 11:43:40.816268', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:40.816771', '', '', 'WaitForCenterPoke', '']

['EVENT', '2023-05-31 11:43:44.730820', '', '', '44', 'Port2In']
['TRANSITION', '2023-05-31 11:43:44.730986', '', '', 'PreStimReward', '']
['EVENT', '2023-05-31 11:43:44.740809', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.740978', '', '', 'TriggerWaitForStimulus', '']
['EVENT', '2023-05-31 11:43:44.760811', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.760895', '', '', 'WaitForStimulus', '']
['EVENT', '2023-05-31 11:43:44.760977', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.761256', '', '', 'stimulus_delivery', '']
['EVENT', '2023-05-31 11:43:44.928123', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.928477', '', '', 'BeepMinSampling', '']
['EVENT', '2023-05-31 11:43:44.928582', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.928836', '', '', 'CenterPortRewardDelivery', '']
['EVENT', '2023-05-31 11:43:44.961520', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:44.961872', '', '', 'StimulusTime', '']
['EVENT', '2023-05-31 11:43:45.028618', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:45.029074', '', '', 'WaitCenterPortOut', '']
['EVENT', '2023-05-31 11:43:45.029174', '', '', '63', 'GlobalTimer1_End']
['TRANSITION', '2023-05-31 11:43:45.029250', '', '', 'timeOut_missed_choice', '']
['EVENT', '2023-05-31 11:43:45.039190', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:45.039560', '', '', 'ITI', '']
['EVENT', '2023-05-31 11:43:45.039650', '', '', '67', 'GlobalTimer5_End']
['EVENT', '2023-05-31 11:43:45.059208', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:45.059393', '', '', 'ext_ITI', '']
['EVENT', '2023-05-31 11:43:45.059489', '', '', '77', 'Condition5']
['END-TRIAL', '2023-05-31 11:43:45.059623', '', '', 'The trial ended', '']
['INFO', '2023-05-31 11:43:45.059668', '1685522620.806183', '1685522625.0594468', 'TRIAL-BPOD-TIME', '4.253263711929321']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059704', '0.010018348693847656', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059736', '3.924581289291382', '', '44', 'Port2In']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059764', '3.9345827102661133', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059790', '3.9545962810516357', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059819', '3.9547641277313232', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059845', '4.1218860149383545', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059873', '4.122363567352295', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059899', '4.1552817821502686', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059926', '4.222383260726929', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059952', '4.222947359085083', '', '63', 'GlobalTimer1_End']
['EVENT-SUMMARY', '2023-05-31 11:43:45.059980', '4.232963800430298', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.060006', '4.233433723449707', '', '67', 'GlobalTimer5_End']
['EVENT-SUMMARY', '2023-05-31 11:43:45.060033', '4.2529661655426025', '', '78', 'Tup']
['EVENT-SUMMARY', '2023-05-31 11:43:45.060059', '4.253263711929321', '', '77', 'Condition5']
['STATE', '2023-05-31 11:43:45.060113', '0', '0.010018348693847656', 'ITI_Signal', '0.010018348693847656']
['STATE', '2023-05-31 11:43:45.060164', '0.010018348693847656', '3.924581289291382', 'WaitForCenterPoke', '3.914562940597534']
['STATE', '2023-05-31 11:43:45.060196', '3.924581289291382', '3.9345827102661133', 'PreStimReward', '0.010001420974731445']
['STATE', '2023-05-31 11:43:45.060226', '3.9345827102661133', '3.9545962810516357', 'TriggerWaitForStimulus', '0.02001357078552246']
['STATE', '2023-05-31 11:43:45.060268', '3.9545962810516357', '3.9547641277313232', 'WaitForStimulus', '0.0001678466796875']
['STATE', '2023-05-31 11:43:45.060298', '3.9547641277313232', '4.1218860149383545', 'stimulus_delivery', '0.16712188720703125']
['STATE', '2023-05-31 11:43:45.060340', '4.1218860149383545', '4.122363567352295', 'BeepMinSampling', '0.0004775524139404297']
['STATE', '2023-05-31 11:43:45.060370', '4.122363567352295', '4.1552817821502686', 'CenterPortRewardDelivery', '0.03291821479797363']
['STATE', '2023-05-31 11:43:45.060399', '4.1552817821502686', '4.222383260726929', 'StimulusTime', '0.06710147857666016']
['STATE', '2023-05-31 11:43:45.060428', '4.222383260726929', '4.222947359085083', 'WaitCenterPortOut', '0.0005640983581542969']
['STATE', '2023-05-31 11:43:45.060458', '4.222947359085083', '4.232963800430298', 'timeOut_missed_choice', '0.010016441345214844']
['STATE', '2023-05-31 11:43:45.060488', '4.232963800430298', '4.2529661655426025', 'ITI', '0.020002365112304688']
['STATE', '2023-05-31 11:43:45.060517', '4.2529661655426025', '4.253263711929321', 'ext_ITI', '0.00029754638671875']
['STATE', '2023-05-31 11:43:45.060553', 'nan', 'nan', 'StimDelayGrace', 'nan']
['STATE', '2023-05-31 11:43:45.060581', 'nan', 'nan', 'broke_fixation', 'nan']
['STATE', '2023-05-31 11:43:45.060608', 'nan', 'nan', 'early_withdrawal', 'nan']
['STATE', '2023-05-31 11:43:45.060635', 'nan', 'nan', 'TriggerWaitChoiceTimer', 'nan']
['STATE', '2023-05-31 11:43:45.060662', 'nan', 'nan', 'WaitForChoice', 'nan']
['STATE', '2023-05-31 11:43:45.060689', 'nan', 'nan', 'WaitForRewardStart', 'nan']
['STATE', '2023-05-31 11:43:45.060716', 'nan', 'nan', 'WaitForReward', 'nan']
['STATE', '2023-05-31 11:43:45.060742', 'nan', 'nan', 'RewardGrace', 'nan']
['STATE', '2023-05-31 11:43:45.060768', 'nan', 'nan', 'Reward', 'nan']
['STATE', '2023-05-31 11:43:45.060797', 'nan', 'nan', 'WaitRewardOut', 'nan']
['STATE', '2023-05-31 11:43:45.060824', 'nan', 'nan', 'RegisterWrongWaitCorrect', 'nan']
['STATE', '2023-05-31 11:43:45.060851', 'nan', 'nan', 'WaitForPunishStart', 'nan']
['STATE', '2023-05-31 11:43:45.060877', 'nan', 'nan', 'WaitForPunish', 'nan']
['STATE', '2023-05-31 11:43:45.060906', 'nan', 'nan', 'PunishGrace', 'nan']
['STATE', '2023-05-31 11:43:45.060932', 'nan', 'nan', 'Punishment', 'nan']
['STATE', '2023-05-31 11:43:45.060958', 'nan', 'nan', 'WaitPunishOut', 'nan']
['STATE', '2023-05-31 11:43:45.060984', 'nan', 'nan', 'timeOut_EarlyWithdrawal', 'nan']
['STATE', '2023-05-31 11:43:45.061011', 'nan', 'nan', 'timeOut_EarlyWithdrawalFlashOn', 'nan']
['STATE', '2023-05-31 11:43:45.061037', 'nan', 'nan', 'timeOut_IncorrectChoice', 'nan']
['STATE', '2023-05-31 11:43:45.061063', 'nan', 'nan', 'timeOut_SkippedFeedback', 'nan']
['stderr', '2023-05-31 11:43:45.061852', '', 'Before StateMatrix()', '', '']
['stderr', '2023-05-31 11:43:45.061888', '', '\n', '', '']
['stderr', '2023-05-31 11:43:45.062968', '', 'Before send_state_machine()', '', '']
['stderr', '2023-05-31 11:43:45.063002', '', '\n', '', '']
['stderr', '2023-05-31 11:43:45.067969', '', 'Before run_state_machine()', '', '']
['stderr', '2023-05-31 11:43:45.068011', '', '\n', '', '']
['TRIAL', '2023-05-31 11:43:45.068041', '', '', 'New trial', '']
['EVENT', '2023-05-31 11:43:45.078167', '', '', '78', 'Tup']
['TRANSITION', '2023-05-31 11:43:45.078398', '', '', 'WaitForCenterPoke', '']

['EVENT', '2023-05-31 11:43:45.528845', '', '', '45', 'Port2Out']

as you can all every state transition is a timer which hits immediately. I did Port2In and before i even clicked out the trial ended and restarted which is why you can Port2Out as the last output.

HenryJFlynn commented 1 year ago

^^ WaitForChoice and ChoiceDeadline

Currently the pybpod task parameters settings are so that there is little to no time to make a choice. You centerpoke and before you can pokeout the trial is over. Gonna try to fix this by updating the config.py to reflect the settings in the matlab gui.

This didn't help and made things worse

Not all the changes made to config.py are seen in the gui. For exmaples. I changed ITI to =1 which can be seen but ChoiceDeadline I changed to =10 but in the gui it is still =0

HenryJFlynn commented 1 year ago

^^ ChoiceDeadline isn't the only problem. If you manually change its value in the gui, the same thing happens. I believe the problem is with the value of GlobalTimer1 which controls this transition

['TRANSITION', '2023-05-31 11:43:45.029074', '', '', 'WaitCenterPortOut', '']
['EVENT', '2023-05-31 11:43:45.029174', '', '', '63', 'GlobalTimer1_End']
['TRANSITION', '2023-05-31 11:43:45.029250', '', '', 'timeOut_missed_choice', '']

While in WaitCenterPortOut the timer ends so fast that a choice can't be made

HenryJFlynn commented 1 year ago

next steps: set break points in task_parameters and run protocol to trackd wo how ITI is set and then overwirteen with config data and compare that to choicedeadline which isn't being over writtne with config

HenryJFlynn commented 1 year ago

stepping through emulator_run_manual_override,py the variable task_parameters has the changes to ChoceDeadline and ITI which I made in the config file but only ITI is changes in the gui. The variable task_parameters which is using to create the GUI seen here:

class TaskParameters:

    _default_file = fullpath('config.py')

    def __init__(self, file_=None, open_gui=True):
        self._file = file_ or self._default_file
        self.task_parameters = None
        self._load()
        if open_gui:
            app = QApplication(sys.argv)
            self.GUI = TaskParametersGUI(self.task_parameters)
            app.exec_()
        self.task_parameters = AttrDict(**self.task_parameters)

the self.GUI = TaskParametersGUI(self.task_parameters) this self.task_parameters has the changes

HenryJFlynn commented 1 year ago

.ui file portion for ITI

</item>
                 <item row="1" column="0">
                  <widget class="QLabel" name="iTILabel">
                   <property name="text">
                    <string>ITI</string>
                   </property>
                  </widget>
                 </item>
                 <item row="1" column="1">
                  <widget class="QSpinBox" name="ITI"/>
                 </item>

vs portion related to ChoiceDeadline

  <item row="3" column="0">
                  <widget class="QLabel" name="choiceDeadlineLabel">
                   <property name="text">
                    <string>ChoiceDeadline</string>
                   </property>
                  </widget>
                 </item>
                 <item row="3" column="1">
                  <widget class="QSpinBox" name="ChoiceDeadline"/>
                 </item>

they're the same so it is not something to do with how the gui was created. I went into Qt Designer and verified this

HenryJFlynn commented 1 year ago

Variables which config isn't working with:

  1. ChoiceDeadline ( = 0 )
  2. Ports_LMAir ( = 0 )
  3. PreStimDelayCntrReward ( = 0 )
  4. Left,Cent,Right PokeAttenPct ( = 0 )
  5. PCTimeout ( = False)

Each default to zero or false even tho they are non-zero or true in config

HenryJFlynn commented 1 year ago

the error are caused by spelling errors/discrepancies. Must edit .ui with Qt Designer and edit config to match.

In doing this I somehow broke it and am getting a calibration error so i am gonna restart

See https://github.com/HenryJFlynn/mouse2afc/issues/17

HenryJFlynn commented 1 year ago

Two problems:

  1. No time to make a choice, likely GlobalTimer1 is set very small
  2. When Ports_LMRAir config settings are picked up by the gui (like they should be) it pops an error. See #17
HenryJFlynn commented 1 year ago

Global timer issue: In pybpod, the timer is set by this

self.set_global_timer(1, FeedbackDelayCorrect)
...
 FeedbackDelayCorrect = iff(data.Custom.CatchTrial[
            i_trial], Const.FEEDBACK_CATCH_CORRECT_SEC,
            task_parameters.FeedbackDelay)

in matlab

sma = SetGlobalTimer(sma,TimerIDChoiceDeadLine,TaskParameters.GUI.ChoiceDeadLine);

I think the values of all the globaltimer has been jumbled. Globaltimer1 shouldn't be defined by FeedbackDelayCorrect but globaltimer2 should be

HenryJFlynn commented 1 year ago

Two problems:

  1. No time to make a choice, likely GlobalTimer1 is set very small
  2. When Ports_LMRAir config settings are picked up by the gui (like they should be) it pops an error. See Fix config and Gui spelling errors #17
  1. For the global timer fix see https://github.com/HenryJFlynn/mouse2afc/pull/19 and https://github.com/HenryJFlynn/mouse2afc/commit/13d7973c91b834aef588194d0864ed08df62738a
  2. For Ports_LMRAir Fix see https://github.com/HenryJFlynn/mouse2afc/issues/20
HenryJFlynn commented 1 year ago

Now am trying to get every state triggered, essentially stress testing the protocol

HenryJFlynn commented 1 year ago

After CenterPokeIn, a choice is presented that light (left or right) stays on in matlab for the entirety of WaitForChoice but it does not in python.

['EVENT', '2023-06-01 14:39:02.669515', '', '', '44', 'Port2In']
['TRANSITION', '2023-06-01 14:39:02.669700', '', '', 'PreStimReward', '']
['EVENT', '2023-06-01 14:39:02.679525', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.679735', '', '', 'TriggerWaitForStimulus', '']
['EVENT', '2023-06-01 14:39:02.699564', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.699698', '', '', 'WaitForStimulus', '']
['EVENT', '2023-06-01 14:39:02.699796', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.700116', '', '', 'stimulus_delivery', '']
['EVENT', '2023-06-01 14:39:02.866920', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.867315', '', '', 'BeepMinSampling', '']
['EVENT', '2023-06-01 14:39:02.867419', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.867688', '', '', 'CenterPortRewardDelivery', '']
['EVENT', '2023-06-01 14:39:02.900338', '', '', '78', 'Tup']
['TRANSITION', '2023-06-01 14:39:02.900690', '', '', 'StimulusTime', '']

Turning off the light is set somewhere in this, i think