Howdy, Stranger!

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

Supported by

Limiting the number of presentations of the stimulus in a stimulus set

edited June 2023 in OpenSesame

Hello everyone,


I present a total of 5 stimuli in each trial from the high_arousal list and 1 stimuli from the neutral list in an invisible circle. My goal is to have a total of 12 trials. There are 30 photos in the high_arousal list and 12 in the neutral list. For the high_arousal list, each photo needs to be presented 2 times in total. In the Neutral list, I want the stimulus once presented and not to be presented again. I wrote various codes for this, but the codes I wrote do not work. I would be very grateful if you could help me to understand and solve the problem in my code. Since the experiment file is large, It is attached it with the Google Drive link.


Thanks in advance.


selected_high_arousal_images = []

limit = 2 * len(high_arousal)

completed_trials = 0


def select_high_arousal_image(high_arousal, selected_images, limit):

available_images = [img for img in high_arousal if img not in selected_images]

selected_image = random.choice(available_images)

selected_images.append(selected_image)

if selected_images.count(selected_image) > 2:

selected_images.remove(selected_image)

if len(selected_images) > limit:

selected_images.pop(0)

return selected_image


def select_neutral_image(neutral, selected_images):

available_images = [img for img in neutral if img not in selected_images]

selected_image = random.choice(available_images)

selected_images.append(selected_image)

return selected_image


while completed_trials < 12: # 12 deneme tamamlanana kadar döngü devam eder

selected_high_arousal_images = []

selected_neutral_images = []


# High arousal fotoğraflarını seç ve işlemleri yap

var.img2 = select_high_arousal_image(high_arousal, selected_high_arousal_images, limit)

var.img3 = select_high_arousal_image(high_arousal, selected_high_arousal_images, limit)

var.img4 = select_high_arousal_image(high_arousal, selected_high_arousal_images, limit)

var.img5 = select_high_arousal_image(high_arousal, selected_high_arousal_images, limit)

var.img6 = select_high_arousal_image(high_arousal, selected_high_arousal_images, limit)


# Neutral fotoğraf seç ve işlemleri yap

var.img1 = select_neutral_image(neutral, selected_neutral_images)


completed_trials += 1

https://drive.google.com/file/d/1gtaGi76M6_cCewP6sCgXhR9FrVss_j3D/view?usp=sharing

Comments

  • Hi @bssengul,

    If I understand your design correctly, a simpler method would be to create a matrix where you store the names of the 60 (30x2) high arousal picture, shuffle it, then read from that matrix on every trial. Same idea with the 12 neutral pictures. Saves you from having to count how many times each picture has been used.

    Best,

    Fabrice.

    Buy Me A Coffee

  • Thank you, I also thought about it but it creates probability of showing same images in a same trial.

  • Hi @bssengul,

    You're right, this is a slight difficulty, but it can be addressed using code making shure that the shuffling is repeated until there no repetition of the same high arousal picture among successive groups of 5 elements. Here's some Python code that does just that. Once the higharousla list is produced, then you just have to keep a counter going in your trial sequence to pull out the elements from that list as the task progresses, and you shouldn't get any repetition of the same picture with the same trial.

    import random
    
    # Create the base lists
    higharousal_base = [f'high_arousal{i}.jpg' for i in range(1, 31)]
    neutral_base = [f'neutral{i}.jpg' for i in range(1, 13)]
    
    # Duplicate the higharousal list
    higharousal = higharousal_base * 2
    
    # Function to check if there is a repetition in a sublist
    def has_repetition(lst):
        return len(lst) != len(set(lst))
    
    # Shuffle higharousal until there's no repetition every five elements
    while True:
        random.shuffle(higharousal)
        if all(not has_repetition(higharousal[i:i+5]) for i in range(0, len(higharousal), 5)):
            break
    
    # Now we shuffle the neutral list
    neutral = neutral_base[:]
    random.shuffle(neutral)
    
    # Print to verify
    print(higharousal)
    print(neutral)
    

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Thank you much! I appreciate your help.



    Best regards,

    Beril

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