Howdy, Stranger!

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

Supported by

Post-error slowing script in Opensesame

Hi everyone!

I am designing a mental arithmetic task consisting of additions and subtractions, with 7 blocks of ascending difficulty (each block containing both additions and subtractions). As I am trying to examine the emergence of post-error slowing, I want to write an inline script into the experiment to automatically create the post-error and post-correct RT averages for me. So, my script needs to do the following: If a trial's accuracy is 0 or 1 and the accuracy of the previous trial (needs to be in the same block) is 0, this is a post-error trial. If a trial's accuracy is 0 or 1 and the accuracy of the previous trial (needs to be in the same block) is 1, then this is a post-correct trial. Make an average of the RTs of all post-error and post-correct trials for each block (so, one average post-error and one average post-correct for every block). Then, subtract the post-correct average RT from the post-error average RT for every block. This score is the post-error slowing score for each block.".

I know, it's a mouthful! I have tried to do it with this script (photos below), and although it runs correctly with no error messages and the experiment finishes, it doesn't create for me the variables I need.


Any help is much appreciated!


Thank you!

Tryfonas


Comments

  • Hi Tryfonas,

    I am a bit confused about your code. It looks like you are computing the slowing after the experiment has completed (you read the data file). If so, I wonder why you use Opensesame for the computation and not regular python. If you do it during the experiment it is a bit weird that you don't just live update the variables you need on every trial. The principle is pretty much the same as you do, but without the loops (essentially adding relevant information to lists that you initialize every block).

    The reason that your variables don't appear in the logfile could be that you don't include them in the logger. Do you make those computations before or after the logger? If this is not the case, what version of Opensesame do you use? If it is slightly outdated (<4), you would need to add var. before the variables that you want to be logged.

    If none of this is the case, I would need more information on your experiment. Perhaps you could share it?

    Eduard


    ps. You can make your code much more efficient using Pandas operation. This here does essentially the same as your code:

    import pandas as pd
    df = pd.read_csv(data_file)
    df['prev_correct'] = df.groupby('block_no')['correct'].shift(1)
    block_agg = df.groupby(['block_no', 'prev_correct'])['resp_time'].mean()
    pes = block_agg['prev_correct'].reset_index()
    pes_per_block = (pes.loc[pes.prev_correct == 0, 'resp_time'].values - 
                     pes.loc[pes.prev_correct == 1, 'resp_time'].values
                     ) 
    total_agg = block_agg.groupby(['prev_correct'])['resp_time'].mean()
    


    Buy Me A Coffee

  • Hi Eduard! Thanks for the quick and informative response!


    I thought it would be easier for me to collect the data after the experiment was finished; it didn't occur to me I could do it live. If I understand correctly, I could do it live by incorporating an in-line script into the trial sequence executing the code you showed, minus line 2 and the df prefix in every line (just by introducing the variable I want to create, e.g., prev_correct). Is my assumption correct?

    As for data logging, I am logging all variables but have put my inline script after the logger, so this could be the reason I am having an issue. I am using OpenSeame 4.0.24


    Thanks again for the input!

  • edited September 13


  • I have uploaded my experiment with tirals only for the practice block and block 1, because otherwise it was too large. I am uploading it purely as an experiment structure aid.


    Thanks!

  • Hey,


    As for data logging, I am logging all variables but have put my inline script after the logger, so this could be the reason I am having an issue

    So, is this it? Does your script work if you move back the logger?

    If you want to keep track of information on trial n-1. You need to start those lists before a block start

    rt_prev_correct = []
    rt_prev_incorrect = [] 
    

    Then, during the trial, as soon as you have your response, you can do:

    if prev_correct:
        rt_prev_correct.append(resp_time)
    else:
       rt_prev_incorrect.append(resp_time)
    prev_correct = correct
    

    Eduard

    Buy Me A Coffee

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