test_generate_adjoint_stations.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:pytomo3d 作者: computational-seismology 项目源码 文件源码
def test_generate_adjoint_stations(tmpdir):
    ms_one = deepcopy(_measurements)
    ms_one["IU.BCD"].pop("IU.BCD..BHR")
    ms_one["IU.BCD"].pop("IU.BCD..BHT")

    ms = {"17_40": deepcopy(ms_one),
          "40_100": deepcopy(ms_one),
          "90_250": deepcopy(ms_one)}

    outputfn = os.path.join(str(tmpdir), "STATIONS.tmp")
    gas.generate_adjoint_stations(
        ms, _stations, outputfn, benchmark_flag=False)

    output_station = read_station_txt(outputfn)
    assert len(output_station) == 3
    npt.assert_allclose(output_station["II.AAK"], [0.0, 0.0, 2437.8, 0.0])
    npt.assert_allclose(output_station["II.ABKT"], [0.0, 120.0, 2437.8, 0.0])
    npt.assert_allclose(output_station["IU.BCD"], [0.0, -120.0, 2437.8, 0.0])

    with pytest.raises(ValueError):
        gas.generate_adjoint_stations(
            ms, _stations, outputfn, benchmark_flag=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号