def test_interact_functions(): """Do the helper functions in the interact module run without syntax error?""" import bokeh from lightkurve.interact import ( prepare_tpf_datasource, prepare_lightcurve_datasource, get_lightcurve_y_limits, make_lightcurve_figure_elements, make_tpf_figure_elements, show_interact_widget, ) tpf = TessTargetPixelFile(example_tpf) mask = tpf.flux[0, :, :] == tpf.flux[0, :, :] tpf_source = prepare_tpf_datasource(tpf, aperture_mask=mask) lc = tpf.to_lightcurve(aperture_mask=mask) lc_source = prepare_lightcurve_datasource(lc) get_lightcurve_y_limits(lc_source) make_lightcurve_figure_elements(lc, lc_source) def ylim_func_sample(lc): return (np.nanpercentile(lc.flux, 0.1), np.nanpercentile(lc.flux, 99.9)) make_lightcurve_figure_elements(lc, lc_source, ylim_func=ylim_func_sample) def ylim_func_unitless(lc): return ( np.nanpercentile(lc.flux, 0.1).value, np.nanpercentile(lc.flux, 99.9).value, ) make_lightcurve_figure_elements(lc, lc_source, ylim_func=ylim_func_unitless) make_tpf_figure_elements(tpf, tpf_source) show_interact_widget(tpf)
def test_tpf_tess(): """Does a TESS Sector 1 TPF work?""" tpf = TessTargetPixelFile(filename_tess, quality_bitmask=None) assert tpf.mission == "TESS" assert tpf.targetid == 25155310 assert tpf.sector == 1 assert tpf.camera == 4 assert tpf.ccd == 1 assert tpf.pipeline_mask.sum() == 9 assert tpf.background_mask.sum() == 30 lc = tpf.to_lightcurve() assert isinstance(lc, TessLightCurve) assert_array_equal(lc.time, tpf.time) assert tpf.time.scale == "tdb" assert tpf.flux.shape == tpf.flux_err.shape tpf.wcs col, row = tpf.estimate_centroids()