Bonvision Stimulus Series at the same time

105 views
Skip to first unread message

oren A

unread,
Feb 8, 2022, 4:34:20 PM2/8/22
to Bonsai Users
Hi, 
I'm trying to change the "Stimulus Series" example in this page:

ttt.png
So that all grating will be presented together instead of one-by-one

Is there any way to replace Concat with a different module so that they all play together instead of one-by-one 

Thanks

brunocruz

unread,
Feb 9, 2022, 4:06:25 AM2/9/22
to Bonsai Users
Heya,

In general, Merge should have the reactive behavior you are looking for. In other words Concat plays the sequences sequentially (i.e., once the first finishes, it starts the second). Merge, on the other hand, pushes all sequences at the same time.
However (and I was not aware of this, so I had to ask Gonçalo what the solution to this problem is :P), if I understood correctly, when subscribing to the DrawGratings multiple times, it is going to share the parameters (in this case the LocationX). Resulting in only one of the locations being drawn.
In order to fix it, we can "force" the node to re-update to the original value on each RenderFrame event using WithLatestFrom.
Check the attached solution :)

Cheers,
B

test_fix.bonsai

Aman Saleem

unread,
Feb 9, 2022, 10:08:22 AM2/9/22
to oren A, Bonsai Users
Hi,
Here is a case to make this work using "SelectMany" and "CombineLatest"

image.png

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/a6abd15e-bda7-4b06-80ec-54c5e342a579n%40googlegroups.com.


--
Aman Saleem
University College London
London, UK



oren A

unread,
Feb 9, 2022, 12:47:42 PM2/9/22
to Bonsai Users
Thank you very much Aman & Bruno.

Both solutions works, but is there a way for me to understand why merge did not work? I did try it intuitively.

Can you please elaborate a bit on this paragraph, why are they sharing parameters? how am I forcing it? how could I have known that?

```
if I understood correctly, when subscribing to the DrawGratings multiple times, it is going to share the parameters (in this case the LocationX). Resulting in only one of the locations being drawn.
In order to fix it, we can "force" the node to re-update to the original value on each RenderFrame event using WithLatestFrom.
```
Thanks

Reply all
Reply to author
Forward
0 new messages