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.

"The unit 'ppm' is unrecognized" when stitching TASOC light curves

See original GitHub issue

Sorry, me again…

Problem description

I’m getting the error ValueError: The unit 'ppm' is unrecognized. It can not be converted to other units. when trying to stitch a collection of TASOC lightcurves.

$ python3 mwe.py
/home/wball/.local/lib/python3.9/site-packages/lightkurve/lightcurve.py:965: LightkurveWarning: The light curve already appears to be in relative units; `normalize()` will convert the light curve into relative units for a second time, which is probably not what you want.
  warnings.warn(
Traceback (most recent call last):
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/quantity.py", line 738, in to_value
    scale = self.unit._to(unit)
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/core.py", line 950, in _to
    raise UnitConversionError(
astropy.units.core.UnitConversionError: 'UnrecognizedUnit(ppm)' is not a scaled version of 'UnrecognizedUnit(ppm)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wball/work/steve/mwe.py", line 5, in <module>
    lc = lcs.stitch()
  File "/home/wball/.local/lib/python3.9/site-packages/lightkurve/collections.py", line 228, in stitch
    return vstack(lcs, join_type="inner", metadata_conflicts="silent")
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/table/operations.py", line 638, in vstack
    out = _vstack(tables, join_type, col_name_map, metadata_conflicts)
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/table/operations.py", line 1299, in _vstack
    col[idx0:idx1] = array[name]
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/quantity.py", line 1061, in __setitem__
    self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/quantity.py", line 1339, in _to_own_unit
    _value = value.to_value(self.unit)
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/quantity.py", line 741, in to_value
    value = self._to_value(unit, equivalencies)
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/quantity.py", line 660, in _to_value
    return self.unit.to(unit, self.view(np.ndarray),
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/core.py", line 987, in to
    return self._get_converter(other, equivalencies=equivalencies)(value)
  File "/home/wball/.local/lib/python3.9/site-packages/astropy/units/core.py", line 1782, in _get_converter
    raise ValueError(
ValueError: The unit 'ppm' is unrecognized.  It can not be converted to other units.

Example

import lightkurve as lk

s = lk.search_lightcurve('HV 2112', mission='TESS', author='TASOC', exptime=1800)
lcs = s.download_all()
lc = lcs.stitch()

In case it’s relevant, I get the same result if I call lc = lcs.stitch(corrector_func=None).

I’m a bit surprised that ppm wouldn’t be recognised because a quick search turned up this list of AstroPy units, which includes ppm.

Expected behavior

I’d get a stitched lightcurve (which has so far worked fine with other data HLSPs).

Environment

  • Fedora 33
  • Python 3.9.1
  • lightkurve 2.0.0 & astropy 4.2, both via pip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
scflemingcommented, Feb 19, 2021

Hi Warrick, the sequence number (Sector) is mislabeled for all the QLP Sector 2 entries in Portal as being from Sector 1 by mistake. We are actively working on fixing that now, should be cleared up soon. The timestamps are correct, and the sequence number will be fixed imminently.

1reaction
barentsencommented, Feb 19, 2021

Yes, it would be worth discussing on an AstroPy issue!

  • astropy.units.cds.ppm exists but is not an “enabled” unit by default.
  • ppt does not exist at all.

If you are interested, feel free to make the case on an astropy issue!

(Now, regardless of whether or not we can add these to astropy, we’ll have to work around it in lightkurve for the time being.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHV Weeks 1-2 Notebook - Food Safety and Inspection Service
We will visit each of these units and see how we work together to accomplish ... Emergence of previously unrecognized human pathogens, as...
Read more >
f.í - IARC Monographs
M.J. Gardner, MRC Environmental Epidemiology Unit, Southampton General Hospital, ... Continuous filament fibre glass is used as a conductor of light (fibre ...
Read more >
alpha helix structure: Topics by Science.gov
In this model, the molecule is considered as a one dimensional, repeating unit cell of an infinite helix. The lattice was modeled with...
Read more >
dNR - ALBA.Net
#Perro S oliver shoes winter 2012, Bruce springsteen badlands live pinkpop, E commerce logo inspiration, Katril varum geetham instrumental, Unit 07 project ...
Read more >
Untitled
Jonathan becker larsen, Unit 4c matrix point, Oxford publications mathematics, ... Cyberdrone, Marine gunnel lights, Tank feat ja rule race against time, ...
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