コード例 #1
0
ファイル: PaintingFeedback.py プロジェクト: dedan/poly_burst
    def preparePolyDecomp(self, polyIndex):
        """ modifies the list of polygons saved in the objects of the self.listOfPolies.

        self.listOfPolies is a list of ManyPoly objects. It is initialized with an empty
        list. When target and non-target polygons are loaded, they are done so in a given
        element of listOfPolies, so that later these elements are collapsed into
        self.outPoly (wihch if the element which is actually displayed). This way, we
        can keep the right superposition of polygons.

        As a polygon is fixed in the background, its tesselation remains for ever loaded
        in one of the elements of self.listOfPolies. This element is not modified anymore.

        mp is the element of self.listOfPolies which is being modified (i.e. where the
        currently varying stimulus is loaded).
        """

        toDraw = self.polygonPool[self.stimNumber-1][polyIndex[self.stimNumber]]

        newPolyList = []
        for pol in toDraw:
            # Load and resize:
            rPol = H.resizePol(pol, w=self.pic_w, h=self.pic_h)
            p = Poly(color=rPol['color'],
                     orientation = 0.0,
                     points = rPol['points'],
                     position = (self.width/2, self.height/2),
                     size=(self.width, self.height))
            # Add to the list of polies to be displayed:
            newPolyList += [p]

        # Set the list of polies into the target object:
        self.currentMp.listPoly = newPolyList
コード例 #2
0
ファイル: TrainingFeedback.py プロジェクト: dedan/poly_burst
    def preparePolyDecomp(self, blank=False):
        """ loads the information stored in a polygonal decomposition into 'self.manyPoly'.

            This object is the one which is displayed, so this step basically
            prepares the information which will be drawn into the canvas.
            a polygon of the decomposition may be composed of smaller subunits
            (created by the triangle program) and they must be handled. This function
            takes care of loading the many subunits which conform the tiling of
            the polygons of the decomposition.
        """
        newPolyList = [self.manyPoly.listPoly[1], self.manyPoly.listPoly[0]]
        if not blank:

            random_poly_index = rnd.randint(0, len(self.polygonPool[self.stimNumber-1])-1)
            self.l.debug("Polygon %s selected for display. ", random_poly_index)
            for pol in self.polygonPool[self.stimNumber-1][random_poly_index]:
                # Load and resize:
                rPol = H.resizePol(pol, w=self.pic_w, h=self.pic_h)
                p = Poly(color=rPol['color'],
                         orientation = 0.0,
                         points = rPol['points'],
                         position = (self.width/2, self.height/2),
                                     size=(self.width, self.height));
                # Add to the list of polies to be displayed:
                newPolyList += [p]

        # Set the list of polies into the target object:
        self.manyPoly.listPoly = newPolyList
コード例 #3
0
ファイル: PaintingFeedback.py プロジェクト: dedan/poly_burst
    def storePreviousPolies(self, burst_index):
        """stores into self.listOfPolies_ the polygons which were previously displayed.
        This is the only way to get the polygons displayed in the right order and yet do
        not interfere with the polygons which are being currently displayed.
        """

        for ii in range(burst_index):
            currentTargetPoly = self.polygonPool[self.numTarget-1][ii]
            pList_ = []
            for pol in currentTargetPoly:
                rPol = H.resizePol(pol, w=self.pic_w, h=self.pic_h)
                p = Poly(color=rPol['color'],
                         orientation = 0.0,
                         points = rPol['points'],
                         position = (self.width/2, self.height/2),
                                     size=(self.width, self.height))
                pList_ += [p]
            self.listOfPolies_[currentTargetPoly[0]['position']].listPoly = pList_
        return