<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
{font-family:"Trebuchet MS";
panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>A quick look, but I think that you pretty much nailed it: it can take quite long to do any canvas operation. Given that your screen refresh rate presumably isn’t more than 100 Hz (and in any ways, your foveal vision isn’t), I don’t see the problem? Indeed, if you were to draw many things to the main canvas, one after the other, then indeed, it gets to be a problem, but as long as the only operation is copying a “preloaded” canvas to the shown one, it doesn’t matter all that much. Notice, given that you’re not using E-Prime’s stimdisplays, it’s not clear at what time the stimulus is actually displayed – only when it’s done sending the command. I think it’s generally better for critical timing aspects of your experiment to avoid canvas as much as possible. Personally, I think “critical timing” is when it concerns a subliminal vs barely supraliminal prime or some such, for other types of stimuli the 10 ms of (constant, therefore presumably stimulus independent) delay is of trivial concern.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Just testing some of it myself, and I get values ranging between 15 and 17 – which is funny, given that my refresh rate is indeed 60, so it seems a bit like there’s some sort of display.waitforverticalblank built into canvas.copy. Curiously, this:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>For j = </span><span style='font-size:10.0pt;font-family:"Courier New";color:purple'>1</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> To </span><span style='font-size:10.0pt;font-family:"Courier New";color:purple'>100</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> DrawFixation ‘this is just a custom function drawing a line to cnvsnext<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> cnvs.copy cnvsnext<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> display.waitforverticalblank<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> debug.print clock.read - clocktime <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> clocktime = clock.read<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:black'>Next j<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gives me latencies equal to refresh rates (+- 1 ms).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Whereas:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>For j = </span><span style='font-size:10.0pt;font-family:"Courier New";color:purple'>1</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'> To </span><span style='font-size:10.0pt;font-family:"Courier New";color:purple'>100</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> DrawFixation ‘this is just a custom function drawing a line to cnvsnext<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> display.waitforverticalblank<o:p></o:p></span></p><p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'>cnvs.copy cnvsnext<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> debug.print clock.read - clocktime <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:black'> clocktime = clock.read<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:black'>Next j<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gives me latencies equal to 2xrefresh rates. Somebody with young eyes should tell us if the first one doesn’t have cutting-off errors, otherwise I’d suggest there might be some sort of waitforverticalblank built into canvas.copy.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Michiel Sovijärvi-Spapé<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Helsinki Institute for Information Technology<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Aalto & University of Helsinki<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Finland<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>BTW: notice that using debug.print also incurs a delay (last measured at 0.7 ms).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> e-prime@googlegroups.com [mailto:e-prime@googlegroups.com] <b>On Behalf Of </b>Tamar<br><b>Sent:</b> 24. April 2013 08:33<br><b>To:</b> e-prime@googlegroups.com<br><b>Subject:</b> Canvas.Copy is taking too long to complete<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Trebuchet MS","sans-serif";color:black;background:white'>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...<br><br>Here is the relevant piece of code:<br><br>====== in an initializing inline script, at the begining of SessionProc: ======<br>Set MainCanvas = Display.Canvas<br>MainCanvas.fillColor = CColor(background_color)<br>MainCanvas.clear<br><br>For i = 1 To NumStim<br> Set StimCanvases(i) = Display.CreateCanvas<br><br> 'define destination rect as center of screen<br> destRects(i).Left = Display.XRes/2-stim_w/2<br> destRects(i).Top = Display.YRes/2-stim_h/2<br> destRects(i).Right = Display.XRes/2+stim_w/2<br> destRects(i).Bottom = Display.YRes/2+stim_h/2<br> <br> 'define source rect as upper left corner<br> srcRects(i).Left = 0<br> srcRects(i).Top = 0<br> srcRects(i).Right = stim_w<br> srcRects(i).Bottom = stim_h<br> <br> 'Load the image file<br> StimCanvases(i).LoadImage "Stimuli/" & FileNames(i) & ".bmp"<br> <br>Next i<br><br>====== in the inline of TrialProc: =======<br>Debug.Print "1:" & clock.read<br>StartTrialTime = clock.read<br>n = c.GetAttrib("CanvasNum")<br>c.SetAttrib "TrialStart", StartTrialTime<br>display.WaitForVerticalBlank<br>Debug.Print "4:" & clock.read<br>StartStimTime = clock.read<br>c.SetAttrib "StimStart", StartStimTime<br>Debug.Print "5:" & clock.read<br>mainCanvas.copy StimCanvases(n),srcRects(n),destRects(n)<br>Debug.Print "6:" & clock.read<br><br><br>I've tried a few things: <br>- 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.<br>- to present other simple canvases instead of my real stimuli (just a fixation, for example. or an empty canvas)<br>- to draw something on the mainCanvas rather than copy a new canvas to it (e.g. mainCanvas.Circle).<br><br>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...<br><br>Am I missing something here?...<br><br>Thanks,<br>Tamar</span><o:p></o:p></p><p class=MsoNormal>-- <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 <a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br>To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<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> <o:p></o:p></p></div></body></html>
<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 />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
<br />
<br />