question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.interact() tpf is blank

See original GitHub issue

Problem description

When plotting sector 8 TESS data with ‘interact()’, pixel data does not plot accurately. Potentially due to the change in postage stamp size for sector 8?

interact()_fail

Example

import lightkurve
tpf = lightkurve.search_targetpixelfile('L 98-59').download_all()
tpf[2].interact()
# earlier sectors (tpf[0] and tpf[1]) have no issues

Expected behavior

interact()_success

Environment:

  • platform (e.g. Linux, OSX, Windows): OSX
  • lightkurve version (e.g. 1.0b6): 1.0.0
  • installation method (e.g. pip, conda, source): pip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gullycommented, Apr 24, 2019

Good, glad that the screen stretch resolved the problem!

I suspect all TESS Sector 8 targets will exhibit the same screen stretch default appearance. What’s happening behind the scenes, is that lightkurve computes the 1% and 95% percentile across all finite pixel values in the TargetPixelFile.

vlo, lo, hi, vhi = np.nanpercentile(tpf.flux - pedestal, [0.2, 1, 95, 99.8]) # line 312 of interact.py

Sector 8 is apparently an exception, because 1% of the cadences have extremely low values, and these anomalously-low-values are not automatically masked with quality flags.

We could consider increasing the lo threshold default to, say, 5%. That threshold might be too high for other, more typical TPFs. We’ve found 1% and 95% to be decent threshold defaults for a wide range of Kepler and TESS data.

If you want to over-ride the hardcoded 1% for yourself, you could install the lightkurve developer version alter line 312 of the file interact.py, and relaunch your jupyter-notebook.

0reactions
emilygilbertcommented, Apr 24, 2019

Yes, stretching helps! Thanks, that’s a good tip! Screen Shot 2019-04-24 at 12 29 15 PM

I tested this on ~50 sector 8 targets, and they all have the same issue. I know sector 8 had some spacecraft anomalies, so I guess that’s not too surprising. I can send you an example notebook if that’ll help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TessTargetPixelFile .interact() throws an exception · Issue #333
Using the example alert data on MAST, TessTargetPixelFile works to read the TPF in, but .interact() crashes with the following error message ...
Read more >
Using Target Pixel Files with Lightkurve
The target pixel file (TPF) of a star contains an image for each observing cadence, ... We can download this data product using...
Read more >
How to use the lightkurve.utils.LightkurveWarning function in ...
To help you get started, we've selected a few lightkurve.utils.LightkurveWarning examples, based on popular ways it is used in public projects.
Read more >
Is there a LATTE Alternative for Use on Windows Machines??
Download works fine. If I try plotting the TPF, the pixel-grid appears including the aperture mask, but the flux is 0 i.e. blank....
Read more >
New in lightkurve: inspecting pixel data using tpf.interact()
... using tpf.interact(). News article posted on 11 May 2018 by Michael Gully-Santiago. The new lightkurve Python package for Kepler and K2 data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found