def set_common_data_dir(self, cname="data_dir"): """return the directory common to all subject ddir names""" cdir = UTIL.common_dir([s.dset for s in self.subjects]) if UTIL.is_trivial_dir(cdir): self.common_dir = "" self.common_dname = "" else: self.common_dir = cdir self.common_dname = cname if self.verb > 1: print "++ setting common dir, %s = %s" % (cname, cdir)
def set_common_data_dir(self, cname='data_dir'): """return the directory common to all subject ddir names""" cdir = UTIL.common_dir([s.dset for s in self.subjects]) if UTIL.is_trivial_dir(cdir) or (len(cdir) < len(cname)): self.common_dir = '' self.common_dname = '' else: self.common_dir = cdir self.common_dname = cname if self.verb > 1: print('++ setting common dir, %s = %s' % (cname, cdir))
def pick_base_dir(self, dtype): """return something useful or an empty string""" anat = self.uvars.anat # for ease of typing epi = self.uvars.epi if dtype == 'top': # common dir to all input files return UTIL.common_dir([anat, epi]) elif dtype == 'anat': if anat != '': return os.path.dirname(anat) elif epi != '': return os.path.dirname(epi) elif dtype == 'epi': if epi != '': return os.path.dirname(epi) elif anat != '': return os.path.dirname(anat) else: print '** pick_base_dir: bad dtype = %s' % dtype return ''