示例#1
0
    def init(self):
        self.epsilon = 1

        self.prepare_chain()

        settings.BASE_DIR = self.get_base_dir()
        settings.EXPERIMENTAL_ROOT_DIR = settings.BASE_DIR
        if settings.CREATE_DIR_STRUCTURE: tools.create_dir(settings.BASE_DIR)
示例#2
0
文件: exp8.py 项目: MrTheodor/science
    def init(self):
        self.epsilon = 1
        
        self.prepare_chain()

        settings.BASE_DIR = self.get_base_dir()
        settings.EXPERIMENTAL_ROOT_DIR = settings.BASE_DIR
        if settings.CREATE_DIR_STRUCTURE: tools.create_dir(settings.BASE_DIR)

        settings.MC_STEPS = self.freq['mc_steps']
        settings.COLLECT = self.freq['collect']
示例#3
0
    def create_dir_structure(self, name, index = None):
        """
        @name string: name of dir above base_dir
        @make_copy int: index of dir, if exists create max(index)+1
        Create dir structure
        """
        if index != None:
            base_dir = self.get_base_dir()
            if settings.CREATE_DIR_STRUCTURE:
                while os.path.exists(base_dir + (name + "_%d" % index)):
                    max_index = max([ int(p.split('_')[-1]) for p in os.listdir(base_dir) if name in p ])
                    index = max_index + 1
             
            name_with_index = (name + "_%d") % index
            settings.BASE_DIR = self.get_base_dir(name_with_index)
        else:
            settings.BASE_DIR = self.get_base_dir(name)

        for name,dir in settings.DIRS.iteritems():
            settings.DIRS[name] = settings.BASE_DIR + "/" + settings.DIRS[name]
            if settings.CREATE_DIR_STRUCTURE: tools.create_dir(settings.DIRS[name])