Persistent variables; analog recording output

25 views
Skip to first unread message

João Pedro Junqueira

unread,
Jun 24, 2022, 3:49:12 AM6/24/22
to pyControl
Hello everyone,

I have two questions about pyControl variable table GUI and analog data.

1 - I'd like to set one of the variables of my experiment as persistent and with unique values for each subject. However, after selecting the experiment, subject, task, setup and adding a variable to the table, I cannot assign it to a task variable or to a subject. Options are blank. Is there's something I'm missing about this feature? I know the (blank) variable configurations I add appear on the experiment JSON file.

2 - I'm using the rotary encoder class to get analog speed data. I set the sampling rate to 100hz as in the demo running wheel task, but didn't think through that this would mean the timestamp array would be in a different sampling rate than the event timestamp array. What could be a way using python to synchronize both arrays for plotting speed together with event data? Might time drift be a problem in this case, even though both are measured in the same device? Should I start setting sampling rate to 1kHz to avoid this?

thoma...@neuro.fchampalimaud.org

unread,
Jun 24, 2022, 6:11:54 AM6/24/22
to pyControl
Hi João,

Regarding setting variables in the experiment tab's variables table:
- You can only select a variable to be set if it is defined in the task file using the v.my_variable syntax (e.g. v.session_dur = 1*hour).  Any variable defined that way in the task file should be available to select from a drop down menu in the variable column of the variables table when you add a new row to the table.  Once you have selected a variable you can then set whether it applies to all subjects or a specific subject.
- If you want to set a variable to have a unique fixed value for each subject you do not need to make the variable persistent, just add one row to the variables table for each subject specifying the value you want it to take.  Making variables persistent is used when you have a variable that will change during the task (e.g. the number of rewards collected) and you want to carry the value over from the end of one session to the start of the next.  When you set a variable as persistent you typically do not specify the value of the variable in the table, as if there is a stored value from the end of a previous session that will be used rather than the value in the table.

Regarding analog data; the .pca analog data file saves a timestamp for each sample using the same clock used for the event timestamps (ms since the start of the run), so you can align the analog samples with the events in the data file.  See the docs here for more info.

thoma...@neuro.fchampalimaud.org

unread,
Jun 29, 2022, 1:01:20 PM6/29/22
to pyControl

Hi João,

I realised that there is a bug which means that if you use named imports in your task file then variables will not be recognized by the variables table in the gui experiments tab,  e.g.:

# In task file.
import pyControl.utility as pc

pc.v.my_variable = 1 # This variable will not show up in the GUI experiment tab variables table.

I have fixed this in the dev branch in this commit and it will be fixed in the next release.

https://github.com/pyControl/code/commit/5b73b6052f5498ddbe6bd687375f7cef89343252

best,

Thomas

João Pedro Junqueira

unread,
Jul 3, 2022, 8:54:50 PM7/3/22
to thoma...@neuro.fchampalimaud.org, pyControl
Hello,

Thank you for the support. That update will be helpful.

Best,
Joao.

--
You received this message because you are subscribed to a topic in the Google Groups "pyControl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pycontrol/HdsrLAbASGs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pycontrol+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pycontrol/d0ad40e7-b12e-4ed4-966a-625d5f415f9an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages