Howdy, Stranger!

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

Supported by

Inline python command to draw text stimuli to search display


I'm working on coding a distraction task where participants are to ignore the letter distractor and respond to the integer target (0-9) as being odd or even. I have the code for another program in my lab that used circle and square stimuli, but I'm having difficulty converting it to get my randomly selected digit and/or letter to appear on the screen at a random location of 10 options around a circular shape. I'm pretty new to OpenSesame, but I've been playing with this code for over a month now on and off and figure now's a great time to seek help.

Here's my lists I define as constants at the beginning.

target_dig = ['0','1','2','3','4','5','6','7','8','9'] # change to target digits

#creates list of uppercase alphabet to be used as distractor stimuli
distract_stim = list(string.ascii_uppercase)

# Distractor presence
distractor = ['present','absent']

Then the functions I have in another script after just to select the digit/letter and choose distractor location.

def calculate_distractor_position(row):
	if row.distractor == 'present':
		# just randomly choose a distractor location that's not the target location
		distractor_pos = random.choice(list(set(positions) - {row.target_pos}))
		distractor_pos = None
		return distractor_pos 

def draw_distr(row):
	if row.distractor == 'present':
		distr = random.choice(distract_stim)
		return distr

def draw_target(cnvs, x, y):
	stim = random.choice(target_dig)
	return stim

And then in the actual trial_sequence script in the trial loop, the creation of the canvas with the supposed functions.

# determining target position and color
var.target_pos = row.target_pos
var.target_color = row.target_color

# setting distractor color and position different from target 
var.distractor = row.distractor
if var.distractor == 'present':
	var.distractor_pos = row.distractor_pos
	var.distractor_color = list(set(colors)-set([var.target_color]))[0]
	var.distractor_pos = None
	var.distractor_color = None

# creating canvas 

target_canvas = stimuli.Canvas(size=(1024,768))

for pos, (x, y) in enumerate(xy_circle(set_size, eccentricity)):
	if pos == var.target_pos:
		draw_target(target_canvas, x, y) 
	elif pos == var.distractor_pos:
		draw_distr(target_canvas, x, y, color=var.distractor_color)

The functions seem simplistic, but I think they should work fine in actually selecting the random letter or digit, but it's the display of the stimuli around a circle I'm really having issues with. There's a lot of code in between all of these but this is the most relevant to the main issue and at this point I'll take any advice there is to offer. Thanks!!!


  • Additional: It runs with the instructions and fixation cross through trials, but there's no stimuli that show up to respond to. Python also keeps crashing during these runs, so I only get to go through a few trials at a time before it does. It's been crashing on two different devices at various timepoints whenever I try to quick run .

  • Hi,

    Your drawing function does no drawing, but target selection. Use these two functions instead:

    def select_target(target_dig):
        stim = random.choice(target_dig)
        return stim
    def draw_target(cnvs, x, y,text):

    Does that help?

    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 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