A Few Questions

Yvonne Bowman's Avatar

Yvonne Bowman

28 Jun, 2018 02:26 PM

Hi Chris,

I've got a few general questions as I'm working on the final version of the behavioral code. What we've settled on is generating a large batch of images (in MatLab) outside of the experiment and then loading what we need for each trial from that batch at the beginning of each trial. Using the code from the version that generates the images before each trial, as well as your previous email about indexing, I'm pretty sure I have a good handle on most of how to do this. However, I have a few more specific questions.

1) I see that in the case where the noise generation is happening before each trial, you unload the previous group of stimuli before loading the new one. Is this necessary? I was planning on unloading the previous group before loading the new one, like you had written it, but I was curious, as it might affect the timing a bit.

2) I've noticed in the current fixation protocol I have, it doesn't count the monkey blinking as breaking fixation. Is there a way to make MWorks recognize blinks and count them as breaking fixation? It looks different on the eye window (it looks kind of like a super fast saccade), so I assume there's a way to do this.

3) Is there a way to read part of a file name and set a variable equal to it? For instance, if the monkey breaks fixation, I want to record in a variable the number of the file that it presented last (so, if my files are named sequentially, with the first one being white_noise_image_001.tiff, how do I make MWorks save the final number of the last image it presented to a variable)?

4) If I then want to write this variable value to a text file periodically, how would I do this? For instance, if the variable is =060 at the end of trial one (because of what I would have done to set it equal to that based on my 3rd question), how would I write "060" to a text file, preferably with an identifier of that being written after trial 1, or at a specific time and date?

5) Finally, is there a way I could then read a value from that text file to use as a variable? If I end on an image file that ends with _180, and I want to start the next day (after I've had to reload the experiment) on the file that ends in _181, I was thinking the best way to do that would be to read that value from the text file and set my "start" or "pointer" variable to the last value saved and use that variable+1 as the start point of the range replicator when loading the next stimulus group.

As always, let me know if you have any alternate suggestions!

Thank you,
Yvonne

  1. Support Staff 1 Posted by Christopher Sta... on 29 Jun, 2018 02:19 PM

    Christopher Stawarz's Avatar

    Hi Yvonne,

    I see that in the case where the noise generation is happening before each trial, you unload the previous group of stimuli before loading the new one. Is this necessary? I was planning on unloading the previous group before loading the new one, like you had written it, but I was curious, as it might affect the timing a bit.

    Yes, it is necessary. In order to load a new image file in to an image stimulus, you must first unload the old one.

    As for timing, unloading is quite fast, but loading is not. The time to load a full trial's worth of full-screen images can be significant (several seconds or more), so you need to factor that in to your experiment design.

    Is there a way to make MWorks recognize blinks and count them as breaking fixation?

    MWorks receives only eye position from the EyeLink. It don't know how blinks affect the position it reports.

    Is there a way to read part of a file name and set a variable equal to it?

    If I then want to write this variable value to a text file periodically, how would I do this?

    Finally, is there a way I could then read a value from that text file to use as a variable?

    MWorks doesn't support this kind of string processing or file I/O directly, but you can easily do all of these things using Python actions and getvar/setvar.

    Cheers,
    Chris

  2. 2 Posted by Yvonne Bowman on 02 Jul, 2018 03:33 PM

    Yvonne Bowman's Avatar

    Hi Chris,

    Thanks, this is some really helpful information. I have one clarification I
    want to make that may communicate one of my questions a bit better.

    Regarding

    > MWorks receives only eye position from the EyeLink. It don't know how
    > blinks affect the position it reports.

    The eye trace on MWorks' eye window during a blink looks different from
    fixation or scanning eye movement, and looks like a very fast saccade
    offscreen - this to me supports that there must be a way to make MWorks at
    least recognize that fixation has been stopped. I understand that MWorks
    just receives eye position from the EyeLink, but this is something I'm
    seeing on the MWorks side. Is there maybe something in the eye monitor that
    would allow it to pick up on this? Perhaps adjusting the thresholds for
    saccade detection? I feel like I don't know quite enough about how saccade
    detection works to know what I might want to try changing.

    Thank you!
    Yvonne

  3. Support Staff 3 Posted by Christopher Sta... on 03 Jul, 2018 01:49 PM

    Christopher Stawarz's Avatar

    Hi Yvonne,

    The eye trace on MWorks' eye window during a blink looks different from fixation or scanning eye movement, and looks like a very fast saccade offscreen

    Ok. Looking at the source code, I see that when the EyeLink sends "empty" samples to MWorks (i.e. when no eye position is available), the eye coordinates are set to the value -32768. Do you see these values in your event file? They would be in the variables assigned to directly by the eyelink device (eye_h_raw and eye_v_raw in the protocol I wrote for you).

    If this is what's happening when the monkey blinks, then that would explain the "very fast saccade offscreen" that you've observed.

    Is there maybe something in the eye monitor that would allow it to pick up on this? Perhaps adjusting the thresholds for saccade detection?

    In the protocol I sent you, there's a "double smoothing" of the eye signal, which may be masking these brief saccades. I'm referring to this bit of the experiment:

    standard_eye_calibrator eye_calibrator (
        eyeh_raw = eye_h_raw
        eyev_raw = eye_v_raw
        eyeh_calibrated = eye_h_calibrated
        eyev_calibrated = eye_v_calibrated
        )
    
    boxcar_filter_1d (
        in1 = eye_h_calibrated
        out1 = eye_h
        width_samples = 5
        )
    
    boxcar_filter_1d (
        in1 = eye_v_calibrated
        out1 = eye_v
        width_samples = 5
        )
    
    basic_eye_monitor (
        eyeh_calibrated = eye_h
        eyev_calibrated = eye_v
        eye_state = eye_in_saccade
        width_samples = 5
        saccade_entry_speed = 60
        saccade_exit_speed = 20
        )
    

    As you can see, the values coming out of the calibrator pass through five-sample-wide boxcar filters, which output a moving average of the last five samples. These averaged values are then passed to the eye monitor, which applies its own five-sample boxcar filter.

    Since you're seeing a rapid saccade on the eye window, it's clear that the first averaging pass is not smoothing away the blink. However, the second averaging pass may be. To test this, try setting the width_samples parameter of the eye monitor to 1. (Alternatively, leave width_samples set to 5, but use eye_h_calibrated and eye_v_calibrated as the inputs to the eye monitor.)

    Chris

  4. Christopher Stawarz closed this discussion on 24 Jul, 2018 01:11 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac