Beispiel #1
0
 def compute_windows(self):
     """
     Return: windows (list): list of pydsm.window.Window
     """
     # TODO speed up by grouping events
     windows = []
     for trace in self.traces:
         # keep only the first arrival
         window = WindowMaker.windows_from_obspy_traces(
             trace, self.modelname, self.phasenames,
             self.t_before, self.t_after)[0]
         windows.append(window)
     return windows
Beispiel #2
0
    def _get_windows(self):
        """Compute the time windows.

            Returns:
                list of Window: time windows

        """
        windows = []
        for i in range(len(self.phases)):
            windows_tmp = WindowMaker.windows_from_dataset(
                self.dataset,
                'ak135', [self.phases[i]], [self.components[i]],
                t_before=self.t_before,
                t_after=self.t_after)
            windows += windows_tmp
        windows = [
            w for w in windows if self.distance_min <=
            w.get_epicentral_distance() <= self.distance_max
        ]
        return windows
Beispiel #3
0
    nspc = 256
    mode = 2
    freq = 0.01
    freq2 = 0.08
    filter_type = 'bandpass'

    dataset, output = get_dataset(get_model_syntest1_prem(),
                                  tlen=tlen,
                                  nspc=nspc,
                                  sampling_hz=sampling_hz,
                                  mode=mode,
                                  add_noise=False,
                                  noise_normalized_std=1.)

    windows = WindowMaker.windows_from_dataset(dataset,
                                               'prem', ['ScS'], [Component.T],
                                               t_before=t_before,
                                               t_after=t_after)

    dataset.filter(freq, freq2, filter_type)
    dataset.apply_windows(windows, 1, window_npts)

    X, y = get_XY(model,
                  dataset,
                  windows,
                  tlen=tlen,
                  nspc=nspc,
                  freq=freq,
                  freq2=freq2,
                  filter_type=filter_type,
                  sampling_hz=sampling_hz,
                  mode=mode)
Beispiel #4
0
from pytomo.dataset.plotutils import display_windows
from dsmpy.windowmaker import WindowMaker
import pygmt

if __name__ == '__main__':
    windows = WindowMaker.load('selected_shift_windows_ScS_S_sS.pkl')
    windows = windows['0.01_0.08']

    windows_selected = [
        w for w in windows
        if ((-170 < w.station.longitude < -150 or (
            -130 < w.station.longitude < -100 and 30 < w.station.latitude < 40)
             ) and (w.event.longitude > 175 or w.event.longitude < -170))
    ]

    fig = pygmt.Figure()
    with fig.subplot(
            nrows=1,
            ncols=1,
            figsize=('20c', '20c'),
            frame=["af", "WSne"],
            # autolabel='(a)'
    ):
        display_windows(fig,
                        windows_selected, ['ScS'], [0, 0],
                        proj='G-160/30/18c',
                        frame=["af", "WSne", "g"],
                        region=[-100, 220, -60, 70])
    fig.savefig('map.pdf')
Beispiel #5
0
    phases = ['ScS']
    window_file = 'windows.pkl'

    dataset, output = get_dataset(get_model_syntest1_prem_vshvsv(),
                                  tlen=1638.4,
                                  nspc=256,
                                  sampling_hz=sampling_hz,
                                  mode=mode,
                                  add_noise=False,
                                  noise_normalized_std=1.)

    # windows = WindowMaker.windows_from_dataset(
    #     dataset, 'prem', phases, [Component.T, Component.R],
    #     t_before=t_before, t_after=t_after)

    windows = WindowMaker.load(window_file)
    windows_ScS = [w for w in windows if w.phase_name == 'ScS']
    windows_S = [w for w in windows if w.phase_name == 'S']
    windows_S_sS = [w for w in windows if w.phase_name in {'S', 'sS'}]
    windows_S_sS_trim = WindowMaker.set_limit(windows_ScS,
                                              t_before=5,
                                              t_after=15,
                                              inplace=False)
    windows_ScS_trimmed = WindowMaker.trim_windows(windows_ScS,
                                                   windows_S_sS_trim)
    windows_ScS_proc = []
    for window in windows_ScS_trimmed:
        window_S = [
            w for w in windows_S
            if (w.station == window.station and w.event == window.event
                and w.component == window.component)
Beispiel #6
0
                                    seed=seed)
        models = cmc.sample_models(n_mod)
    else:
        model_params = None
        models = None
        model_ref = None

    dataset = get_dataset(tlen, nspc, sampling_hz, mode=mode)

    if filter_type is not None:
        dataset.filter(freq, freq2, filter_type)

    if rank == 0:
        windows_S = WindowMaker.windows_from_dataset(dataset,
                                                     'prem', ['s', 'S'],
                                                     [Component.T],
                                                     t_before=30.,
                                                     t_after=50.)
        windows_P = WindowMaker.windows_from_dataset(dataset,
                                                     'prem', ['p', 'P'],
                                                     [Component.Z],
                                                     t_before=30.,
                                                     t_after=50.)
        windows = windows_S  #+ windows_P
    else:
        windows = None

    ipass = 0
    misfit_dict = None
    if rank == 0:
        start_time = time.time_ns()