fixed timing
fixed timing

I noticed that the timing had gotten off: having the core.wait at the
end of the loop, so that there was both an update of the
stimuli (setting grating.image = imagetools.array2image(stim)) and draw
commands between it and the flip meant that things were not quite lining
up correctly: the ON blocks were regularly too short, while the OFF
blocks were regularly too long (by about 30 msecs each).

to fix this, the wait command gets moved to the beginning of the loop,
right before the flip command, but that requires a bit of re-arranging
to correctly handle the first image. we need to pre-load the setting of
their contents and draw them while we're waiting for the scanner trigger
and then specificaly *not* update, draw, or wait during the first
time through the loop (note that for that to work, stimuli is no longer
an iter but a regular array again, since if it's an iter we can't access
the first value twice, which we effectively do by pre-loading it and
then going through its loop).

we also make sure to record the start of the scan and time everything
relative to that instead of timing to the first stimuli going on

billbrod/spatial-frequency-preferences,billbrod/spatial-frequency-preferences,billbrod/spatial-frequency-preferences