Skip to content

Stop recognizing scalar SkyCoord objects as vectors - #274

Merged
eteq merged 4 commits into
astropy:masterfrom
bsipocz:observer_fix_scalar_skycoord
Feb 16, 2017
Merged

eteq merged 4 commits into
astropy:masterfrom
bsipocz:observer_fix_scalar_skycoord

Conversation

@bsipocz

@bsipocz bsipocz commented Dec 21, 2016

Copy link
Copy Markdown
Member

SkyCoords recently (new in astropy 1.3, from astropy/astropy#5254) got an iter attribute inherited from ShapedLikeNDArray, so it's not enough any more to check for the existence of that attribute to distinguish vectors from scalars.

This PR should fix the issue while also gets rid of 19 test failures against astropy dev.

Comment thread astroplan/observer.py Outdated

def _target_is_vector(target):
if hasattr(target, '__iter__'):
if hasattr(target, '__iter__') and not (isinstance(target, SkyCoord)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe just use astropy.utils.isiterable?

@bsipocz

bsipocz commented Jan 22, 2017

Copy link
Copy Markdown
Member Author

Thanks @mhvk for pointing out astropy.utils.isiterable. I think it makes sense to use that everywhere rather than a local function that does the same.

@eteq
eteq merged commit 8969c67 into astropy:master Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants