Howdy, Stranger!

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

Supported by

Solution for presenting multiple stimuli

Hello,
I have a question regarding the presentation of multiple stimuli simultaneously.
I'm using Expyriment 0.8.0 with Python 2.10.12 on OSX 10.12.1 (I can also test on Windows 7 on a VM).

In my task, there is a big red circle, and participants move a cursor controlled by the mouse to reach the red circle.
So the red circle is static, whereas the cursor circle is updated at every screen flip.

How do I keep all other stimuli static, and update only the cursor?

What I have tried (mousecircle = cursor):

Option 1 : Works best with the cursor, smooth movement, but bad because everything else is cleared.

# Option 1
mousecircle.present() 

Option 2: works but now both circles are flickering strangely

# Option 2
mousecircle.present()
targetcircle.present(clear=False)  

Option 3: Using a canvas: cursor is leaving a trace behind (not cleared)

# Option 3
mousecircle.plot(canvas)
targetcircle.plot(canvas)
canvas.present()

Option 4: Here I try to restore the canvas to the default, where no cursor is drawn, but still it is leaving a trace.

# Option 4
newcanvas = canvas # Restore canvas to default, where there is just the target,  to "delete" the old cursor
mousecircle.plot(newcanvas)
targetcircle.plot(newcanvas)
newcanvas.present()

My goal is to update only the cursor (mousecircle), but not the target (targetcircle).
The solution might be easy, but I'm unable to solve it... Perhaps you can guide me in solving the problem and/or tell me how to handle multiple stimuli intelligently :)

Thank you!

My full code (I removed most irrelevant parts):

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 29 15:18:47 2016 using the 'expyriment' Python library:
Krause, F. & Lindemann, O. (2013). Expyriment: A Python library for cognitive
and neuroscientific experiments. Behavior Research Methods.
doi:10.3758/s13428-013-0390-6

"""
from __future__ import division  # so 1/3 does not give 0 in python 2.7
from expyriment import design, control, stimuli, misc, io
from expyriment.misc import constants
import numpy as np  # for tuple arithmetic

control.set_develop_mode(True)
control.defaults.window_size = (800, 600)

# EXP SETTINGS
NR_TRIALS_PER_BLOCK = 50
t_fixcross = 500
min_max_ITI = [2000, 3000]
max_trialtime = 4000
TJI = 1000  # interval

# EXP INFO
exp = design.Experiment(name="Mouse task'")

# INITIALIZE
control.initialize(exp)

# DESIGN
for deviation_type in ["no_deviation", "deviation_1", "deviation_2", "deviation_3"]:
    block = design.Block()
    block.set_factor("deviation_type", deviation_type)
    #add trials to block
    trial = design.Trial()
    block.add_trial(trial, copies=NR_TRIALS_PER_BLOCK)
    block.shuffle_trials()
    exp.add_block(block)

# STIMULI
blankscreen = stimuli.BlankScreen()
canvas = stimuli.BlankScreen()
fixcross = stimuli.FixCross()
# Mouse task
init_pos = [(-250, 0), (0, 0), (250, 0)]
col = (constants.C_BLUE, constants.C_RED, constants.C_WHITE)
startcircle = stimuli.Circle(radius=15, colour=col[0], line_width=0,
                             position=init_pos[0],anti_aliasing=None)
mousecircle = stimuli.Circle(radius=5, colour=col[2], line_width=0,
                             position=init_pos[1], anti_aliasing=None)
targetcircle = stimuli.Circle(radius=30, colour=col[1], line_width=0,
                        position=init_pos[2], anti_aliasing=None)


# preload
blankscreen.preload()
fixcross.preload()
startcircle.preload()
mousecircle.preload()
targetcircle.preload()


# TRIAL FUNCTION
def mouse_trial(cnt,trial):
    # Prepare trial
    fixcross.present()
    exp.clock.wait(t_fixcross)
    # Present screen
    exp.clock.reset_stopwatch()
    targetcircle.plot(canvas)
    canvas.present()

    while not exp.mouse.check_button_pressed(0):

        old_pos = exp.mouse.position

        # Update cursor position
        new_pos = exp.mouse.position
        mousecircle.replace(new_pos)

        # Option 1
        # mousecircle.present()

        # Option 2
        # mousecircle.present()
        # targetcircle.present(clear=False)

        # Option 3
        # mousecircle.plot(canvas)
        # targetcircle.plot(canvas)
        # canvas.present()

        # Option 4
        newcanvas = canvas 
        mousecircle.plot(newcanvas)
        targetcircle.plot(newcanvas)
        newcanvas.present()


######### START ##############
control.start(exp)

for block in exp.blocks:
    for cnt, trial in enumerate(block.trials):
            mouse_trial(cnt, trial)

####### END EXPERIMENT ########
control.end(goodbye_text="Thank you very much for participating in our experiment",
             goodbye_delay=5000)

Comments

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