コード例 #1
0
ファイル: test_czml.py プロジェクト: rak183/poliastro
def test_czml_ground_station():
    start_epoch = iss.epoch
    end_epoch = iss.epoch + molniya.period

    sample_points = 10

    extractor = CZMLExtractor(start_epoch, end_epoch, sample_points)

    extractor.add_ground_station(
        [32 * u.degree, 62 * u.degree],
        id_name="GS",
        label_fill_color=[120, 120, 120, 255],
        label_text="GS test",
    )

    extractor.add_ground_station([0.70930 * u.rad, 0.40046 * u.rad],
                                 label_show=False)

    assert extractor.czml["GS0"]["id"] == "GS0"
    assert (extractor.czml["GS0"]["availability"] ==
            "2013-03-18T12:00:00.000/2013-03-18T23:59:35.108")
    assert extractor.czml["GS0"]["name"] == "GS"
    assert extractor.czml["GS0"]["label"]["fillColor"]["rgba"] == [
        120, 120, 120, 255
    ]
    assert extractor.czml["GS0"]["label"]["text"] == "GS test"
    assert extractor.czml["GS0"]["label"]["show"] is True

    cords = [2539356.1623202674, 4775834.339416022, 3379897.6662185807]
    for i, j in zip(extractor.czml["GS0"]["position"]["cartesian"], cords):
        assert_allclose(i, j, rtol=1e-4)

    cords = [4456924.997008477, 1886774.8000006324, 4154098.219336245]
    for i, j in zip(extractor.czml["GS1"]["position"]["cartesian"], cords):
        assert_allclose(i, j, rtol=1e-4)
コード例 #2
0
ファイル: test_czml.py プロジェクト: s-m-e/poliastro
def test_czml_add_ground_station_raises_error_if_invalid_coordinates():
    start_epoch = iss.epoch
    end_epoch = iss.epoch + molniya.period
    sample_points = 10

    extractor = CZMLExtractor(start_epoch, end_epoch, sample_points)

    with pytest.raises(TypeError) as excinfo:
        extractor.add_ground_station([0.70930 * u.rad])

    assert (
        "Invalid coordinates. Coordinates must be of the form [u, v] where u, v are astropy units"
        in excinfo.exconly())
コード例 #3
0
ファイル: test_czml.py プロジェクト: joesaitta/poliastro
def test_czml_ground_station():
    start_epoch = iss.epoch
    end_epoch = iss.epoch + molniya.period

    sample_points = 10

    expected_doc = """[{
    "id": "document",
    "version": "1.0",
    "name": "document_packet",
    "clock": {
        "interval": "2013-03-18T12:00:00Z/2013-03-18T23:59:35Z",
        "currentTime": "2013-03-18T12:00:00Z",
        "multiplier": 60,
        "range": "LOOP_STOP",
        "step": "SYSTEM_CLOCK_MULTIPLIER"
    }
}, {
    "id": "custom_properties",
    "properties": {
        "custom_attractor": true,
        "ellipsoid": [
            {
                "array": [
                    6378136.6,
                    6378136.6,
                    6356751.9
                ]
            }
        ],
        "map_url": [
            "https://upload.wikimedia.org/wikipedia/commons/c/c4/Earthmap1000x500compac.jpg"
        ],
        "scene3D": true
    }
}, {
    "id": "GS0",
    "availability": "2013-03-18T12:00:00Z/2013-03-18T23:59:35Z",
    "position": {
        "cartesian": [
            2536956.480228706,
            4771321.193798005,
            3399460.9756358126
        ]
    },
    "billboard": {
        "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACvSURBVDhPrZDRDcMgDAU9GqN0lIzijw6SUbJJygUeNQgSqepJTyHG91LVVpwDdfxM3T9TSl1EXZvDwii471fivK73cBFFQNTT/d2KoGpfGOpSIkhUpgUMxq9DFEsWv4IXhlyCnhBFnZcFEEuYqbiUlNwWgMTdrZ3JbQFoEVG53rd8ztG9aPJMnBUQf/VFraBJeWnLS0RfjbKyLJA8FkT5seDYS1Qwyv8t0B/5C2ZmH2/eTGNNBgMmAAAAAElFTkSuQmCC",
        "show": true
    },
    "label": {
        "show": true,
        "text": "GS test",
        "font": "11pt Lucida Console",
        "style": "FILL",
        "fillColor": {
            "rgba": [
                120,
                120,
                120,
                255
            ]
        },
        "outlineWidth": 1.0
    }
}, {
    "id": "GS1",
    "availability": "2013-03-18T12:00:00Z/2013-03-18T23:59:35Z",
    "position": {
        "cartesian": [
            4450567.472491674,
            1884083.4338554223,
            4176129.2748575546
        ]
    },
    "billboard": {
        "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACvSURBVDhPrZDRDcMgDAU9GqN0lIzijw6SUbJJygUeNQgSqepJTyHG91LVVpwDdfxM3T9TSl1EXZvDwii471fivK73cBFFQNTT/d2KoGpfGOpSIkhUpgUMxq9DFEsWv4IXhlyCnhBFnZcFEEuYqbiUlNwWgMTdrZ3JbQFoEVG53rd8ztG9aPJMnBUQf/VFraBJeWnLS0RfjbKyLJA8FkT5seDYS1Qwyv8t0B/5C2ZmH2/eTGNNBgMmAAAAAElFTkSuQmCC",
        "show": true
    },
    "label": {
        "show": false,
        "font": "11pt Lucida Console",
        "style": "FILL",
        "outlineWidth": 1.0
    }
}]"""
    extractor = CZMLExtractor(start_epoch, end_epoch, sample_points)

    extractor.add_ground_station(
        [32 * u.degree, 62 * u.degree],
        label_fill_color=[120, 120, 120, 255],
        label_text="GS test",
    )

    extractor.add_ground_station([0.70930 * u.rad, 0.40046 * u.rad],
                                 label_show=False)
    assert repr(extractor.packets) == expected_doc