def test_window_on_trace(): obs_tr = read(obsfile).select(channel="*R")[0] syn_tr = read(synfile).select(channel="*R")[0] config_file = os.path.join(DATA_DIR, "window", "27_60.BHZ.config.yaml") config = wio.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, _verbose=False, figure_mode=False) assert len(windows) == 5 winfile_bm = os.path.join(DATA_DIR, "window", "IU.KBL..BHR.window.json") with open(winfile_bm) as fh: windows_json = json.load(fh) for _win, _win_json_bm in zip(windows, windows_json): _win_bm = Window._load_from_json_content(_win_json_bm) assert _win == _win_bm
def get_windows(): obs_tr = read(obsfile).select(channel="*R")[0] syn_tr = read(synfile).select(channel="*R")[0] config_file = os.path.join( DATA_DIR, "window", "27_60.BHZ.config.yaml") config = wio.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, _verbose=False, figure_mode=False) return windows
def test_window_on_trace_user_levels(): obs_tr = read(obsfile)[0] syn_tr = read(synfile)[0] config_file = os.path.join(DATA_DIR, "window", "27_60.BHZ.config.yaml") config = wio.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) user_module = "pytomo3d.window.tests.user_module_example" windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, user_module=user_module, _verbose=False, figure_mode=False) assert len(windows) == 4
def test_window_on_trace_user_levels(): obs_tr = read(obsfile)[0] syn_tr = read(synfile)[0] config_file = os.path.join(DATA_DIR, "window", "27_60.BHZ.config.yaml") config = wio.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) user_module = "pytomo3d.window.tests.user_module_example" windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, user_module=user_module, _verbose=False, figure_mode=False) assert len(windows) == 4
def test_window_on_trace(): obs_tr = read(obsfile).select(channel="*Z")[0] syn_tr = read(synfile).select(channel="*Z")[0] config_file = os.path.join(DATA_DIR, "27_60.BHZ.config.yaml") config = win.load_window_config_yaml(config_file) quakeml = os.path.join(DATA_DIR, "C201009031635A.xml") cat = readEvents(quakeml) windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, _verbose=False, figure_mode=False) winfile_bm = os.path.join(DATA_DIR, "benchmark", "IU.KBL..BHZ.window.json") with open(winfile_bm) as fh: windows_json = json.load(fh) for _win, _win_json_bm in zip(windows, windows_json): _win_bm = Window._load_from_json_content(_win_json_bm) assert _win == _win_bm
def test_window_on_trace_with_none_user_levels(): obs_tr = read(obsfile).select(channel="*R")[0] syn_tr = read(synfile).select(channel="*R")[0] config_file = os.path.join(DATA_DIR, "window", "27_60.BHZ.config.yaml") config = wio.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, user_module="None", _verbose=False, figure_mode=False) winfile_bm = os.path.join(DATA_DIR, "window", "IU.KBL..BHR.window.json") with open(winfile_bm) as fh: windows_json = json.load(fh) for _win, _win_json_bm in zip(windows, windows_json): _win_bm = Window._load_from_json_content(_win_json_bm) assert _win == _win_bm
def test_window_on_trace(tmpdir): obs_tr = read(obsfile).select(channel="*R")[0] syn_tr = read(synfile).select(channel="*R")[0] config_file = os.path.join(DATA_DIR, "window", "27_60.BHZ.config.yaml") config = win.load_window_config_yaml(config_file) cat = readEvents(quakeml) inv = read_inventory(staxml) windows = win.window_on_trace(obs_tr, syn_tr, config, station=inv, event=cat, _verbose=False, figure_mode=False) filename = os.path.join(str(tmpdir), "window.txt") wrw.write_txtfile(windows, filename) filename = os.path.join(str(tmpdir), "window.json") wrw.write_jsonfile(windows, filename)