Howdy, Stranger!

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

Supported by

[solved] Display rt in Feedback

edited February 2013 in OpenSesame

Hi,

I have a very basic question.

If I want to display the trial response time in my feedback, how do I do it?
For instance:

draw textline 0 -164 "Temps4: [avg_rt]" 

is working

But

draw textline 0 -164 "Temps4: [response_time]

is not (and I want the response time for the current trial)

I tried everything I could think about:
draw textline 0 -164 Temps1: [exp.get(response_time)]
draw textline 0 -164 Temps1: [exp.get(response_time_keyboard_response)]
etc.

Unfortunately nothing worked...

Best regards,

Comments

  • Hi Boris,

    In your second piece of OpenSesame code

    draw textline 0 -164 "Temps4: [response_time]

    you don't end the to-be-displayed string with double quotes. It should be:

    draw textline 0 -164 "Temps4: [response_time]"

    Could that just be it? Or is that a typo in the forum post and not in your actual script?

    Another thing that comes to mind is that you're trying to use a sketchpad item (rather than a feedback item) to display the trial response feedback. A sketchpad is constructed during the prepare phase of the trial sequence, and its content can therefore not depend on what happens later on in the sequence (e.g. during response collection). Feedback items, on the other hand, are constructed during the run phase of the sequence and therefore can depend on values (such as 'response' and 'response_time') that are collected just before.

    If those suggestions do not solve your problem, don't hesitate to post again!

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 3:21PM

    Another thing that comes to mind is that you're trying to use a sketchpad item (rather than a feedback item) to display the trial response feedback. A sketchpad is constructed during the prepare phase of the trial sequence, and its content can therefore not depend on what happens later on in the sequence (e.g. during response collection). Feedback items, on the other hand, are constructed during the run phase of the sequence and therefore can depend on values (such as 'response' and 'response_time') that are collected just before.

    That was the crucial point ! As sketchpad are very often used in the examples, I used sketchpads and this was my mistake...

  • edited 3:21PM

    Another problem is that when I want to store the "response_time" in a variable in an inline (even in the "Run Phase" tab), it is not possible...
    For instance

    Somme = Somme + response_time

    is returning:
    NameError: name 'response_time' is not defined
  • edited February 2013

    Hi boris,

    variables in your loop tables, or feedback variables like response_time are set in self.experiment. They are not immediately accessible within your inline_script items, but you can 'get' and 'set' them using the experiment object

    rt = self.experiment.get("response_time")
    somme = somme + rt
    

    or

    exp.get("response_time") # you can use exp, instead of self.experiment
    somme += rt # x += 1 is equivalent to x=x+1
    

    Note that if you want 'somme' to be available throughout the experiment as well, you should consider setting it using exp.set(), or defining it as global.

    see: http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements/#getting-and-setting

  • edited February 2013

    I think I found a solution to the previous problem

    This code is passing (but I do not know if Somme is correctly update)

    Somme = Somme + self.get('response_time')

    Then, at the end of the block I compute

    global CountMot, Somme, Moy

    Moy = Somme / CountMot

    And , finally in my feedback I'd like to display Moy but that is not possible
    OS is returning:

    Description: Variable 'Moy' is not set in item 'feedback'.

    My script is there:
    https://docs.google.com/file/d/0B-sE9ac1ksCAS3V1Q3NtU1ZIcDA/edit?usp=sharing

  • Hi,

    Making variables global is only useful for future use within another inline_script item. For future use of a given variable in the interface (such as feedback items, but also, importantly, your logger item), you should set the variable like so:

    exp.set("moy", moy)

    After doing so, the square-bracket method in the interface will work.

    As Wouter also pointed out, more info about getting and setting variables can be found here:

    Does this help?

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 3:21PM

    It works perfectly. Thank you very much !

    The idea that you need to separate "inline" and "graphical interface" is not easy to get for beginners...

    Then I had a new very naive problem:
    I want to have an "if statement" in my inline

    I wrote:


    global CountMot, Somme, Moy, CountJuste
    Somme = Somme + self.get('response_time')
    CountMot = CountMot + 1 if exp.get('correct') == 1
    CountJuste = CountJuste + 1

    and got
    SyntaxError: invalid syntax on my if statement
    I tried various things but nothing worked.

  • Hi Boris,

    The first line of your if-statement should end with a colon, like so:

    if exp.get('correct') == 1:

    For more info on conditional statements in Python, see:

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 3:21PM

    Thank you !

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