MCT showing a picture before skip


Author
Message
pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1
Hi,

I am trying to show a picture before each clock skip (let's say every 1 second before the clock skips). How would I go about in doing that? Eventually I want the time before the clock skip to be randomized (between 3 to 5 seconds), but for simplicity, let's use 1 second for now. Any help on this would be much appreciated. Thanks.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
As a high-level response: The way to do this is to (a) first work through the original unmodified script to develop a decent understanding of how it works and only then (b) start introducing well-planned modifications based on said understanding. You'll particularly want to focus on how skips are scheduled in the script / the given procedure. Once you've got that down, you can use very much the same logic / approach to schedule your picture cues preceeding the skips.

Hope this helps,
~Dave
pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1
So, in the GenerateSkipTimes trial, we have this formula to calculate skip_times:

values.skip_time = values.avg_event_interval*values.current_event_num + rand(-1*values.max_event_offset, values.max_event_offset)

And then, we save these values into the counter SkipEvent_Time through this line:
insert(counter.SkipEvent_Time, values.skip_time, values.current_event_num)

What happens when I want to make a variable called time_before_skip, and I want this new variable to be 1 second earlier than the generated skip times?

Can I do the following code:
values.time_before_skip = counter.SkipEvent_Time.value - 1000?

Afterwards, I want to do a different trial when values.time_before_skip equals the elapsed time. I tried this and I compiled the code without any error, but it would not do what I want it to do. It's like the condition values.time_before_skip == script.elapsedtime is never true and thus the trial I wanted is never reached.

Do you see an error in this? I am new at coding with Inquisit, and I suspect that something may be wrong with the line:

values.time_before_skip = counter.SkipEvent_Time.value - 1000



Thanks.
pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1
By the way, is there something special that I have to do to show the appropriate spaces in my forum posts? Because I do not mean to write everything as one big paragraph; it is just what happens when I hit the button post.
pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1
Dave,

Is there a way on Inquisit to see the values of the variables as the code is being run? This would help in debugging my code. Without it, I am having a hard time trying to determine which conditions in the code are not being met.

And also, if you could still reply to my old post, I would greatly appreciate it.

Thanks.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

values.time_before_skip = counter.SkipEvent_Time.value - 1000


The <counter> element has no such thing as a 'value' property. See its documentation for the available properties and what they represent. And in case you haven't done so yet, you need to look at how the respective counter is then used throughout the script's

elements.





Is there a way on Inquisit to see the values of the variables as the code is being run? This would help in debugging my code.






Yes. Set up a text element displaying the values of interest and include in your trials' /stimulustimes or /stimulusframes. Alternatively, in Inquisit 4, press CTRL+D at runtime.





Regards,




~Dave


pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1

I have the following excerpt from the mackworth clock test code:



<trial GeneralSkipTimes>


/ ontrialbegin = [


if ( values.current_event_num <= values.total_skip_events)


values.skip_time = values.avg_event_interval*values.current_event_num + rand(-1*values.max_event_offset, values.max_event_offset)


else


values.skip_time = values.total_runtime


...


insert(counter.SkipEvent_Time, values.skip_time, values.current_event_num)



This excerpt generates the pseudo-random times for the skipping of the Mackworth clock and stores it in the SkipEvent_Time counter.  The variables used in the calculation of the skip times are pre-defined in an earlier portion of the code.


Now, I want to add another variable called sign_time.  I want the values of sign time to be always let's say 0 to 3 seconds before the values of the skip time.  I tried simply entering another line inside the if-statement for what values.sign_time would be, and also adding a SignEvent_Time counter to store the respective sign times.  This looks something like the following:




<trial GeneralSkipTimes>


/ ontrialbegin = [


if ( values.current_event_num <= values.total_skip_events)


values.skip_time = values.avg_event_interval*values.current_event_num + rand(-1*values.max_event_offset, values.max_event_offset)


values.sign_time = values.skip_time - rand(0,3000)


else


values.skip_time = values.total_runtime


values.sign_time = values.total_runtime


...


insert(counter.SkipEvent_Time, values.skip_time, values.current_event_num);


insert(counter.SignEvent_Time, values.sign_time, values.current_event_num);




Is this even possible to do?  Or am I not using the if-else-statement correctly here?  I am assuming like in any other programming language that you can have multiple lines of code within if-else-statements.  Am I missing maybe a delineator?  I know this doesn't work, I've already tried it.  But I'd like to know if the error lies in this particular section of the code, or some place else.  Maybe someone can give me some insights here.



Thanks


-pprat


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

The correct syntax is


/ ontrialbegin = [if (expression) {expression; expression; ...} else {expression; expression; ...}]


Regards,


~Dave


pprat
pprat
Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)Partner Member (614 reputation)
Group: Forum Members
Posts: 26, Visits: 1

If I have this within a trial:



/ stimulusframes = [1=flashmark; 2=picture]


/ trialduration = 500



Then, should the 2 stimuli be appearing for as long as the specified trial duration?


I am having trouble with the picture stimulus.  The flashmark appears to be appearing for the specified time.  However, the picture sometimes appears for exactly the specified time, and other times the picture only flashes and immediately disappears.  I am not sure what is causing this.  Any ideas?



Thanks


- Popa


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

/ stimulusframes = [1=flashmark; 2=picture]


means 'flashmark' will be drawn to the screen in the trial's 1st display frame, 'picture' will be drawn to the screen in the 2nd frame.


/ trialduration = 500


means the trial will last a fixed duration of 500ms.


Whether stimuli will be erased upon response or not  (and consequently be visible for the entire duration or not) depends on their /erase setting as well as the trial's /responseinterrupt setting. See the documentation for those attributes for details. Also see the "How to erase stimuli" and the "How to control trial duration and inter-trial intervals" topics in the Inquisit documentation.


Regards,


~Dave


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search