/[escript]/trunk/downunder/py_src/seismic.py
ViewVC logotype

Diff of /trunk/downunder/py_src/seismic.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4539 by gross, Thu Nov 28 00:37:48 2013 UTC revision 4540 by gross, Thu Nov 28 01:06:10 2013 UTC
# Line 20  __license__="""Licensed under the Open S Line 20  __license__="""Licensed under the Open S
20  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
21  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
22    
23  __all__ = ['SimpleSEGYWriter']  __all__ = ['SimpleSEGYWriter', 'Ricker' ]
24    
25    
26  import numpy as np  import numpy as np
# Line 29  import time Line 29  import time
29  from esys.escript import *  from esys.escript import *
30  import esys.escript.unitsSI as U  import esys.escript.unitsSI as U
31    
32    class Wavelet(object):
33        """
34        place holder for source wavelet
35        """
36        pass
37        
38    class Ricker(Wavelet):
39        """
40        The Ricker Wavelet w=f(t)
41        """
42        def __init__(self, f_dom=40, t_dom=None):
43                """
44                set up Ricker wavelet wih dominant frequence f_dom and center at time t_dom. If t_dom
45                is not given an estimate for suitable t_dom is calculated so f(0)~0.
46                """
47            drop=20
48            self.__f=f_dom
49            self.__f_max=sqrt(7)*f_dom
50            self.__s=pi*self.__f
51            if t_dom == None:
52                t_dom=sqrt(drop)/self.__s
53            self.__t0=t_dom
54        def getCenter(self):
55               """
56               return value of wavelet center
57               """
58                   return self.___t0    
59            
60            def getTimeScale(self):
61                    """
62                    returns the time scale which is the inverse of the largest freqence with a significant
63                    spectral component.
64                    """
65            return 1/self.__f_max
66    
67        def getValue(self, t):
68                """
69                get value of wavelet at time t
70                """
71            e2=(self.__s*(t-self.__t0))**2
72            return (1-2*e2)*exp(-e2)
73    
74        def getAcceleration(self, t):
75                """
76                get the acceleration f''(t) at time t
77                """
78            e2=(self.__s*(t-self.__t0))**2
79                    return 2*self.__s**2*(-4*e2**2 + 12*e2 - 3)*exp(-e2)
80                    
81    
82  class SimpleSEGYWriter(object):  class SimpleSEGYWriter(object):
83      """      """

Legend:
Removed from v.4539  
changed lines
  Added in v.4540

  ViewVC Help
Powered by ViewVC 1.1.26