Beispiel #1
0
def test_interact_sky_functions_case_nearby_tics_failed(monkeypatch):
    """Test to ensure in case Nearby TIC service from ExoFOP not available,
       interact_sky will still function (without the TIC information) rather
       than raising exceptions.
    """
    import bokeh
    from lightkurve.interact import (
        prepare_tpf_datasource,
        make_tpf_figure_elements,
        add_gaia_figure_elements,
    )
    import lightkurve.interact as lk_interact

    def mock_raise(*args):
        raise IOError("simulated service unavailable")

    monkeypatch.setattr(lk_interact, "_search_nearby_of_tess_target",
                        mock_raise)

    tpf = TessTargetPixelFile(example_tpf_tess)
    mask = tpf.flux[0, :, :] == tpf.flux[0, :, :]
    tpf_source = prepare_tpf_datasource(tpf, aperture_mask=mask)
    fig1, slider1 = make_tpf_figure_elements(tpf, tpf_source)
    with pytest.warns(LightkurveWarning, match="cannot obtain nearby TICs"):
        add_gaia_figure_elements(tpf, fig1)
Beispiel #2
0
def test_interact_sky_functions(tpf_class, tpf_file):
    """Do the helper functions in the interact module run without syntax error?"""
    import bokeh
    from lightkurve.interact import (
        prepare_tpf_datasource,
        make_tpf_figure_elements,
        add_gaia_figure_elements,
    )
    tpf = tpf_class(tpf_file)
    mask = tpf.flux[0, :, :] == tpf.flux[0, :, :]
    tpf_source = prepare_tpf_datasource(tpf, aperture_mask=mask)
    fig1, slider1 = make_tpf_figure_elements(tpf, tpf_source)
    add_gaia_figure_elements(tpf, fig1)
    add_gaia_figure_elements(tpf, fig1, magnitude_limit=22)
Beispiel #3
0
def test_interact_sky_functions_case_no_target_coordinate():
    import bokeh
    from lightkurve.interact import (
        prepare_tpf_datasource,
        make_tpf_figure_elements,
        add_gaia_figure_elements,
    )
    tpf_class, tpf_file = TessTargetPixelFile, example_tpf_no_target_position

    tpf = tpf_class(tpf_file)
    mask = tpf.flux[0, :, :] == tpf.flux[0, :, :]
    tpf_source = prepare_tpf_datasource(tpf, aperture_mask=mask)
    fig1, slider1 = make_tpf_figure_elements(tpf, tpf_source)
    with pytest.raises(LightkurveError, match=r".* no valid coordinate.*"):
        add_gaia_figure_elements(tpf, fig1)