Skip to content

Commit

Permalink
replace flux-origin with quarter/campaign/sector in data_label (#111)
Browse files Browse the repository at this point in the history
* replace flux-origin with quarter/campaign/sector in data_label
  • Loading branch information
kecnry authored Apr 19, 2024
1 parent cd414de commit 07b535a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

* Support loading, viewing, and slicing through TPF data cubes. [#82]

* Default data labels no longer include flux-origin, but do include quarter/campaign/sector. [#111]

0.3.1 - unreleased
------------------

Expand Down
9 changes: 7 additions & 2 deletions lcviz/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ def light_curve_parser(app, file_obj, data_label=None, show_in_viewer=True, **kw
new_data_label = light_curve.meta.get('OBJECT', 'Light curve')

# handle flux_origin default
mission = light_curve.meta.get('MISSION', '').lower()
flux_origin = light_curve.meta.get('FLUX_ORIGIN', None) # i.e. PDCSAP or SAP
if isinstance(light_curve, lightkurve.targetpixelfile.TargetPixelFile):
new_data_label += '[TPF]'
elif flux_origin is not None:
new_data_label += f'[{flux_origin}]'
elif mission == 'kepler':
new_data_label += f' Q{light_curve.meta.get("QUARTER")}'
elif mission == 'k2':
new_data_label += f' C{light_curve.meta.get("CAMPAIGN")}'
elif mission == 'tess':
new_data_label += f' S{light_curve.meta.get("SECTOR")}'

if flux_origin == 'flux' or (flux_origin is None and 'flux' in getattr(light_curve, 'columns', [])): # noqa
# then make a copy of this column so it won't be lost when changing with the flux_column
Expand Down

0 comments on commit 07b535a

Please sign in to comment.