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

Basic outline for new sky catalog search function #1366

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

rebekah9969
Copy link
Collaborator

This PR will create a new function called get_skycatalog.

This is very initial code and the function will likely be captured within another file or function like search.py
LOTS OF REFORMATTING

The goal of this function is to provide the user with a list of stars/objects within a defined region around a requested target.

The returned list contains the proper motion corrected R.A and Dec. positions of the objects in addition to several other parameters.

This tool should be applied to the following TESS products

  • LightCurve Objects
  • TargetPixelFile Objects
  • TESSCut Objects

Eventual use case will be:
mytpf.get_skycatalog()
Returning a table of objects and their parameters.

Several adjustments to be made inclide

  • A check to make sure that the file type input is correct i.e., LC, TPF, TESSCut
  • Adjust the search region to be by default slightly larger than the input TPF or TESSCut size
  • Make the catalog search conduct a box search instead of a radius search
  • Based on the mission keyword make the catalog search be either TIC or KIC etc

@rebekah9969 rebekah9969 added the 💪 WIP This is a work in progress! label Sep 14, 2023
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/get_skycatalog.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
@christinahedges
Copy link
Collaborator

This is looking dangerously close, you need to add

  • An entry to the changelog
  • Update the API reference in the docs folder (docs/source/reference/targetpixelfile.rst) to ensure that your new functionality shows up
  • Optional; add the functionality to a tutorial page

@rebekah9969
Copy link
Collaborator Author

Created a GitHub gist notebook demonstrating how this works.
https://gist.github.com/rebekah9969/3ba956149325acab679e66ae39babb56

@rebekah9969
Copy link
Collaborator Author

The following warning appears when running
tpf.skycatalog
ErfaWarning: ERFA function "pmsafe" yielded 472 of "distance overridden (Note 6)" warnings.warn('ERFA function "{}" yielded {}'.format(func_name, wmsg),

Looking at https://pyerfa.readthedocs.io/en/latest/api/erfa.pmsafe.html note 6

"6) An extremely small (or zero or negative) parallax is overridden
to ensure that the object is at a finite but very large distance,
but not so large that the proper motion is equivalent to a large
but safe speed (about 0.1c using the chosen constant). A warning
status of 1 is added to the status if this action has been taken."

I think that this happens because some stars have zero proper motion - these are listed as "--" in the catalog and as such converted into 0.0 to preserve the original R.A and Dec.
I think that this is probably something we can ignore and catch.

@Nschanche Nschanche mentioned this pull request Nov 10, 2023
Copy link
Collaborator

@orionlee orionlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from using and implementing tpf.interact_sky().

src/lightkurve/targetpixelfile.py Outdated Show resolved Hide resolved
src/lightkurve/utils.py Show resolved Hide resolved
src/lightkurve/targetpixelfile.py Show resolved Hide resolved
@@ -2045,7 +2051,60 @@ def plot_pixels(

return ax

@property
def skycatalog(self):
Copy link
Collaborator

@orionlee orionlee Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A style comment: exposing the list of neighboring TICs/KICs/EPICs via a property tpf.skycatalog could be somewhat misleading from programming point of view.

Conventionally, data exposed via properties tend to be in-memory or easily computed. The tpf.skycatalog here is much more involved.

An alternative is to provide it as a method tpf.query_skycatalog(...), with parameters' default values do what the property currently does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christinahedges what do you think with regards to this?

Copy link
Collaborator

@orionlee orionlee Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the use cases for supporting contamination calculation / PRF, etc,

  1. it might make sense to let users easily customize the catalog to
    a. include stellar companion identified in follow up, and/or
    b. exclude duplicates, artifacts, etc.
    One way to do it is through a method tpf.query_skycatalog(...), something like the following:
# add a stellar companion identified in follow up
cat = tpf.query_skycatalog(additions=[
    dict(id="stellar companion 1", sep=0.3*u.arcsec, angle=Angle(131.3 * u.deg), delta_mag=1),
])

# TIC 237184773 is split to 1715469662, 1715469667
cat = tpf.query_skycatalog(subtractions=[237184773])
  1. Are we concerned about the cases a bright star that is just outside of the tpf, but it significantly affects many pixels inside the tpf?
    This is probably too much of an edge case. I suppose users can workaround it somewhat easily if they can add additional stars, say, via tpf.query_skycatalog(additions=...).

result["Separation"] = sep_pm_correct

# Calculate the relative flux
result["Relative_Flux"] = np.exp(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the relative flux calculation is buggy. np.exp() should probably be replaced by 10 **.

E.g., assume the target star is of magnitude 10, the nearby star is of magnitude 9, i.e., the relative flux is about ~2.512.

np.exp((9 - 10) / -2.5) : 1.492
10 ** ((9 - 10) / -2.5) : 2.512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 WIP This is a work in progress!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants