def __init__(self, subject, decimate=False):
        self.subject = subject
        self.types = []

        left, right = db.get_surf(subject, "fiducial")
        try:
            fleft, fright = db.get_surf(subject, "flat", nudge=True, merge=False)
        except IOError:
            fleft = None

        if decimate:
            try:
                pleft, pright = db.get_surf(subject, "pia")
                self.left = DecimatedHemi(left[0], left[1], fleft[1], pia=pleft[0])
                self.right = DecimatedHemi(right[0], right[1], fright[1], pia=pright[0])
                self.addSurf("wm", name="wm", addtype=False, renorm=False)
            except IOError:
                self.left = DecimatedHemi(left[0], left[1], fleft[1])
                self.right = DecimatedHemi(right[0], right[1], fright[1])
        else:
            try:
                pleft, pright = db.get_surf(subject, "pia")
                wleft, wright = db.get_surf(subject, "wm")
                self.left = Hemi(pleft[0], left[1])
                self.right = Hemi(pright[0], right[1])
                self.addSurf("wm", name="wm", addtype=False, renorm=False)
            except __HOLE__:
                self.left = Hemi(left[0], left[1])
                self.right = Hemi(right[0], right[1])

            if fleft is not None:
                #set medial wall
                for hemi, ptpoly in ([self.left, fleft], [self.right, fright]):
                    fidpolys = set(tuple(f) for f in polyutils.sort_polys(hemi.polys))
                    flatpolys = set(tuple(f) for f in polyutils.sort_polys(ptpoly[1]))
                    hemi.aux[np.array(list(fidpolys - flatpolys)).astype(int), 0] = 1

        #Find the flatmap limits
        if fleft is not None:
            flatmerge = np.vstack([fleft[0][:,:2], fright[0][:,:2]])
            fmin, fmax = flatmerge.min(0), flatmerge.max(0)
            self.flatlims = map(float, -fmin), map(float, fmax-fmin)

            self.left.setFlat(fleft[0])
            self.right.setFlat(fright[0])
        else:
            self.flatlims = None
dataset/ETHPy150Open gallantlab/pycortex/cortex/brainctm.py/BrainCTM.__init__