import os sys import numpy as np import pandas as pd def ttime vp vs v

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import os, sys
import numpy as np
import pandas as pd
def ttime(z, vp, vs, p):
vs2p2 = np.sqrt((1/vs**2) - (p**2))
vp2p2 = np.sqrt((1/vp**2) - (p**2))
ctps = 2 * z * ( vs2p2 - vp2p2 )
ctpps = 2 * z * ( vs2p2 + vp2p2 )
ctpmp = 2 * z * ( vp2p2 )
return (ctps, ctpps, ctpmp)
z = np.loadtxt('zrpt.txt')
vp = np.loadtxt('vprpt.txt')
vs = np.loadtxt('vsrpt.txt')
p = np.loadtxt('slowrpt.txt')
res = ttime(z, vp, vs, p)
merged = np.concatenate(res, axis=0).reshape(3, 8000)
df = pd.DataFrame(data=np.transpose(merged),columns=[f'ff{i}' for i in range(3)])
df.to_csv("test_transpose.csv")