Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

stimulus-onset markers in SMI .idf file

Hi,
Quick version of my question: Is there a way to merge markers in an SMI logfile into the .idf data file? (I would ask SMI if they hadn't evaporated 2 years ago; I'm hoping someone here might be able to help.)

The longer version:
For my eyetracking/ERP study, I need to synchronize the .idf data file from SMI's iViewX with Brain Products actiCHamp EEG data. I had hoped to do this with a simultaneous TTL trigger to both devices. I can send the trigger to the actiCHamp easy as pie...but I can't find a way to send it to the iViewX (you can't even add a parallel port or digital I/O card to our brilliantly built SMI workstation).

Then I noticed in Edwin's Python book the clever idea of adding a PyGaze_log item as a marker right after each stimulus onset.

But then I looked at libsmi.py ...and saw that this puts a marker in the SMI logfile, not the .idf data file.

Hence my question: Is there a way to merge logfile markers into the .idf data file?

Any ideas (short of manually entering each of the 9600 stimuli based on its timestamp) will be greatly appreciated.
--Russell

PS If you know a way to get the iViewX workstation to receive the TTL trigger, that would be great too.

Comments

  • edited February 26

    Your sync question is tricky, because with SMI I don't think it's possible to sync the clocks. However, you can definitely send timestamped markers to iViewX directly. It's in fact fairly straight-forward by adding a few lines in your libsmi.py script:

    def send_message(self, msg):
        iViewXAPI.iV_SendImageMessage(c_char_p(msg))
        # print command to debug window is optional:
        print("message: ", msg)
    

    You can then used send_message in your script where you want to send a marker instead of the log function, and it will show up in your IDF file with the SMI timestamp.

    Hope this helps!

    I just sent this as a pull request to @Edwin too, so you might see it in the master branch soon.

  • Thanks so much, Cesco and Edwin!
    I know there has been a long delay, but I'm stuck and have a very newbie question.

    When you said I can use send_message in my script, do you mean an OpenSesame inline-script item? So I would create an OS inline-script item named "stimulus_marker_script" and I would put the one-line Python instruction in the run tab of the OS GUI?

    For instance, with the code you sent in libsmi.py, and with the following in the run tab of the OS inline-script GUI

    self.send_message(stimulus_presented)

    the inline script "stimulus_marker_script" would add an SMI timestamp and the string "stimulus_presented" to the IDF file everwhere I insert it in the Open Sesame experiment?

    Sorry to be such a slow learner :/

  • You're definitely on the right track!

    If you have the latest OpenSesame release, you don't need to do anything with the code in libsmi.py, as it has since then be committed to the master branch of Pygaze.

    Indeed, wherever you want to send a marker you simply insert an inline script, and in the run tab you write:

    eyetracker.send_message("stimulus_presented")

    (Notice the minor differences with your suggested code above)

    And again correct: this message will be in your IDF file with the timestamp. Make sure to test and check like usual. :)

    Keep me posted!

Sign In or Register to comment.