-
Notifications
You must be signed in to change notification settings - Fork 270
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
Add method to read bright star catalog and find bright stars in sky region #1105
Merged
kosack
merged 20 commits into
cta-observatory:master
from
moritzhuetten:bright_star_catalog
Jul 18, 2019
Merged
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
402e1ae
get bright star table
moritzhuetten 346c3f4
renamed bright star catalog file to read from ctapipe-extra
moritzhuetten 2ba85a5
improved code quality
moritzhuetten 96c2b77
requested changed added
moritzhuetten f4139b6
style improvements
moritzhuetten 7d57d25
Explicit error message for missing pointing input
moritzhuetten 245d6f5
coding style rules
moritzhuetten b214388
bugfix + better formatting
moritzhuetten 371c631
test added
moritzhuetten 9df553e
smaller radius in test
moritzhuetten e4edb5f
import ctapipe_resources
moritzhuetten b8e6f94
use get_table_dataset, clean up test file
moritzhuetten d9165fc
coding style
moritzhuetten e489e6b
typo correction in comment
moritzhuetten 4a2824e
update environment.yml for ctapipe-extra
moritzhuetten 8873d90
documentation added
moritzhuetten 073be5b
py 3.6 & 3.7 environment files updated
moritzhuetten 83ae6a2
Comply with codacy coding standards
moritzhuetten 3f59b62
add get_bright_stars method to __all__
moritzhuetten 886588c
comma added
moritzhuetten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
from astropy.coordinates import Angle | ||
from astropy.coordinates import SkyCoord | ||
from astropy import units as u | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
__all__ = ['get_bright_stars'] | ||
|
||
|
||
def get_bright_stars(pointing=None, radius=None, magnitude_cut=None): | ||
""" | ||
Returns an astropy table containing star positions above a given magnitude within | ||
a given radius around a position in the sky, using the Yale bright star catalog | ||
which needs to be present in the ctapipe-extra package. The included Yale bright | ||
star catalog contains all 9096 stars, excluding the Nova objects present in the | ||
original catalog from Hoffleit & Jaschek (1991), | ||
http://adsabs.harvard.edu/abs/1991bsc..book.....H, and is complete down to | ||
magnitude ~6.5, while the faintest included star has mag=7.96. | ||
|
||
Parameters | ||
---------- | ||
pointing: astropy Skycoord | ||
pointing direction in the sky | ||
radius: astropy angular units | ||
Radius of the sky region around pointing position. Default: full sky | ||
magnitude_cut: float | ||
Return only stars above a given magnitude. Default: None (all entries) | ||
|
||
Returns | ||
------- | ||
Astropy table: | ||
List of all stars after cuts with names, catalog numbers, magnitudes, | ||
and coordinates | ||
""" | ||
from astropy.table import Table | ||
from ctapipe.utils import get_dataset_path | ||
|
||
catalog = get_dataset_path("yale_bright_star_catalog5.fits.gz") | ||
table = Table.read(catalog) | ||
maxnoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
starpositions = SkyCoord(ra=Angle(table['RAJ2000'], unit=u.deg), | ||
dec=Angle(table['DEJ2000'], unit=u.deg), | ||
frame='icrs', copy=False) | ||
table['ra_dec'] = starpositions | ||
|
||
if magnitude_cut is not None: | ||
table = table[table['Vmag'] < magnitude_cut] | ||
|
||
if radius is not None: | ||
if pointing is None: | ||
raise ValueError('Sky pointing, pointing=SkyCoord(), must be \ | ||
provided if radius is given.') | ||
separations = starpositions.separation(pointing) | ||
maxnoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
table['separation'] = separations | ||
table = table[separations < radius] | ||
|
||
table.remove_columns(['RAJ2000', 'DEJ2000']) | ||
|
||
return table | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this method to
__all__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still missing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now added