Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: unmergeable object classes #954

Closed
aguzmanmesa opened this issue Feb 18, 2021 · 6 comments
Closed

ValueError: unmergeable object classes #954

aguzmanmesa opened this issue Feb 18, 2021 · 6 comments
Labels
🐛 bug Something isn't working

Comments

@aguzmanmesa
Copy link

Problem description

Hi!
I'm new to lightkurve. I was running this piece of code (below) and I haven't been able to work out the ValueError. I can't find similar errors within the documentation either. Any suggestions? Thank you in advance.

Example

import lightkurve as lk
from lightkurve import search_lightcurve
lc = lk.search_lightcurve("HD 93083", mission='TESS').download_all().stitch().remove_nans()
ValueError: unmergeable object classes ['Quantity', 'QColumn']

Environment

  • platform (e.g. Linux, OSX, Windows): Mac OSX
  • lightkurve version (e.g. 1.0b6): 2.0.1
  • installation method (e.g. pip, conda, source): pip
@github-actions
Copy link

Hi there! 👋 Thank you for opening your first Lightkurve issue! 🙏 One of our maintainers will get back to you as soon as possible. 👩‍🚀 You can expect a response within 7 days. 📅 If you haven’t heard anything by then, feel free to ping this thread. 🛎️ We love that you are using Lightkurve and appreciate your feedback. 👍

@barentsen
Copy link
Collaborator

@aguzmanmesa Thank you for taking the time to open this issue! 🙏 I am able to reproduce this error. It looks like a real bug we should fix.

Note: the two light curves you are trying to stitch together are both TESS Sector 9 light curves of the same object. It doesn't make a lot of sense to stitch these together because you'd end up combining duplicate flux measurements into one light curve:

Screen Shot 2021-02-18 at 7 56 13 PM

@barentsen barentsen added the 🐛 bug Something isn't working label Feb 19, 2021
@barentsen
Copy link
Collaborator

It looks like this error is caused by the fact that we introduced a special QColumn class for reasons explained here: #891 (comment)

I do not see a simple fix. Once AstroPy v4.3 is released in a few months, the need for the QColumn class will go away and we could then fix this bug by removing the QColumn class. This will be my preferred solution unless the bug affects many people. Please comment below if it does!

@dfm
Copy link
Collaborator

dfm commented Mar 12, 2021

I hit this issue too. Would perhaps be nice to get a more descriptive error, but I don't know much about what's happening in the background!

@barentsen
Copy link
Collaborator

Thank you for raising this issue @aguzmanmesa & @dfm!

In the example above, the underlying cause was that a SPOC and a QLP light curve were being stitched together. The SAP_FLUX column in the former has units electron/second, whereas the latter is unitless/normalized.

I changed the behavior in #996 to exclude such incompatible columns from being stitched together, as opposed to having them raise the ValueError you encountered. A warning is raised instead now:

Screen Shot 2021-03-12 at 1 03 54 PM

I suspect more problems related to stitching together light curves from different pipelines are hiding out there. In general, it is probably best to limit the use of stitch() to light curves produced by the same pipeline, though I bet there are good use cases where breaking this advice makes sense!

@barentsen
Copy link
Collaborator

The fix for this has been merged and will be part of v2.0.5, expected some time next week.

Thanks again! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants