def test_convert_adjs_to_trace(): array = np.array([1., 2., 3., 4., 5.]) starttime = UTCDateTime(1990, 1, 1) adj = AdjointSource("cc_traveltime_misfit", 0, 1.0, 17, 40, "BHZ", adjoint_source=array, network="II", station="AAK", location="", starttime=starttime) tr, meta = pa.convert_adj_to_trace(adj) npt.assert_allclose(tr.data, array) assert tr.stats.starttime == starttime npt.assert_almost_equal(tr.stats.delta, 1.0) assert tr.id == "II.AAK..BHZ" assert meta["adj_src_type"] == "cc_traveltime_misfit" npt.assert_almost_equal(meta["misfit"], 0.0) npt.assert_almost_equal(meta["min_period"], 17.0) npt.assert_almost_equal(meta["max_period"], 40.0)
def test_convert_trace_to_adj_2(): array = np.array([1., 2., 3., 4., 5.]) starttime = UTCDateTime(1990, 1, 1) adj = AdjointSource( "cc_traveltime_misfit", 0, 1.0, 17, 40, "BHZ", adjoint_source=array, network="II", station="AAK", location="", starttime=starttime) tr, meta = pa.convert_adj_to_trace(adj) adj_new = pa.convert_trace_to_adj(tr, meta) assert_adj_same(adj, adj_new)
def test_convert_trace_to_adj_2(): array = np.array([1., 2., 3., 4., 5.]) starttime = UTCDateTime(1990, 1, 1) adj = AdjointSource("cc_traveltime_misfit", 0, 1.0, 17, 40, "BHZ", adjoint_source=array, network="II", station="AAK", location="", starttime=starttime) tr, meta = pa.convert_adj_to_trace(adj) adj_new = pa.convert_trace_to_adj(tr, meta) assert_adj_same(adj, adj_new)
def test_convert_adjs_to_trace(): array = np.array([1., 2., 3., 4., 5.]) starttime = UTCDateTime(1990, 1, 1) adj = AdjointSource( "cc_traveltime_misfit", 0, 1.0, 17, 40, "BHZ", adjoint_source=array, network="II", station="AAK", location="", starttime=starttime) tr, meta = pa.convert_adj_to_trace(adj) npt.assert_allclose(tr.data, array) assert tr.stats.starttime == starttime npt.assert_almost_equal(tr.stats.delta, 1.0) assert tr.id == "II.AAK..BHZ" assert meta["adj_src_type"] == "cc_traveltime_misfit" npt.assert_almost_equal(meta["misfit"], 0.0) npt.assert_almost_equal(meta["min_period"], 17.0) npt.assert_almost_equal(meta["max_period"], 40.0)