コード例 #1
0
 def __init__(self):
     color1, color2 = sg.sample_color(2)
     objs1 = tg.Select(color=color1, when=sg.random_when())
     objs2 = tg.Select(color=color2, when=sg.random_when())
     a1 = tg.GetShape(objs1)
     a2 = tg.GetShape(objs2)
     self._operator = tg.IsSame(a1, a2)
コード例 #2
0
 def __init__(self):
     color1, color2, color3 = sg.sample_color(3)
     objs1 = tg.Select(color=color1, when='latest')
     shape1 = tg.GetShape(objs1)
     objs2 = tg.Select(color=color2, shape=shape1, when='now')
     self._operator = tg.Go(objs2)
     self._color1, self._color2, self._color3 = color1, color2, color3
コード例 #3
0
 def __init__(self):
     color1, color2 = sg.sample_color(2)
     objs1 = tg.Select(color=color1, when='now')
     objs2 = tg.Select(color=color2, when=sg.random_when())
     self._operator = tg.Switch(tg.Exist(objs1),
                                tg.Go(objs1),
                                tg.Go(objs2),
                                both_options_avail=False)
コード例 #4
0
 def __init__(self):
     color1, color2 = sg.sample_color(2)
     objs1 = tg.Select(color=color1, when=sg.random_when())
     loc = tg.GetLoc(objs1)
     objs2 = tg.Select(loc=loc,
                       color=color2,
                       when='now',
                       space_type=sg.random_space())
     self._operator = tg.Exist(objs2)
コード例 #5
0
 def __init__(self):
     color1, color2, color3, color4 = sg.sample_color(4)
     objs1 = tg.Select(color=color1, when=sg.random_when())
     objs2 = tg.Select(color=color2, when=sg.random_when())
     objs3 = tg.Select(color=color3, when=sg.random_when())
     objs4 = tg.Select(color=color4, when=sg.random_when())
     a1 = tg.GetShape(objs1)
     a2 = tg.GetShape(objs2)
     a3 = tg.GetShape(objs3)
     a4 = tg.GetShape(objs4)
     self._operator = tg.And(tg.IsSame(a1, a2), tg.IsSame(a3, a4))
コード例 #6
0
    def __init__(self):
        color1, color2, color3, color4 = sg.sample_color(4)
        objs1 = tg.Select(color=color1, when=sg.random_when())
        loc = tg.GetLoc(objs1)
        objs2 = tg.Select(loc=loc,
                          color=color2,
                          when='now',
                          space_type=sg.random_space())
        bool1 = tg.Exist(objs2)

        objs3 = tg.Select(color=color3)
        objs4 = tg.Select(color=color4)
        go1 = tg.Go(objs3)
        go2 = tg.Go(objs4)
        self._operator = tg.Switch(bool1, go1, go2, both_options_avail=True)
コード例 #7
0
    def __init__(self):
        color1, color2, color3 = sg.sample_color(3)
        shape3, shape4 = sg.sample_shape(2)
        when1 = sg.random_when()
        when2 = sg.random_when()

        objs1 = tg.Select(color=color1, when=when1)
        objs2 = tg.Select(color=color2, when=when2)
        s1 = tg.GetShape(objs1)
        s2 = tg.GetShape(objs2)
        bool1 = tg.IsSame(s1, s2)
        objs3 = tg.Select(color=color3, shape=shape3)
        objs4 = tg.Select(color=color3, shape=shape4)
        go1 = tg.Go(objs3)
        go2 = tg.Go(objs4)
        self._operator = tg.Switch(bool1, go1, go2, both_options_avail=True)
コード例 #8
0
    def __init__(self):
        shape1, shape2, shape3 = sg.sample_shape(3)
        color1, color2 = sg.sample_color(2)
        when1 = sg.random_when()
        when2 = sg.random_when()

        objs1 = tg.Select(shape=shape1, when=when1)
        objs2 = tg.Select(shape=shape2, when=when2)
        a1 = tg.GetColor(objs1)
        a2 = tg.GetColor(objs2)
        bool1 = tg.IsSame(a1, a2)

        objs3 = tg.Select(color=color1, shape=shape3)
        objs4 = tg.Select(color=color2, shape=shape3)
        go1 = tg.Go(objs3)
        go2 = tg.Go(objs4)
        self._operator = tg.Switch(bool1, go1, go2, both_options_avail=True)
コード例 #9
0
    def __init__(self):
        color1, color2 = sg.sample_color(2)
        objs1 = tg.Select(color=color1, when=sg.random_when())
        objs2 = tg.Select(color=color2, when=sg.random_when())
        shape11 = tg.GetShape(objs1)
        shape21 = tg.GetShape(objs2)
        shape12, shape22 = sg.random_shape(), sg.random_shape()
        if random.random() > 0.5:
            bool1 = tg.IsSame(shape11, shape12)
        else:
            bool1 = tg.IsSame(shape11, shape12)
        if random.random() > 0.5:
            bool2 = tg.IsSame(shape21, shape22)
        else:
            bool2 = tg.IsSame(shape21, shape22)

        self._operator = tg.And(bool1, bool2)
コード例 #10
0
    def __init__(self):
        color1, color2 = sg.sample_color(2)
        when1 = sg.random_when()
        a2 = sg.random_shape()
        shape1, shape2 = sg.sample_shape(2)

        objs1 = tg.Select(color=color1, when=when1)
        a1 = tg.GetShape(objs1)

        if random.random() > 0.5:
            bool1 = tg.IsSame(a1, a2)
        else:
            bool1 = tg.IsSame(a2, a1)

        objs2 = tg.Select(color=color2, shape=shape1)
        objs3 = tg.Select(color=color2, shape=shape2)
        go1 = tg.Go(objs2)
        go2 = tg.Go(objs3)
        self._operator = tg.Switch(bool1, go1, go2, both_options_avail=True)
コード例 #11
0
    def generate_objset(self, n_epoch, n_distractor=1, average_memory_span=2):
        if n_epoch < 4:
            raise ValueError(
                'Number of epoch {:d} is less than 4'.format(n_epoch))
        objset = sg.ObjectSet(n_epoch=n_epoch)

        n_sample = 2
        sample_colors = sg.sample_color(n_sample)
        for i in range(n_sample):
            obj = sg.Object([sample_colors[i], self._shape1], when='now')
            objset.add(obj, epoch_now=1)

        obj = sg.Object([sg.another_shape(self._shape1)], when='now')
        objset.add(obj, epoch_now=1)  # distractor

        if random.random() < 0.5:
            color3 = random.choice(sample_colors)
        else:
            color3 = sg.another_color(sample_colors)
        test1 = sg.Object([color3, self._shape1], when='now')
        objset.add(test1, epoch_now=3)  # test epoch
        return objset
コード例 #12
0
    def generate_objset(self, n_epoch, n_distractor=1, average_memory_span=2):
        """Generate object set.

    The task has 4 epochs: Fixation, Sample, Delay, and Test.
    During sample, one sample object is shown.
    During test, two test objects are shown, one of them will match the color
    of the sample object

    Args:
      n_epoch: int

    Returns:
      objset: ObjectSet instance.

    Raises:
      ValueError: when n_epoch is less than 4,
          the minimum epoch number for this task
    """
        if n_epoch < 4:
            raise ValueError(
                'Number of epoch {:d} is less than 4'.format(n_epoch))
        color1, color2 = sg.sample_color(2)
        color3 = sg.random_color()

        objset = sg.ObjectSet(n_epoch=n_epoch)

        sample1 = sg.Object([color1, self._shape1], when='now')
        distractor1 = sg.Object([color3, self._shape3], when='now')
        test1 = sg.Object([color1, self._shape2], when='now')
        test2 = sg.Object([color2, self._shape2], when='now')

        objset.add(sample1, epoch_now=1)  # sample epoch
        objset.add(distractor1, epoch_now=2)  # delay epoch
        objset.add(test1, epoch_now=3)  # test epoch
        objset.add(test2, epoch_now=3)  # test epoch
        return objset
コード例 #13
0
 def __init__(self):
     color1, color2 = sg.sample_color(2)
     objs1 = tg.Select(color=color1, when=sg.random_when())
     shape1 = tg.GetShape(objs1)
     objs2 = tg.Select(color=color2, shape=shape1, when='now')
     self._operator = tg.Exist(objs2)