Howdy, Stranger!

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

Supported by

Creating pynetstation plug-in for OpenSesame

edited January 2015 in OpenSesame

Hey developers,

I've been developing a fairly complex experiment using OpenSesame for the past few months and having a blast. The experiment includes use of EGI's EEG equipment, which I was going to use pynetstation(https://code.google.com/p/pynetstation/) in multiple inline_script items to communicate with Netstation--EGI's recording software.

Unfortunately, I got excited about making OpenSesame a permanent tool in our lab's software and decided to make a plug-in for pynetstation. The only problem is that I can't seem to get communications to work properly since I put the pynetstation code into various .py files as opposed to including the code in various inline_script files. I have a feeling the issue is that my module (or object from the module) isn't being dispersed across all the plug-in files and therefor causing problems, as I've noticed in inline_scripts modules and variables(in this case an object) are shared across all other inline_scripts. Is there a secret line of code I'm missing in your source files in order to share a single module/object? I tried to base a majority of my plug-in on your newer yaml format, but there is code mixed into the qt'plug-in' class from the pygaze, which was all json formatted, not sure if that matters.

Attached is a copy of the plug-in as it stands(some messiness at the moment due to troubleshooting/debuggin).
image

Thanks for any thoughts or advice you might have.

Also, with your help, i'll be able to send the pynetstation plug-in to you for distribution with future copies so everyone can make use of it.

Best,
Josh

Comments

  • edited 3:25AM

    Hi Josh,

    Do I understand correctly that you would like to create variables (or modules, etc.) in your plug-in that are available as globals in inline_scripts? There are two ways you can do this:

    1. You can add properties to the experiment object. So if you do self.experiment.my_var = 10 in your plug-in, people will be able to use exp.my_var in inline_script items. This is the typical way.

    2. You can add something to the Python workspace that is used by inline_script items, like so: self.experiment.python_workspace['my_var'] = 10. If you do that, my_var will become a global in inline_script items.

    Also, with your help, i'll be able to send the pynetstation plug-in to you for distribution with future copies so everyone can make use of it.

    It might be a good idea to create a GitHub repository for the plug-in?

    Hope this helps!
    Sebastiaan

  • edited 3:25AM

    Thanks Sebastiaan,

    I was able to correct my problem after reading your response. It turned out I wasn't referencing my object properly within the self.experiment object. It's all working now with bells and whistles. I set up a repository for it on my github:

    https://github.com/imnotamember/Pynetstation-Plug-In

    One more thing I was curious about is working in some more advanced GUI interface into one of my plug-in items. It is pynetstation_send_tags, and the item takes user input for variables and data to send to the EEG software as timestamped-tags. Currently, it just has 5 text fields where the user inputs the variables or literals they want to send for each tag, and I'd rather allow the user to add as many variables or literals as they wish for each tag (up to 255 as that's the limitation) and potentially have a list view of the variable inspector that they could just drag and drop variable names from to avoid the headaches of human error in typing. I looked into Pyqt 4 and Qt 4 and I see the potential, but I don't know how to take advantage of Pyqt within the confines of my plug-in's widget. Any thoughts?

    Thanks in advance for your continued support!

  • edited 3:25AM

    That's great. Once you feel that the plug-in is ready for general use, feel free to update the documentation so that it includes a reference to it. Maybe as an additional page under External devices?

    I looked into Pyqt 4 and Qt 4 and I see the potential, but I don't know how to take advantage of Pyqt within the confines of my plug-in's widget. Any thoughts?

    If you want to use PyQt4 directly, you mainly need to know that you can use self.add_widget() to add an arbitrary QWidget to the plug-in controls. After that, you're pretty much on your own, in terms of connecting signals to make sure that all changes are applied, etc.

    If you want to understand the structure of plug-in controls in more detail, you can take a look at libqtopensesame.qtitem.qtitem.init_edit_widget(). That's probably not necessary though.

    Cheers!

  • edited 3:25AM

    Dear all,

    I was trying to add the Pynestation plugins to OS as usually, adding egi,pynetstation_begin_trial, etc... (8 folders from https://github.com/imnotamember/Pynetstation-Plug-In) .Path enviroment var modified to recognize egi folder, ok.

    but when i was trying to add the pynetstation_init i got an error (Failed to load plug-in pynetstation_init). Here the result from the debug window:

    Plug-in error

    line: 80
    exception message: Failed to load plugin 'pynetstation_init'
    exception type: osexception

    Traceback:
    File "dist\libqtopensesame\widgets\tree_overview.py", line 498, in drop_event_item_new
    File "dist\libqtopensesame\misc\qtitem_store.py", line 78, in new
    File "dist\libopensesame\item_store.py", line 80, in new
    osexception:
    Failed to load plugin 'pynetstation_init'

    code: u'You should only have one instance of 'pynetstation_init' in your experiment')

    line: 59
    exception message:
    exception type: SyntaxError

    Traceback:
    File "dist\libopensesame\item_store.py", line 77, in new
    File "dist\libopensesame\plugins.py", line 331, in load_plugin
    File "dist\libopensesame\plugins.py", line 303, in import_plugin
    File "C:\Program Files (x86)\OpenSesame\plugins\pynetstation_init\pynetstation_init.py", line 59
    u'You should only have one instance of 'pynetstation_init' in your experiment')
    ^

    SyntaxError: invalid syntax

    Do you have some suggestion for this ?
    i'm grateful in advance for your reply, Pietro

  • edited June 2015

    Hey Pietro,

    I've just updated the pynetstation_init/pynetstation_init.py file. Replace the one you currently have with the updated file on github. Let me know if you have more issues.

    I made this plugin months ago and since data collection ended I stopped working on it for other projects. I fully intend to make it completely functional but haven't had a motivation yet (or time) to finish this. I will say that I ended up scrapping this on my own project as it became too complex to simply run through a plugin and I ended up just hard-coding the signals to Netstation. If you need any assistance getting this to work I'd be happy to use it as a means for updating the plug in.

    What operating system are you using? I've had terrible luck trying to get plugins working on Mac's(even though you can use them to send Netstation signals). Also, what version of Netstation are you using? I've had trouble getting Netstation 5 to work with this, but am working on it with EGI.

    Best,
    Josh

  • edited 3:25AM

    Dear Josh,
    pynetstation_init.py replacement was successful, i'm grateful for your help. My platform is win7 64bit, Netstation 4.1.1 on OSX. I'm developing some templates for our EEG labs, OS/python seems me an optimal development choice, I'll let you know: i agree about hard coding,so i will keep you informed if there are relevant developments.
    All the best, Pietro

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games