![]() ![]() exit ( "Unknown condition number" ) sfm_y_pos = np. exit ( "Data path " + data_path + " already exists!" ) responses = sfm_size_pix = 200 sfm_dot_size_pix = 5 sfm_n_dots = 1000 sfm_dot_shape = "gauss" if cond_num = "1" : sfm_speed_rev_per_s = 0.2 elif cond_num = "2" : sfm_speed_rev_per_s = 0.1 else : sys. data data_path = subj_id + "_cond_" + cond_num + "_rep_" + rep_num + ".tsv" if os. Import os import sys import numpy as np import psychopy.visual import psychopy.event import psychopy.gui gui = psychopy. This is because we will use a cosine function to transform the phase value into a position value during presentation. Rather than giving each dot a random position in pixels, we give it a random phase between 0 and 2 pi. We also set the horizontal position of each dot in the cylinder ( sfm_x_phase) to a random value, but indirectly. Here, we first set the vertical position of each dot in the cylinder ( sfm_y_pos) to a random value. The specifics on how a structure-from-motion cylinder is created will, however, be new. The above should be mostly familiar from the Drawing to a window and Drawing-dots lessons. ElementArrayStim ( win = win, units = "pix", nElements = sfm_n_dots, elementTex = None, elementMask = sfm_dot_shape, sizes = sfm_dot_size_pix ) win. Window ( size =, units = "pix", fullscr = False ) sfm_stim = psychopy. uniform ( - sfm_size_pix / 2, + sfm_size_pix / 2, sfm_n_dots ) sfm_x_phase = np. ![]() Import os import sys import numpy as np import psychopy.visual import psychopy.gui gui = psychopy. We will consider each of the components of the experiment creation framework in turn, building up the code for the example experiment as we go. The independent variable will be the rotational speed of the cylinder (either 0.2 or 0.1 revolutions per second) and the dependent variable will be the frequency at which the percept of the cylinder switches. We will be using a structure-from-motion stimulus, in which changes in local dot speed give the impression of a rotating cylinder. In this experiment, we are interested to understand whether the speed at which an ambiguous figure rotates affects how often its perceptual interpretation switches. We are going to examine the framework in the context of an example experiment. Note that these assume that you have already decided on the experiment’s question and hypothesis, its independent variable(s), its dependent variable(s), and its design. Once these components are in place, there is a very natural translation of their requirements into Python code. We are going to investigate a framework that you can use to think about the key components of your experiment. Hence, we need to consider precisely what it is that we want to happen during an experiment. However, a very important thing to keep in mind is that the experience of an experiment is almost completely separate from its implementation. You now have a set of skills that mean there are very few technical impediments to running the experiment that you want to run. Here, we are going to investigate how we can put all these components together in order to actually implement an experiment. ![]() ![]() Be able to follow a worked example of a complete experiment implemented in Python.Īcross the series of previous lessons, we have covered a lot of the mechanics that go into creating a vision science experiment using Python and psychopy.Be able to use a framework to guide experimental design and implementation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |