Пример #1
0
    def __init__(self):
        shape1, shape2 = sg.sample_shape(2)
        objs1 = tg.Select(shape=shape1, when=sg.random_when())
        objs2 = tg.Select(shape=shape2, when=sg.random_when())
        color11 = tg.GetColor(objs1)
        color21 = tg.GetColor(objs2)
        color12, color22 = sg.random_color(), sg.random_color()
        if random.random() > 0.5:
            bool1 = tg.IsSame(color11, color12)
        else:
            bool1 = tg.IsSame(color11, color12)
        if random.random() > 0.5:
            bool2 = tg.IsSame(color21, color22)
        else:
            bool2 = tg.IsSame(color21, color22)

        self._operator = tg.And(bool1, bool2)
Пример #2
0
 def __init__(self):
     objs1 = tg.Select(color=sg.random_color(), when=sg.random_when())
     a2 = sg.random_shape()
     a1 = tg.GetShape(objs1)
     if random.random() > 0.5:
         self._operator = tg.IsSame(a1, a2)
     else:
         self._operator = tg.IsSame(a2, a1)
Пример #3
0
    def testGetGuessObjsetShouldBe(self):
        objset = sg.ObjectSet(n_epoch=10)
        objs = tg.Select(when='now')
        task = tg.Task(tg.GetColor(objs))

        for epoch_now in range(10):
            color = sg.random_color()
            objset = task.guess_objset(objset, epoch_now, should_be=color)
            o = objset.select(epoch_now, when='now')[0]
            self.assertEqual(color, o.color)
Пример #4
0
    def __init__(self):
        shape1, shape2 = sg.sample_shape(2)
        when1 = sg.random_when()
        a2 = sg.random_color()
        color1, color2 = sg.sample_color(2)

        objs1 = tg.Select(shape=shape1, when=when1)
        a1 = tg.GetColor(objs1)

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

        objs2 = tg.Select(color=color1, shape=shape2)
        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)
Пример #5
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
Пример #6
0
 def __init__(self):
     self._color1 = sg.random_color()
     objs1 = tg.Select(color=self._color1, when='now')
     shape1 = tg.GetShape(objs1)
     objs2 = tg.Select(color=self._color1, shape=shape1, when='last1')
     self._operator = tg.Exist(objs2)
Пример #7
0
 def __init__(self):
     color1 = sg.random_color()
     shape1 = sg.random_shape()
     when1 = sg.random_when()
     objs1 = tg.Select(color=color1, shape=shape1, when=when1)
     self._operator = tg.Go(objs1)
Пример #8
0
 def __init__(self):
     objs1 = tg.Select(color=sg.random_color(), when='now')
     self._operator = tg.Exist(objs1)
Пример #9
0
 def __init__(self):
     when = sg.random_when()
     color = sg.random_color()
     objs1 = tg.Select(color=color, when=when)
     self._operator = tg.GetShape(objs1)