Beispiel #1
0
    def test_evalresp_file_like_object(self):
        """
        Test evalresp with file like object
        """
        rawf = os.path.join(self.path, "CRLZ.HHZ.10.NZ.SAC")
        respf = os.path.join(self.path, "RESP.NZ.CRLZ.10.HHZ")

        tr1 = read(rawf)[0]
        tr2 = read(rawf)[0]

        date = UTCDateTime(2003, 11, 1, 0, 0, 0)
        seedresp = {
            "filename": respf,
            "date": date,
            "units": "VEL",
            "network": "NZ",
            "station": "CRLZ",
            "location": "10",
            "channel": "HHZ",
        }
        tr1.data = seisSim(tr1.data, tr1.stats.sampling_rate, seedresp=seedresp)

        with open(respf, "rb") as fh:
            stringio = io.BytesIO(fh.read())
        seedresp["filename"] = stringio
        tr2.data = seisSim(tr2.data, tr2.stats.sampling_rate, seedresp=seedresp)

        self.assertEqual(tr1, tr2)
Beispiel #2
0
    def test_evalresp_file_like_object(self):
        """
        Test evalresp with file like object
        """
        rawf = os.path.join(self.path, 'CRLZ.HHZ.10.NZ.SAC')
        respf = os.path.join(self.path, 'RESP.NZ.CRLZ.10.HHZ')

        tr1 = read(rawf)[0]
        tr2 = read(rawf)[0]

        date = UTCDateTime(2003, 11, 1, 0, 0, 0)
        seedresp = {
            'filename': respf,
            'date': date,
            'units': 'VEL',
            'network': 'NZ',
            'station': 'CRLZ',
            'location': '10',
            'channel': 'HHZ'
        }
        tr1.data = seisSim(tr1.data,
                           tr1.stats.sampling_rate,
                           seedresp=seedresp)

        with open(respf, 'rb') as fh:
            stringio = compatibility.BytesIO(fh.read())
        seedresp['filename'] = stringio
        tr2.data = seisSim(tr2.data,
                           tr2.stats.sampling_rate,
                           seedresp=seedresp)

        self.assertEqual(tr1, tr2)
Beispiel #3
0
    def test_seisSimVsPitsa1(self):
        """
        Test seisSim seismometer simulation against seismometer simulation
        of Pitsa - LE3D seismometer.
        """
        # load test file
        file = os.path.join(self.path, 'rjob_20051006.gz')
        f = gzip.open(file)
        data = np.loadtxt(f)
        f.close()

        # paz of test file
        samp_rate = 200.0
        PAZ_LE3D = {'poles': [-4.21 + 4.66j,
                              - 4.21 - 4.66j,
                              - 2.105 + 0.0j],
                    'zeros': [0.0 + 0.0j] * 3,
                    'sensitivity': 1.0,
                    'gain': 0.4}

        for id, paz in INSTRUMENTS.iteritems():
            # simulate instrument
            datcorr = seisSim(data, samp_rate, paz_remove=PAZ_LE3D,
                              paz_simulate=paz, water_level=600.0,
                              zero_mean=False, nfft_pow2=True)
            # load pitsa file
            file = os.path.join(self.path, 'rjob_20051006_%s.gz' % id)
            f = gzip.open(file)
            data_pitsa = np.loadtxt(f)
            f.close()
            # calculate normalized rms
            rms = np.sqrt(np.sum((datcorr - data_pitsa) ** 2) / \
                          np.sum(data_pitsa ** 2))
            self.assertTrue(rms < 1.1e-05)
Beispiel #4
0
    def test_seisSimVsPitsa2(self):
        """
        Test seisSim seismometer simulation against seismometer simulation of
        Pitsa - STS-2 seismometer.
        """
        # load test file
        file = os.path.join(self.path, 'rotz_20081028.gz')
        f = gzip.open(file)
        data = np.loadtxt(f)
        f.close()

        # paz of test file
        samp_rate = 200.0
        PAZ_STS2 = {'poles': [-0.03736 - 0.03617j,
                              - 0.03736 + 0.03617j],
                    'zeros': [0.0 + 0.0j] * 2,
                    'sensitivity': 1.0,
                    'gain': 1.5}

        for id, paz in INSTRUMENTS.iteritems():
            # simulate instrument
            datcorr = seisSim(data, samp_rate, paz_remove=PAZ_STS2,
                              paz_simulate=paz, water_level=600.0,
                              zero_mean=False, nfft_pow2=True)
            # load pitsa file
            file = os.path.join(self.path, 'rotz_20081028_%s.gz' % id)
            f = gzip.open(file)
            data_pitsa = np.loadtxt(f)
            f.close()
            # calculate normalized rms
            rms = np.sqrt(np.sum((datcorr - data_pitsa) ** 2) / \
                         np.sum(data_pitsa ** 2))
            self.assertTrue(rms < 1e-04)
Beispiel #5
0
    def test_seisSimVsPitsa2(self):
        """
        Test seisSim seismometer simulation against seismometer simulation of
        Pitsa - STS-2 seismometer.
        """
        # load test file
        file = os.path.join(self.path, 'rotz_20081028.gz')
        f = gzip.open(file)
        data = np.loadtxt(f)
        f.close()

        # paz of test file
        samp_rate = 200.0
        PAZ_STS2 = {'poles': [-0.03736 - 0.03617j,
                              - 0.03736 + 0.03617j],
                    'zeros': [0.0 + 0.0j] * 2,
                    'sensitivity': 1.0,
                    'gain': 1.5}

        for id, paz in INSTRUMENTS.iteritems():
            # simulate instrument
            datcorr = seisSim(data, samp_rate, paz_remove=PAZ_STS2,
                              paz_simulate=paz, water_level=600.0,
                              zero_mean=False, nfft_pow2=True)
            # load pitsa file
            file = os.path.join(self.path, 'rotz_20081028_%s.gz' % id)
            f = gzip.open(file)
            data_pitsa = np.loadtxt(f)
            f.close()
            # calculate normalized rms
            rms = np.sqrt(np.sum((datcorr - data_pitsa) ** 2) /
                          np.sum(data_pitsa ** 2))
            self.assertTrue(rms < 1e-04)
Beispiel #6
0
    def test_seisSimVsPitsa1(self):
        """
        Test seisSim seismometer simulation against seismometer simulation
        of Pitsa - LE3D seismometer.
        """
        # load test file
        file = os.path.join(self.path, 'rjob_20051006.gz')
        f = gzip.open(file)
        data = np.loadtxt(f)
        f.close()

        # paz of test file
        samp_rate = 200.0
        PAZ_LE3D = {'poles': [-4.21 + 4.66j,
                              - 4.21 - 4.66j,
                              - 2.105 + 0.0j],
                    'zeros': [0.0 + 0.0j] * 3,
                    'sensitivity': 1.0,
                    'gain': 0.4}

        for id, paz in INSTRUMENTS.iteritems():
            # simulate instrument
            datcorr = seisSim(data, samp_rate, paz_remove=PAZ_LE3D,
                              paz_simulate=paz, water_level=600.0,
                              zero_mean=False, nfft_pow2=True)
            # load pitsa file
            file = os.path.join(self.path, 'rjob_20051006_%s.gz' % id)
            f = gzip.open(file)
            data_pitsa = np.loadtxt(f)
            f.close()
            # calculate normalized rms
            rms = np.sqrt(np.sum((datcorr - data_pitsa) ** 2) /
                          np.sum(data_pitsa ** 2))
            self.assertTrue(rms < 1.1e-05)
Beispiel #7
0
    def test_SacInstCorrection(self):
        # SAC recommends to taper the transfer function if a pure
        # deconvolution is done instead of simulating a different
        # instrument. This test checks the difference between the
        # result from removing the instrument response using SAC or
        # ObsPy. Visual inspection shows that the traces are pretty
        # much identical but differences remain (rms ~ 0.042). Haven't
        # found the cause for those, yet. One possible reason is the
        # floating point arithmetic of SAC vs. the double precision
        # arithmetic of Python. However differences still seem to be
        # too big for that.
        pzf = os.path.join(self.path, 'SAC_PZs_KARC_BHZ')
        sacf = os.path.join(self.path, 'KARC.LHZ.SAC.asc.gz')
        testsacf = os.path.join(self.path, 'KARC_corrected.sac.asc.gz')
        plow = 160.
        phigh = 4.
        fl1 = 1.0 / (plow + 0.0625 * plow)
        fl2 = 1.0 / plow
        fl3 = 1.0 / phigh
        fl4 = 1.0 / (phigh - 0.25 * phigh)
        #Uncomment the following to run the sac-commands
        #that created the testing file
        #if 1:
        #    import subprocess as sp
        #    p = sp.Popen('sac',shell=True,stdin=sp.PIPE)
        #    cd1 = p.stdin
        #    print >>cd1, "r %s"%sacf
        #    print >>cd1, "rmean"
        #    print >>cd1, "rtrend"
        #    print >>cd1, "taper type cosine width 0.03"
        #    print >>cd1, "transfer from polezero subtype %s to none \
        #    freqlimits %f %f %f %f" % (pzf, fl1, fl2, fl3, fl4)
        #    print >>cd1, "w over ./data/KARC_corrected.sac"
        #    print >>cd1, "quit"
        #    cd1.close()
        #    p.wait()

        stats = {'network': 'KA', 'delta': 0.99999988079072466,
                 'station': 'KARC', 'location': 'S1',
                 'starttime': UTCDateTime(2001, 2, 13, 0, 0, 0, 993700),
                 'calib': 1.00868e+09, 'channel': 'BHZ'}
        tr = Trace(np.loadtxt(sacf), stats)

        attach_paz(tr, pzf, tovel=False)
        tr.data = seisSim(tr.data, tr.stats.sampling_rate,
                          paz_remove=tr.stats.paz, remove_sensitivity=False,
                          pre_filt=(fl1, fl2, fl3, fl4))

        data = np.loadtxt(testsacf)

        # import matplotlib.pyplot as plt
        # plt.plot(tr.data)
        # plt.plot(data)
        # plt.show()
        rms = np.sqrt(np.sum((tr.data - data) ** 2) / \
                      np.sum(tr.data ** 2))
        self.assertTrue(rms < 0.0421)
Beispiel #8
0
    def test_SacInstCorrection(self):
        # SAC recommends to taper the transfer function if a pure
        # deconvolution is done instead of simulating a different
        # instrument. This test checks the difference between the
        # result from removing the instrument response using SAC or
        # ObsPy. Visual inspection shows that the traces are pretty
        # much identical but differences remain (rms ~ 0.042). Haven't
        # found the cause for those, yet. One possible reason is the
        # floating point arithmetic of SAC vs. the double precision
        # arithmetic of Python. However differences still seem to be
        # too big for that.
        pzf = os.path.join(self.path, 'SAC_PZs_KARC_BHZ')
        sacf = os.path.join(self.path, 'KARC.LHZ.SAC.asc.gz')
        testsacf = os.path.join(self.path, 'KARC_corrected.sac.asc.gz')
        plow = 160.
        phigh = 4.
        fl1 = 1.0 / (plow + 0.0625 * plow)
        fl2 = 1.0 / plow
        fl3 = 1.0 / phigh
        fl4 = 1.0 / (phigh - 0.25 * phigh)
        #Uncomment the following to run the sac-commands
        #that created the testing file
        #if 1:
        #    import subprocess as sp
        #    p = sp.Popen('sac',shell=True,stdin=sp.PIPE)
        #    cd1 = p.stdin
        #    print >>cd1, "r %s"%sacf
        #    print >>cd1, "rmean"
        #    print >>cd1, "rtrend"
        #    print >>cd1, "taper type cosine width 0.03"
        #    print >>cd1, "transfer from polezero subtype %s to none \
        #    freqlimits %f %f %f %f" % (pzf, fl1, fl2, fl3, fl4)
        #    print >>cd1, "w over ./data/KARC_corrected.sac"
        #    print >>cd1, "quit"
        #    cd1.close()
        #    p.wait()

        stats = {'network': 'KA', 'delta': 0.99999988079072466,
                 'station': 'KARC', 'location': 'S1',
                 'starttime': UTCDateTime(2001, 2, 13, 0, 0, 0, 993700),
                 'calib': 1.00868e+09, 'channel': 'BHZ'}
        tr = Trace(np.loadtxt(sacf), stats)

        attach_paz(tr, pzf, tovel=False)
        tr.data = seisSim(tr.data, tr.stats.sampling_rate,
                          paz_remove=tr.stats.paz, remove_sensitivity=False,
                          pre_filt=(fl1, fl2, fl3, fl4))

        data = np.loadtxt(testsacf)

        # import matplotlib.pyplot as plt
        # plt.plot(tr.data)
        # plt.plot(data)
        # plt.show()
        rms = np.sqrt(np.sum((tr.data - data) ** 2) /
                      np.sum(tr.data ** 2))
        self.assertTrue(rms < 0.0421)
Beispiel #9
0
    def test_evalrespVsObsPy(self):
        """
        Compare results from removing instrument response using
        evalresp in SAC and ObsPy. Visual inspection shows that the traces are
        pretty much identical but differences remain (rms ~ 0.042). Haven't
        found the cause for those, yet.
        """
        evalrespf = os.path.join(self.path, "CRLZ.HHZ.10.NZ.SAC_resp")
        rawf = os.path.join(self.path, "CRLZ.HHZ.10.NZ.SAC")
        respf = os.path.join(self.path, "RESP.NZ.CRLZ.10.HHZ")
        fl1 = 0.00588
        fl2 = 0.00625
        fl3 = 30.0
        fl4 = 35.0

        #        #Set the following if-clause to True to run
        #        #the sac-commands that created the testing file
        #        if False:
        #            import subprocess as sp
        #            p = sp.Popen('sac', stdin=sp.PIPE)
        #            cd1 = p.stdin
        #            print >>cd1, "r %s" % rawf
        #            print >>cd1, "rmean"
        #            print >>cd1, "taper type cosine width 0.05"
        #            print >>cd1, "transfer from evalresp fname %s to vel freqlimits\
        #            %f %f %f %f" % (respf, fl1, fl2, fl3, fl4)
        #            print >>cd1, "w over %s" % evalrespf
        #            print >>cd1, "quit"
        #            cd1.close()
        #            p.wait()

        tr = read(rawf)[0]
        trtest = read(evalrespf)[0]
        date = UTCDateTime(2003, 11, 1, 0, 0, 0)
        seedresp = {
            "filename": respf,
            "date": date,
            "units": "VEL",
            "network": "NZ",
            "station": "CRLZ",
            "location": "10",
            "channel": "HHZ",
        }
        tr.data = seisSim(
            tr.data,
            tr.stats.sampling_rate,
            paz_remove=None,
            pre_filt=(fl1, fl2, fl3, fl4),
            seedresp=seedresp,
            taper_fraction=0.1,
            pitsasim=False,
            sacsim=True,
        )
        tr.data *= 1e9
        rms = np.sqrt(np.sum((tr.data - trtest.data) ** 2) / np.sum(trtest.data ** 2))
        self.assertTrue(rms < 0.0094)
Beispiel #10
0
    def test_evalrespVsObsPy(self):
        """
        Compare results from removing instrument response using
        evalresp in SAC and ObsPy. Visual inspection shows that the traces are
        pretty much identical but differences remain (rms ~ 0.042). Haven't
        found the cause for those, yet.
        """
        evalrespf = os.path.join(self.path, 'CRLZ.HHZ.10.NZ.SAC_resp')
        rawf = os.path.join(self.path, 'CRLZ.HHZ.10.NZ.SAC')
        respf = os.path.join(self.path, 'RESP.NZ.CRLZ.10.HHZ')
        fl1 = 0.00588
        fl2 = 0.00625
        fl3 = 30.
        fl4 = 35.

        #        #Set the following if-clause to True to run
        #        #the sac-commands that created the testing file
        #        if False:
        #            import subprocess as sp
        #            p = sp.Popen('sac', stdin=sp.PIPE)
        #            cd1 = p.stdin
        #            print >>cd1, "r %s" % rawf
        #            print >>cd1, "rmean"
        #            print >>cd1, "taper type cosine width 0.05"
        #            print >>cd1, "transfer from evalresp fname %s to vel freqlimits\
        #            %f %f %f %f" % (respf, fl1, fl2, fl3, fl4)
        #            print >>cd1, "w over %s" % evalrespf
        #            print >>cd1, "quit"
        #            cd1.close()
        #            p.wait()

        tr = read(rawf)[0]
        trtest = read(evalrespf)[0]
        date = UTCDateTime(2003, 11, 1, 0, 0, 0)
        seedresp = {
            'filename': respf,
            'date': date,
            'units': 'VEL',
            'network': 'NZ',
            'station': 'CRLZ',
            'location': '10',
            'channel': 'HHZ'
        }
        tr.data = seisSim(tr.data,
                          tr.stats.sampling_rate,
                          paz_remove=None,
                          pre_filt=(fl1, fl2, fl3, fl4),
                          seedresp=seedresp,
                          taper_fraction=0.1,
                          pitsasim=False,
                          sacsim=True)
        tr.data *= 1e9
        rms = np.sqrt(
            np.sum((tr.data - trtest.data)**2) / np.sum(trtest.data**2))
        self.assertTrue(rms < 0.0094)
Beispiel #11
0
    def test_evalresp_file_like_object(self):
        """
        Test evalresp with file like object
        """
        rawf = os.path.join(self.path, 'CRLZ.HHZ.10.NZ.SAC')
        respf = os.path.join(self.path, 'RESP.NZ.CRLZ.10.HHZ')

        tr1 = read(rawf)[0]
        tr2 = read(rawf)[0]

        date = UTCDateTime(2003, 11, 1, 0, 0, 0)
        seedresp = {'filename': respf, 'date': date, 'units': 'VEL'}
        tr1.data = seisSim(tr1.data, tr1.stats.sampling_rate,
                           seedresp=seedresp)

        with open(respf) as fh:
            stringio = StringIO(fh.read())
        seedresp['filename'] = stringio
        tr2.data = seisSim(tr2.data, tr2.stats.sampling_rate,
                           seedresp=seedresp)

        self.assertEqual(tr1, tr2)
Beispiel #12
0
def smPSA(data, samp_rate):
    """
    ShakeMap pseudo-spectral parameters

    Compute 5% damped PSA at 0.3, 1.0, and 3.0 seconds.

    Data must be an acceleration Trace

    :type data: :class:`obspy.trace`
    :param data: Data in acceleration to convolve with pendulum at freq.
    :type delta: float
    :param delta: sample rate (samples per sec)
    :rtype: (float, float, float)
    :return: PSA03, PSA10, PSA30
    """

    D = 0.05  # 5% damping

    out = []
    periods = [0.3, 1.0, 3.0]
    for T in periods:
        freq = 1.0 / T
        omega = (2 * 3.14159 * freq)**2

        paz_sa = cornFreq2Paz(freq, damp=D)
        paz_sa['sensitivity'] = omega
        paz_sa['zeros'] = []
        dd = seisSim(data.data,
                     samp_rate,
                     paz_remove=None,
                     paz_simulate=paz_sa,
                     taper=True,
                     simulate_sensitivity=True,
                     taper_fraction=0.05)

        if abs(max(dd)) >= abs(min(dd)):
            psa = abs(max(dd))
        else:
            psa = abs(min(dd))
        out.append(psa)

    return out
Beispiel #13
0
def smPSA(data, samp_rate):
    """
    ShakeMap pseudo-spectral parameters

    Compute 5% damped PSA at 0.3, 1.0, and 3.0 seconds.

    Data must be an acceleration Trace

    :type data: :class:`obspy.trace`
    :param data: Data in acceleration to convolve with pendulum at freq.
    :type delta: float
    :param delta: sample rate (samples per sec)
    :rtype: (float, float, float)
    :return: PSA03, PSA10, PSA30
    """

    D = 0.05	# 5% damping

    out = []
    periods = [0.3, 1.0, 3.0]
    for T in periods:
        freq = 1.0 / T
        omega = (2 * 3.14159 * freq) ** 2

        paz_sa = cornFreq2Paz(freq, damp=D)
        paz_sa['sensitivity'] = omega
        paz_sa['zeros'] = []
        dd = seisSim(data.data, samp_rate, paz_remove=None, paz_simulate=paz_sa,
                     taper=True, simulate_sensitivity=True, taper_fraction=0.05)

        if abs(max(dd)) >= abs(min(dd)):
            psa = abs(max(dd))
        else:
            psa = abs(min(dd))
        out.append(psa)

    return out
Beispiel #14
0
            seedrespN['network']=trN.stats.network
            seedrespN['station']=trN.stats.station
            seedrespN['location']=trN.stats.location
            seedrespN['network']=trN.stats.network
            seedrespN['channel']=trN.stats.channel

            seedrespE['date']=trE.stats.starttime
            seedrespE['network']=trE.stats.network
            seedrespE['station']=trE.stats.station
            seedrespE['location']=trE.stats.location
            seedrespE['network']=trE.stats.network
            seedrespE['channel']=trE.stats.channel
            
            
        
            trN.data=seisSim(trN.data, 100, paz_remove=None, paz_simulate=None, remove_sensitivity=True, simulate_sensitivity=True, water_level=wt, zetro_mean=True, taper=True, taper_fraction=tpf, pre_filt=pre_filt, seedresp=seedrespN, nfft_pow2=False)
    #        trN.filter("highpass", freq=0.5)
            
            
            trE.data=seisSim(trE.data, 100, paz_remove=None, paz_simulate=None, remove_sensitivity=True, simulate_sensitivity=True, water_level=wt, zetro_mean=True, taper=True, taper_fraction=tpf, pre_filt=pre_filt, seedresp=seedrespN, nfft_pow2=False)
            
    #        trN.plot(outfile='espectros/Swave_%s_%s.png' % (units,trN.stats.station))
            #trN.plot()
#==================================================================================================================            
#=========    #Calculando la transformada de fourier   ==============================================================
#==================================================================================================================            
            #spectrum=mper(trN.data,200,np.size(trN.data))
            n=np.size(trN.data)
            #dt=0.01
            t=np.linspace(0,n-1,n)*dt
            df=1/(n*dt)
Beispiel #15
0
def pgm(data, delta, freq, damp=0.1):
    """
    Peak ground motion parameters

    Compute the maximal displacement, velocity, acceleration and the peak
    ground acceleration at a certain frequency (standard frequencies for
    ShakeMaps are 0.3/1.0/3.0 Hz).

    Data must be displacement

    :type data: :class:`~numpy.ndarray`
    :param data: Data in displacement to convolve with pendulum at freq.
    :type delta: float
    :param delta: Sampling interval
    :type freq: float
    :param freq: Frequency in Hz.
    :type damp: float
    :param damp: damping factor. Default is set to 0.1
    :rtype: (float, float, float, float)
    :return: Peak Ground Acceleration, maximal displacement, velocity,
        acceleration
    """
    data = data.copy()

    # Displacement
    if abs(max(data)) >= abs(min(data)):
        m_dis = abs(max(data))
    else:
        m_dis = abs(min(data))

    # Velocity
    data = np.gradient(data, delta)
    if abs(max(data)) >= abs(min(data)):
        m_vel = abs(max(data))
    else:
        m_vel = abs(min(data))

    # Acceleration
    data = np.gradient(data, delta)
    if abs(max(data)) >= abs(min(data)):
        m_acc = abs(max(data))
    else:
        m_acc = abs(min(data))

    samp_rate = 1.0 / delta
    T = freq * 1.0
    D = damp
    omega = (2 * 3.14159 * T) ** 2

    paz_sa = cornFreq2Paz(T, damp=D)
    paz_sa["sensitivity"] = omega
    paz_sa["zeros"] = []
    data = seisSim(
        data,
        samp_rate,
        paz_remove=None,
        paz_simulate=paz_sa,
        taper=True,
        simulate_sensitivity=True,
        taper_fraction=0.05,
    )

    if abs(max(data)) >= abs(min(data)):
        pga = abs(max(data))
    else:
        pga = abs(min(data))

    return (pga, m_dis, m_vel, m_acc)
Beispiel #16
0
def pgm(data, delta, freq, damp=0.1):
    """
    Peak ground motion parameters

    Compute the maximal displacement, velocity, acceleration and the peak
    ground acceleration at a certain frequency (standard frequencies for
    ShakeMaps are 0.3/1.0/3.0 Hz).

    Data must be displacement

    :type data: :class:`~numpy.ndarray`
    :param data: Data in dispalcement to convolve with pendulum at freq.
    :type delta: float
    :param delta: Sampling interval
    :type freq: float
    :param freq: Frequency in Hz.
    :type damp: float
    :param damp: damping factor. Default is set to 0.1
    :rtype: (float, float, float, float)
    :return: Peak Ground Acceleration, maximal displacement, velocity,
        acceleration
    """
    data = data.copy()

    # Displacement
    if abs(max(data)) >= abs(min(data)):
        m_dis = abs(max(data))
    else:
        m_dis = abs(min(data))

    # Velocity
    data = np.gradient(data, delta)
    if abs(max(data)) >= abs(min(data)):
        m_vel = abs(max(data))
    else:
        m_vel = abs(min(data))

    # Acceleration
    data = np.gradient(data, delta)
    if abs(max(data)) >= abs(min(data)):
        m_acc = abs(max(data))
    else:
        m_acc = abs(min(data))

    samp_rate = 1.0 / delta
    T = freq * 1.0
    D = damp
    omega = (2 * 3.14159 * T) ** 2

    paz_sa = cornFreq2Paz(T, damp=D)
    paz_sa['sensitivity'] = omega
    paz_sa['zeros'] = []
    data = seisSim(data, samp_rate, paz_remove=None, paz_simulate=paz_sa,
                   taper=True, simulate_sensitivity=True, taper_fraction=0.05)

    if abs(max(data)) >= abs(min(data)):
        pga = abs(max(data))
    else:
        pga = abs(min(data))

    return (pga, m_dis, m_vel, m_acc)