<commit_before>
import numpy as np

from seisflows.tools import unix
from seisflows.tools.arraytools import loadnpy, savenpy
from seisflows.tools.codetools import divides, exists, glob, irange, join
from seisflows.tools.configtools import getclass, ParameterObject

PAR = ParameterObject('parameters')
PATH = ParameterObject('paths')

system = getclass('system',PAR.SYSTEM)()
solver = getclass('solver',PAR.SOLVER)()



class inversion(object):
    """ Seismic inversion base class.

      Computes iterative model updates using any of a variety of possible 
      settings, and provides a base class on top of which custom inversion 
      strategies can be implemented.

      To allow overriding, separate methods are provided for each step in the
      inversion, including 'evaluate_function', 'evaluate_gradient',
      'compute_direction', and 'line_search' as well as generic 'initialize'
      and 'finalize' methods.

      Calls to forward and adjoint solvers are abstracted through the 'solver'
      interface so that various forward modeling packages can be used
      interchangably.

      Commands for launching serial or parallel jobs on a workstation or cluster
      are abstracted through the 'system' interface so that the code can be
      easily ported.

      For assistance using this package, please browse comments or email
      rmodrak -at- princeton -dot- edu
    """


    def __init__(self):

        # check user supplied parameters
        if 'BEGIN' not in PAR:
            raise Exception

        if 'END' not in PAR:
            raise Exception

        if 'VERBOSE' not in PATH:
            setattr(PATH,'VERBOSE',1)


        # check scratch paths
        if 'GLOBAL' not in PATH:
            raise Exception

        if 'LOCAL' not in PATH:
            setattr(PATH,'LOCAL',None)

        if 'FUNC' not in PATH:
            setattr(PATH,'FUNC',join(PATH.GLOBAL,'func'))

        if 'GRAD' not in PATH:
            setattr(PATH,'GRAD',join(PATH.GLOBAL,'grad'))

        if 'HESS' not in PATH:
            setattr(PATH,'HESS',join(PATH.GLOBAL,'hess'))


        # check input paths
        if 'DATA' not in PATH:
            setattr(PATH,'DATA',None)

        if not exists(PATH.DATA):
            assert 'MODEL_TRUE' in PATH
<commit_msg>fixed type in PAR.VERBOSE definition<commit_after>
import numpy as np

from seisflows.tools import unix
from seisflows.tools.arraytools import loadnpy, savenpy
from seisflows.tools.codetools import divides, exists, glob, irange, join
from seisflows.tools.configtools import getclass, ParameterObject

PAR = ParameterObject('parameters')
PATH = ParameterObject('paths')

system = getclass('system',PAR.SYSTEM)()
solver = getclass('solver',PAR.SOLVER)()



class inversion(object):
    """ Seismic inversion base class.

      Computes iterative model updates using any of a variety of possible 
      settings, and provides a base class on top of which custom inversion 
      strategies can be implemented.

      To allow overriding, separate methods are provided for each step in the
      inversion, including 'evaluate_function', 'evaluate_gradient',
      'compute_direction', and 'line_search' as well as generic 'initialize'
      and 'finalize' methods.

      Calls to forward and adjoint solvers are abstracted through the 'solver'
      interface so that various forward modeling packages can be used
      interchangably.

      Commands for launching serial or parallel jobs on a workstation or cluster
      are abstracted through the 'system' interface so that the code can be
      easily ported.

      For assistance using this package, please browse comments or email
      rmodrak -at- princeton -dot- edu
    """


    def __init__(self):

        # check user supplied parameters
        if 'BEGIN' not in PAR:
            raise Exception

        if 'END' not in PAR:
            raise Exception

        if 'VERBOSE' not in PAR:
            setattr(PAR,'VERBOSE',1)


        # check scratch paths
        if 'GLOBAL' not in PATH:
            raise Exception

        if 'LOCAL' not in PATH:
            setattr(PATH,'LOCAL',None)

        if 'FUNC' not in PATH:
            setattr(PATH,'FUNC',join(PATH.GLOBAL,'func'))

        if 'GRAD' not in PATH:
            setattr(PATH,'GRAD',join(PATH.GLOBAL,'grad'))

        if 'HESS' not in PATH:
            setattr(PATH,'HESS',join(PATH.GLOBAL,'hess'))


        # check input paths
        if 'DATA' not in PATH:
            setattr(PATH,'DATA',None)

        if not exists(PATH.DATA):
            assert 'MODEL_TRUE' in PATH

{'fraction_non_alphanumeric': 0.07799868909766222, 'fraction_numerical': 0.00043696744592527855, 'mean_word_length': 2.685990338164251, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4380014', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1210, 'n_words': 472}