本文整理汇总了Python中obspy.core.Trace.data[i]方法的典型用法代码示例。如果您正苦于以下问题:Python Trace.data[i]方法的具体用法?Python Trace.data[i]怎么用?Python Trace.data[i]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.Trace
的用法示例。
在下文中一共展示了Trace.data[i]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aquireGreens
# 需要导入模块: from obspy.core import Trace [as 别名]
# 或者: from obspy.core.Trace import data[i] [as 别名]
#.........这里部分代码省略.........
FF = F.readDouble()
aa = complex(FF[0],FF[1])
gg[j][i][k] = aa
# here we have the resulting matrix gg with complex spectra values
# for each distance, each mtfound, take vector of complex (generate data(j),
# make conjg, add complex for nyq, spectra->time, damping,
# integration if required(disp)
pi = acos(-1.0)
twpi = 2.*pi
n = 2 * (nyq-1)
nm = n2
npoint = n
rep = 'n'
tau = dt
fmax = fu
inst = 0
for j in range(0,nrange+0):
t0x = (Range[j])/(vred[j])
yr = 0.0
for k in range(0,10+0):
if (isrc[k] ==1):
# inizialize data
data = numpy.array(numpy.zeros(n2+0+n2),dtype=complex)
# data = [0.0 for x in range(0,n2+0+n2)]
for i in range(0,n2+0):
# arrange data
data[i] = gg[j][i][k]
# arrang frequency
freq = i*df
if(freq < df):
freq = 0.01*df
om = twpi * freq
for i in range(n2+0,nyq):
data[i] = complex(0.0,0.0)
# conjug
for i in range(1,n2+0):
data[n+0-i] = data[i].conjugate()
data[0] = complex(0.0,0.0)
data[nyq-1] = complex(0.0,0.0)
# From spectraToTime
data = four1(data,n,1,dt,df)
# Apply damping factor
fac = exp(alpha*t0x)
dfac = exp(alpha*dt)
for i in range(len(data)):
data[i]=(data[i])*fac
fac = fac * dfac
# velocity to displavement if required
if(ivel=='1'):
data=velTodisData(data,dt)
# put data into trace
prel = 0
示例2: makeSynt
# 需要导入模块: from obspy.core import Trace [as 别名]
# 或者: from obspy.core.Trace import data[i] [as 别名]
def makeSynt(st,mti,mo,args):
from obspy.core import Stream,Trace
from math import cos,sin,radians
import numpy as np
import sys
mxx = mti[0]
myy = mti[1]
mxy = mti[2]
mxz = mti[3]
myz = mti[4]
mzz = mti[5]
mo = 1.0*mo
MM = mo/(1e20)
MM = 1.0
# initialize
synt = Stream()
staz_list = []
# npts
npts = st[0].stats.npts
delta = st[0].stats.delta
# aquire station list
for i in range(len(st)):
if (st[i].stats.channel == 'tss'):
staz_list.append(st[i].stats.station)
# for each station of list: create 3 traces: ver,rad,tan
# compute time elements for each one and update stats
# make synt. Repeated 3 time the component loops over npts on syn.data
# because of some pointer confusion (mine)
k=1
for l in range(len(staz_list)):
dati = np.arange(npts)*0.0 #!!! initialize with floats
az = radians(st[l*10+k].stats.az)
###############
# TAN Component
syn = Trace(dati)
for i in range(npts):
syn.data[i] = mxx*0.5*st[l*10+k*0].data[i]*sin(2*az) \
- myy*0.5*st[l*10+k*0].data[i]*sin(2*az) \
- mxy*1.0*st[l*10+k*0].data[i]*cos(2*az) \
- mxz*1.0*st[l*10+k*1].data[i]*sin(1*az) \
+ myz*1.0*st[l*10+k*1].data[i]*cos(1*az)
# apply Mo
syn.data=syn.data*MM*(-1)
# update stats
syn.stats.station = st[l*10].stats.station
syn.stats.channel = 'TAN'
syn.stats.az = st[l*10].stats.az
syn.stats.baz = st[l*10].stats.baz
syn.stats.dist = st[l*10].stats.dist
syn.stats.gcarc = st[l*10].stats.gcarc
syn.stats.evla = st[l*10].stats.evla
syn.stats.evlo = st[l*10].stats.evlo
syn.stats.stlo = st[l*10].stats.stlo
syn.stats.stla = st[l*10].stats.stla
syn.stats.delta = delta
# add to synt stream
synt.append(syn)
###############
# RAD Component
syn = Trace(dati)
for i in range(npts):
syn.data[i] = mxx*1/6*st[l*10+k*4].data[i]*(+1) \
- mxx*0.5*st[l*10+k*2].data[i]*cos(2*az) \
+ mxx*1/3*st[l*10+k*8].data[i] \
+ myy*1/6*st[l*10+k*4].data[i]*(+1) \
+ myy*0.5*st[l*10+k*2].data[i]*cos(2*az) \
+ myy*1/3*st[l*10+k*8].data[i] \
+ mzz*1/3*st[l*10+k*8].data[i] \
- mzz*1/3*st[l*10+k*4].data[i]*(+1) \
- mxy*1.0*st[l*10+k*2].data[i]*sin(2*az) \
+ mxz*1.0*st[l*10+k*3].data[i]*cos(1*az) \
+ myz*1.0*st[l*10+k*3].data[i]*sin(1*az)
# apply Mo
syn.data=syn.data*MM*(-1)
# update stats
syn.stats.station = st[l*10].stats.station
syn.stats.channel = 'RAD'
syn.stats.az = st[l*10].stats.az
#.........这里部分代码省略.........