def test_calculate_adrjrc_on_trace_raises_if_syn_is_not_trace():
    obs, syn, win_time = setup_calculate_adjsrc_on_trace_args()
    config = load_config_multitaper()
    syn = []
    with pytest.raises(ValueError):
        adj.calculate_adjsrc_on_trace(obs, syn, win_time, config,
                                      adj_src_type="multitaper_misfit")
def test_calculate_adjsrc_on_trace_raises_bad_windows_shape():
    obs, syn, win_time = setup_calculate_adjsrc_on_trace_args()
    config = load_config_multitaper()
    win_time = []
    with pytest.raises(ValueError):
        adj.calculate_adjsrc_on_trace(obs, syn, win_time, config,
                                      adj_src_type="multitaper_misfit")
def test_calculate_adjsrc_on_trace_figure_mode_none_figure_dir():
    obs, syn, win_time = setup_calculate_adjsrc_on_trace_args()
    config = load_config_multitaper()
    plt.switch_backend('agg')
    adjsrc = adj.calculate_adjsrc_on_trace(
        obs, syn, win_time, config, adj_src_type="multitaper_misfit",
        figure_mode=True)
    assert adjsrc
def test_calculate_adjsrc_on_trace_multitaper_misfit_produces_adjsrc():
    obs, syn, win_time = setup_calculate_adjsrc_on_trace_args()
    config = load_config_multitaper()

    adjsrc = adj.calculate_adjsrc_on_trace(
        obs, syn, win_time, config, adj_src_type="multitaper_misfit",
        adjoint_src_flag=True, figure_mode=False)
    assert adjsrc