Skip to content

Commit

Permalink
add test coverage through get_object
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 23, 2024
1 parent 3e9e016 commit e129bef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lcviz/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from glue.core.roi import XRangeROI, YRangeROI
from astropy.time import Time
from astropy.utils.data import download_file
from lightkurve import LightCurve, search_targetpixelfile
from lightkurve import LightCurve, KeplerTargetPixelFile, search_targetpixelfile
from lightkurve.io import kepler
import astropy.units as u

Expand Down Expand Up @@ -58,6 +58,7 @@ def test_kepler_tpf_via_lightkurve(helper):
quarter=10).download()
helper.load_data(tpf)
assert helper.get_data().shape == (4447, 4, 6) # (time, x, y)
assert helper.app.data_collection[0].get_object(cls=KeplerTargetPixelFile).shape == (4447, 4, 6)


def test_synthetic_lc(helper):
Expand Down
6 changes: 5 additions & 1 deletion lcviz/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from glue.config import data_translator
from glue.core import Data, Subset
from ipyvue import watch
import warnings

import os
from glue.core.coordinates import Coordinates
Expand Down Expand Up @@ -438,7 +439,10 @@ def to_object(self, data_or_subset):
values = values.value
setattr(tpf_factory, attr, values)

tpf = tpf_factory.get_tpf()
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message='Could not detect filetype as TESSTargetPixelFile or KeplerTargetPixelFile, returning generic TargetPixelFile instead.') # noqa
tpf = tpf_factory.get_tpf()

for attr in self.meta_attrs:
# if this attribute exists and can be set:
Expand Down

0 comments on commit e129bef

Please sign in to comment.