<span style="background-color: rgb(255, 255, 255);"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">I'm programming a visual experiment, and suffering from some timing issues. It seems that the line presenting the stimuli (canvas.copy) is considerably time consuming: 10-12 ms. I can't figure out the cause for this delay, and I would appreciate any help...</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Here is the relevant piece of code:</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">====== in an initializing inline script, at the begining of SessionProc: ======</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Set MainCanvas = Display.Canvas</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">MainCanvas.fillColor = CColor(background_color)</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">MainCanvas.clear</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">For i = 1 To NumStim</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> Set StimCanvases(i) = Display.CreateCanvas</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> 'define destination rect as center of screen</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> destRects(i).Left = Display.XRes/2-stim_w/2</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> destRects(i).Top = Display.YRes/2-stim_h/2</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> destRects(i).Right = Display.XRes/2+stim_w/2</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> destRects(i).Bottom = Display.YRes/2+stim_h/2</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> </span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> 'define source rect as upper left corner</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> srcRects(i).Left = 0</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> srcRects(i).Top = 0</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> srcRects(i).Right = stim_w</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> srcRects(i).Bottom = stim_h</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> </span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> 'Load the image file</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> StimCanvases(i).LoadImage "Stimuli/" & FileNames(i) & ".bmp"</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"> </span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Next i</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">====== in the inline of TrialProc: =======</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Debug.Print "1:" & clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">StartTrialTime = clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">n = c.GetAttrib("CanvasNum")</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">c.SetAttrib "TrialStart", StartTrialTime</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">display.WaitForVerticalBlank</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Debug.Print "4:" & clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">StartStimTime = clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">c.SetAttrib "StimStart", StartStimTime</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Debug.Print "5:" & clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">mainCanvas.copy StimCanvases(n),srcRects(n),destRects(n)</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Debug.Print "6:" & clock.read</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">I've tried a few things: </span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">- to create variables taking the values of StimCanvases(n),srcRects(n),destRects(n) in the beginning of the trial, so the mainCanvas.copy line would not need to approach the arrays.</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">- to present other simple canvases instead of my real stimuli (just a fixation, for example. or an empty canvas)</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">- to draw something on the mainCanvas rather than copy a new canvas to it (e.g. mainCanvas.Circle).</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">All of these takes 10-12 ms! (as calculated by subtracting time5 from time6). The only way I managed to get rid of the delay was to erase the entire row...</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Am I missing something here?...</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Thanks,</span><br style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;"><span style="color: rgb(0, 0, 0); font-family: 'Trebuchet MS', Arial, Helvetica; font-size: small;">Tamar</span></span><br>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe@googlegroups.com.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/e-prime/-/y5hiddEu-6oJ">https://groups.google.com/d/msg/e-prime/-/y5hiddEu-6oJ</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
<br />
<br />