Howdy, Stranger!

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

Supported by

[solved] correct variable is "undefined" and acc variable is "0"

edited June 2014 in OpenSesame

Hello,

I just created a new OpenSesame experiment which calls only four different JPEGs and has two correct response keys. I created a loop with a sequence for it so it can call every trial randomly. The order in the sequence is:
fixation dot, JPEG, keyboard response, logger, and tone. (The tone should only occur when the subject presses the incorrect key, so I have it set as "run if [correct]=0")

When I run the experiment, everything seems to run smoothly except for the fact that the tone isn't occurring. But then I pull up the CSV file to look at the data, and the [correct] variable is marked as "undefined" for every trial and the [accuracy] variable is marked as "0" for every trial. Because it's not collecting the [correct] variable, the tone cannot sound. It does record which response (key) you are making and which one is the correct response for the trial. It also seems to be collecting response time correctly.

I looked at the logger, and the source for the [correct] variable, the [acc] variable, and the [response_time] variable is the keyboard response.

I'm not really sure why it is saying the [correct] variable is "undefined" and [acc] is "0" every time.
If you could help us, that would be great. Thanks!

Comments

  • edited 5:43AM

    Hi,

    Could you make sure that there is one (and only one!) correct response listed in the keyboard_response item?

    If you require multiple responses to be correct, please use the following code in the Run phase of an inline_script placed directly after the keyboard_response:

    # check if the response is the same as correct response 1
    if self.get("response") == self.get("corresp1"):
        exp.set("correct", 1)
    # check if the response is the same as correct response 2
    elif self.get("response") == self.get("corresp2"):
        exp.set("correct", 1)
    # if the response is not one of the correct responses, set correct to 0
    else:
        exp.set("correct", 0)
    

    This inline_script assumes that you have defined the correct responses in two variables in your loop: corresp1 and corresp2.

    Good luck!

  • edited 5:43AM

    Thanks! That worked for correct, but the acc variable is still saying "0" every time. Is there any way to fix that too?

  • edited 5:43AM

    Yes, there is. This will require some manual bookkeeping, but we will rely on some variables OpenSesame creates and updates behind the screens:

    # check if the response is the same as correct response 1
    if self.get("response") == self.get("corresp1"):
        exp.set("correct", 1)
    # check if the response is the same as correct response 2
    elif self.get("response") == self.get("corresp2"):
        exp.set("correct", 1)
    # if the response is not one of the correct responses, set correct to 0
    else:
        exp.set("correct", 0)
    
    # increase the total amount of responses by one
    self.experiment.total_responses += 1
    # if the response was correct, increase the amount of correct responses by one
    if self.get("correct") == 1:
        self.experiment.total_correct += 1
    # calculate the accuracy
    self.experiment.acc = 100.0 * self.experiment.total_correct / self.experiment.total_responses
    # save the accuracy under the two variables OpenSesame saves it to
    exp.set("acc", self.experiment.acc)
    exp.set("accuracy", self.experiment.acc)
    

    Good luck!

  • edited 5:43AM

    It worked :) thanks for all your help, Edwin!

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