当前位置: 首页>>代码示例>>Python>>正文


Python unix.mv函数代码示例

本文整理汇总了Python中seisflows.tools.unix.mv函数的典型用法代码示例。如果您正苦于以下问题:Python mv函数的具体用法?Python mv怎么用?Python mv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: export_kernels

    def export_kernels(self, path):
        unix.cd(self.kernel_databases)

        # work around conflicting name conventions
        files = []
        files += glob('*proc??????_alpha_kernel.bin')
        files += glob('*proc??????_alpha[hv]_kernel.bin')
        files += glob('*proc??????_reg1_alpha_kernel.bin')
        files += glob('*proc??????_reg1_alpha[hv]_kernel.bin')
        unix.rename('alpha', 'vp', files)

        files = []
        files += glob('*proc??????_beta_kernel.bin') 
        files += glob('*proc??????_beta[hv]_kernel.bin')
        files += glob('*proc??????_reg1_beta_kernel.bin')
        files += glob('*proc??????_reg1_beta[hv]_kernel.bin')
        unix.rename('beta', 'vs', files)

        # hack to deal with problems on parallel filesystem
        unix.mkdir(join(path, 'kernels'), noexit=True)

        unix.mkdir(join(path, 'kernels', basename(self.getpath)))
        src = join(glob('*_kernel.bin'))
        dst = join(path, 'kernels', basename(self.getpath))
        unix.mv(src, dst)
开发者ID:gianmatharu,项目名称:seisflows-research,代码行数:25,代码来源:base.py

示例2: export_residuals

    def export_residuals(self, path):
        # hack deals with problems on parallel filesystem
        unix.mkdir(join(path, 'residuals'), noexit=True)

        src = join(self.getpath, 'residuals')
        dst = join(path, 'residuals', basename(self.getpath))
        unix.mv(src, dst)
开发者ID:gianmatharu,项目名称:seisflows-research,代码行数:7,代码来源:base.py

示例3: smooth

    def smooth(self, path='', parameters='dummy', span=0. ):
        """ Smooths SPECFEM2D kernels by convolving them with a Gaussian
        """
        from seisflows.tools.array import meshsmooth, stack

        #assert parameters == self.parameters

        # implementing nproc > 1 would be straightforward, but a bit tedious
        #assert self.mesh.nproc == 1

        kernels = self.load(path, suffix='_kernel')
        if not span:
            return kernels

        # set up grid
        _,x = loadbypar(PATH.MODEL_INIT, ['x'], 0)
        _,z = loadbypar(PATH.MODEL_INIT, ['z'], 0)
        mesh = stack(x[0], z[0])

        for key in self.parameters:
            kernels[key] = [meshsmooth(kernels[key][0], mesh, span)]

        unix.rm(path + '_nosmooth')
        unix.mv(path, path + '_nosmooth')
        self.save(path, kernels, suffix='_kernel')
开发者ID:AlainPlattner,项目名称:seisflows,代码行数:25,代码来源:specfem2d.py

示例4: forward

 def forward(self):
     """ Calls SPECFEM3D_GLOBE forward solver
     """
     solvertools.setpar('SIMULATION_TYPE', '1')
     solvertools.setpar('SAVE_FORWARD', '.true.')
     self.mpirun('bin/xspecfem3D')
     unix.mv(self.data_wildcard, 'traces/syn')
开发者ID:yanhuay,项目名称:seisflows,代码行数:7,代码来源:specfem3d_globe.py

示例5: smooth

    def smooth(self, path='', parameters=[], span=0.):
        """ Smooths kernels by convolving them with a Gaussian.  Wrapper over 
            xsmooth_sem utility.
        """
        assert exists(path)
        assert len(parameters) > 0

        # apply smoothing operator
        unix.cd(self.getpath)
        for name in parameters:
            print ' smoothing', name
            self.mpirun(
                PATH.SPECFEM_BIN +'/'+ 'xsmooth_sem '
                + str(span) + ' '
                + str(span) + ' '
                + name + '_kernel' + ' '
                + path + '/ '
                + path + '/ ',
                output=self.getpath+'/'+'OUTPUT_FILES/output_smooth_sem.txt')

        print ''

        # move input files
        src = path
        dst = path + '_nosmooth'
        unix.mkdir(dst)
        for name in self.parameters:
            unix.mv(glob(src+'/*'+name+'.bin'), dst)

        # rename output files
        unix.rename('_smooth', '', glob(src+'/*'))
开发者ID:gianmatharu,项目名称:seisflows-research,代码行数:31,代码来源:base.py

示例6: clip

    def clip(self, path='', parameters=[], minval=-np.inf, maxval=np.inf):
        """ Clips kernels by convolving them with a Gaussian.  Wrapper over 
            xclip_sem utility.
        """
        assert exists(path)
        assert len(parameters) > 0

        unix.cd(self.getpath)
        for name in self.parameters:
            self.mpirun(
                PATH.SPECFEM_BIN +'/'+ 'xclip_sem '
                + str(minval) + ' '
                + str(maxval) + ' '
                + name + '_kernel' + ' '
                + path + '/ '
                + path + '/ ')

        # move input files
        src = path
        dst = path + '_noclip'
        unix.mkdir(dst)
        for name in self.parameters:
            unix.mv(glob(src+'/*'+name+'.bin'), dst)

        # rename output files
        unix.rename('_clip', '', glob(src+'/*'))
开发者ID:gianmatharu,项目名称:seisflows-research,代码行数:26,代码来源:base.py

示例7: save

    def save(self, path, v, backup=None):
        if backup:
            src = path +'/'+ 'gradient'
            dst = path +'/'+ 'gradient_'+backup
            unix.mv(src, dst)

        solver.save(path +'/'+ 'gradient',
                    solver.split(v),
                    suffix='_kernel')
开发者ID:HongjianFang,项目名称:seisflows,代码行数:9,代码来源:base.py

示例8: export_kernels

    def export_kernels(self, path):
        unix.cd(self.kernel_databases)

        # work around conflicting name conventions
        self.rename_kernels()

        src = glob('*_kernel.bin')
        dst = join(path, 'kernels', self.source_name)
        unix.mkdir(dst)
        unix.mv(src, dst)
开发者ID:PrincetonUniversity,项目名称:seisflows,代码行数:10,代码来源:base.py

示例9: clean

 def clean(self):
     isready = self.solver_status()
     if isready:
         unix.rm(PATH.GRAD)
         unix.mv(PATH.FUNC, PATH.GRAD)
         unix.mkdir(PATH.FUNC)
         unix.rm(PATH.SOLVER)
         unix.mv(PATH.SOLVER+'_best', PATH.SOLVER)
     else:
         super(thrifty_inversion, self).clean()
开发者ID:AlainPlattner,项目名称:seisflows,代码行数:10,代码来源:thrifty_inversion.py

示例10: clean

    def clean(self):
        # can forward simulations from line search be carried over?
        self.update_status()

        if self.status==1:
            unix.rm(PATH.GRAD)
            unix.mv(PATH.FUNC, PATH.GRAD)
            unix.mkdir(PATH.FUNC)
        else:
            super(thrifty_inversion, self).clean()
开发者ID:PrincetonUniversity,项目名称:seisflows,代码行数:10,代码来源:thrifty_inversion.py

示例11: forward

    def forward(self, path='traces/syn'):
        """ Calls SPECFEM3D_GLOBE forward solver
        """
        solvertools.setpar('SIMULATION_TYPE', '1')
        solvertools.setpar('SAVE_FORWARD', '.true.')
        call_solver(system.mpiexec(), 'bin/xspecfem3D')

        if PAR.FORMAT in ['ASCII', 'ascii']:
            src = glob('OUTPUT_FILES/*.sem.ascii')
            dst = path
            unix.mv(src, dst)
开发者ID:PrincetonUniversity,项目名称:seisflows,代码行数:11,代码来源:specfem3d_globe.py

示例12: update_aggregate_gradient

    def update_aggregate_gradient(self):
        """ Update stored aggregate gradient.
        """
        names = self.check_source_names()
        subset = [names[isrc] for isrc in self._source_subset]
        print subset

        for source_name in subset:
            src = glob(join(PATH.GRAD, 'kernels', source_name, '*'))
            dst = join(PATH.GRAD_AGG, source_name)
            unix.mv(src, dst)
开发者ID:gianmatharu,项目名称:seisflows,代码行数:11,代码来源:stochastic_saga.py

示例13: iterate_search

    def iterate_search(self):
        super(thrifty_inversion, self).iterate_search()

        isdone = optimize.isdone
        isready = self.solver_status()

        # to avoid redundant forward simulation, save solver files associated
        # with 'best' trial model
        if isready and isdone:
            unix.rm(PATH.SOLVER+'_best')
            unix.mv(PATH.SOLVER, PATH.SOLVER+'_best')
开发者ID:AlainPlattner,项目名称:seisflows,代码行数:11,代码来源:thrifty_inversion.py

示例14: generate_data

    def generate_data(self, **model_kwargs):
        """ Generates data
        """
        self.generate_mesh(**model_kwargs)

        unix.cd(self.getpath)
        setpar('SIMULATION_TYPE', '1')
        setpar('SAVE_FORWARD', '.true.')
        self.call('bin/xspecfem3D')

        unix.mv(self.data_wildcard, 'traces/obs')
        self.export_traces(PATH.OUTPUT, 'traces/obs')
开发者ID:HongjianFang,项目名称:seisflows,代码行数:12,代码来源:specfem3d.py

示例15: forward

    def forward(self, path='traces/syn'):
        """ Calls SPECFEM3D forward solver
        """
        setpar('SIMULATION_TYPE', '1')
        setpar('SAVE_FORWARD', '.true.')
        call_solver(system.mpiexec(), 'bin/xgenerate_databases')
        call_solver(system.mpiexec(), 'bin/xspecfem3D')

        if PAR.FORMAT in ['SU', 'su']:
            src = glob('OUTPUT_FILES/*_d?_SU')
            dst = path
            unix.mv(src, dst)
开发者ID:PrincetonUniversity,项目名称:seisflows,代码行数:12,代码来源:specfem3d.py


注:本文中的seisflows.tools.unix.mv函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。