# Path: seispy/geo.py
# def srad2skm(srad):
#     sdeg = srad * ((2*pi)/360)
#     return sdeg / deg2km(1)
# 
# def skm2sdeg(skm):
#     sdeg = skm * deg2km(1)
#     return sdeg


import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from obspy.taup import TauPyModel
from seispy.geo import srad2skm, skm2sdeg
            pass
        else:
            raise TypeError('{} should be in int or float type.'.format(ref_dis))
        if rayp_range is not None and isinstance(rayp_range, np.ndarray):
            self.rayp_range = rayp_range
        elif rayp_range is None:
            pass
        else:
            raise TypeError('{} should be in numpy.ndarray type.'.format(rayp_range))
        if tau_range is not None and isinstance(tau_range, np.ndarray):
            self.tau_range = tau_range
        elif tau_range is None:
            pass
        else:
            raise TypeError('{} should be in numpy.ndarray type.'.format(tau_range))
        ev_num = self.datar.shape[0]
        taus, rayps = np.meshgrid(self.tau_range, self.rayp_range)
        self.stack_amp = np.zeros([self.rayp_range.shape[0], self.tau_range.shape[0]])
        for i in range(ev_num):
            tps = taus - rayps * (self.dis[i] - self.ref_dis)
            self.stack_amp += interp1d(self.time_axis, self.datar[i, :], fill_value='extrapolate')(tps)
        self.stack_amp /= ev_num

    def syn_tps(self, phase_list, velmodel='iasp91', focal_dep=10):
        model = TauPyModel(model=velmodel)
        phase_list.insert(0, 'P')
        arrs = model.get_travel_times(focal_dep, self.ref_dis, phase_list=phase_list)
        p_arr = arrs[0].time
        p_rayp = skm2sdeg(srad2skm(arrs[0].ray_param))
        self.syn_tau = [arr.time - p_arr for arr in arrs[1:]]

# Path: seispy/geo.py
# def srad2skm(srad):
#     sdeg = srad * ((2*pi)/360)
#     return sdeg / deg2km(1)
# 
# def skm2sdeg(skm):
#     sdeg = skm * deg2km(1)
#     return sdeg


# Path: seispy/slantstack.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from obspy.taup import TauPyModel
from seispy.geo import srad2skm, skm2sdeg

            pass
        else:
            raise TypeError('{} should be in int or float type.'.format(ref_dis))
        if rayp_range is not None and isinstance(rayp_range, np.ndarray):
            self.rayp_range = rayp_range
        elif rayp_range is None:
            pass
        else:
            raise TypeError('{} should be in numpy.ndarray type.'.format(rayp_range))
        if tau_range is not None and isinstance(tau_range, np.ndarray):
            self.tau_range = tau_range
        elif tau_range is None:
            pass
        else:
            raise TypeError('{} should be in numpy.ndarray type.'.format(tau_range))
        ev_num = self.datar.shape[0]
        taus, rayps = np.meshgrid(self.tau_range, self.rayp_range)
        self.stack_amp = np.zeros([self.rayp_range.shape[0], self.tau_range.shape[0]])
        for i in range(ev_num):
            tps = taus - rayps * (self.dis[i] - self.ref_dis)
            self.stack_amp += interp1d(self.time_axis, self.datar[i, :], fill_value='extrapolate')(tps)
        self.stack_amp /= ev_num

    def syn_tps(self, phase_list, velmodel='iasp91', focal_dep=10):
        model = TauPyModel(model=velmodel)
        phase_list.insert(0, 'P')
        arrs = model.get_travel_times(focal_dep, self.ref_dis, phase_list=phase_list)
        p_arr = arrs[0].time
        p_rayp = skm2sdeg(srad2skm(arrs[0].ray_param))
        self.syn_tau = [arr.time - p_arr for arr in arrs[1:]]

        self.syn_drayp = [p_rayp - skm2sdeg(srad2skm(arr.ray_param))for arr in arrs[1:]]