Mw dynamic stimuli

Hi Chris,

I would like to change stimulus contrast from trial to trial. I could use image stimuli or the drifting grating plugin.
I have a few questions:

The drifting grating takes XML params/properties e.g ‘size’ and ‘width’. If you specify a string with the name of another variable, changing the other variable’s value changes the stim size or width.
It also takes parameters ‘std_dev’ and ‘mean’ when mask is ‘gaussian’. If you specify the name of a variable, changing the value does not change the stimulus. Specifying numeric values in the XML does change it. Can you explain how this works?

Some example experiments have an xml drifting grating property ‘contrast’. I couldn’t find this in the C++. Correct that it is not a real param?

Both images and the grating have an alpha_multiplier property. Can this be bound to a variable? This did not seem to work. This would solve my problems.

I am using ‘043’ for now, we are testing 044. But the drifting grating plugin looks unchanged.

It looks like variables can be type float in the XML. Is this treated any different from integer? Can the client variables window set floats? Or should I just make everything an int?

Finally, do you see any other way to dynamically vary stimulus contrast from trial to trial?

Thanks
Mark


Hi Mark,

I am using ‘043’ for now

Note that my answers apply to 0.4.4 or later. I don’t know if or how things differ in “0.4.3”.

The drifting grating takes XML params/properties e.g ‘size’ and ‘width’. If you specify a string with the name of another variable, changing the other variable’s value changes the stim size or width. It also takes parameters ‘std_dev’ and ‘mean’ when mask is ‘gaussian’. If you specify the name of a variable, changing the value does not change the stimulus. Specifying numeric values in the XML does change it. Can you explain how this works?

It’s a question of how the GaussianMask class is implemented. The constructor dereferences the std_dev and mean variables and stores their then-current values as C floats. After that, the class never checks the variables’ values again, so it never sees changes you make.

It seems like the code should be changed so that std_dev and mean can be modified on the fly. I’ll open an issue and look into it.

Some example experiments have an xml drifting grating property ‘contrast’. I couldn’t find this in the C++. Correct that it is not a real param?

Correct. I don’t know why it’s in the examples. but I’ll remove it.

Both images and the grating have an alpha_multiplier property. Can this be bound to a variable? This did not seem to work. This would solve my problems.

I don’t know why it doesn’t work with the drifting grating, but I just verified that it works with images. Can you send me an example where it doesn’t?

I am using ‘043’ for now, we are testing 044. But the drifting grating plugin looks unchanged.

There were some changes. In particular, the performance of the plugin was drastically improved.

However, the “modern” dynamic stimulus infrastructure is not in 0.4.4. For that, you’ll need to look on git or in the nightly build. That should be your reference when developing new dynamic stimulus plugins, not 0.4.4.

It looks like variables can be type float in the XML. Is this treated any different from integer? Can the client variables window set floats? Or should I just make everything an int?

I’m not sure if/how floats are handled differently than integers internally. My recommendation is that you use the most appropriate data type: If a variable assumes only integer values, declare it an integer. Otherwise, make it a float.

Yes, the client variables window can set floats.

Finally, do you see any other way to dynamically vary stimulus contrast from trial to trial?

I think the right approach is to set alpha_multiplier to a variable name and vary the variable’s value. Note that such changes don’t affect the stimulus while it’s queued. In order to see the results of the change, you need either to change the variable before you queue the stimulus, or change the variable then dequeue and re-queue the stimulus.

Chris

Hi Chris,

This is great, thank you for the responses.

It’s a question of how the GaussianMask class is implemented. The constructor dereferences the std_dev and mean variables and stores their then-current values as C floats. After that, the class never checks the variables’ values again, so it never sees changes you make.

I see that now. Thanks, that makes sense.

I will check into the alpha_multiplier property.

One other useful feature addition would be to allow variables of type string to be specified in the editor and set in the Client variables window.

I’ll let you know if I can’t get things to work. Thanks for the time!
Mark

One other useful feature addition would be to allow variables of type string to be specified in the editor and set in the Client variables window.

Agreed. I’ll open issues for this, too.

Hi Chris,

I checked whether I could use the alpha_multiplier property. It doesn’t seem to change anything about the drifting grating, either when I bind a variable to it, or just set the property to a number (i.e. 0.1, 0.5) in the XML. This is using mask=“gaussian”.

This is not a big deal, I can solve it by using images instead of the dynamic stimulus.
If you get a chance to look into it, that would be great but no rush.

We will use the latest nightly as a base for future dynamic stimulus work.

Thanks!
Mark

I checked whether I could use the alpha_multiplier property. It doesn’t seem to change anything about the drifting grating, either when I bind a variable to it, or just set the property to a number (i.e. 0.1, 0.5) in the XML.

Yeah, I already opened a ticket for that. I’ll take a look and see if we can make that parameter do something useful.

Thanks,
Chris