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

add unit test demonstrating failure of Brick.brick_radec() on scalar inputs #81

Merged
merged 4 commits into from Sep 7, 2017

Conversation

dstndstn
Copy link
Contributor

@dstndstn dstndstn commented Sep 6, 2017

Fails with:

ERROR: test_brick_radec_scalar (desiutil.test.test_brick.TestBrick)
Test scalar to brick RA,Dec conversion.

Traceback (most recent call last):
File "/Users/dstn/desiutil/py/desiutil/test/test_brick.py", line 258, in test_brick_radec_scalar
ra,dec = b.brick_radec(0., 0.)
File "/Users/dstn/desiutil/py/desiutil/brick.py", line 284, in brick_radec
xra = self._center_ra[irow][icol]
TypeError: only integer scalar arrays can be converted to a scalar index


irow and icol are numpy arrays of integers with one element each.

@weaverba137
Copy link
Member

        if np.isscalar(ra):
            xra = self._center_ra[irow][icol]
            xdec = self._center_dec[irow]

needs to be changed to

        if np.isscalar(ra):
            xra = self._center_ra[irow[0]][icol]
            xdec = self._center_dec[irow]

@weaverba137 weaverba137 added the bug label Sep 6, 2017
@weaverba137
Copy link
Member

Are you intending to include fixes to the large-size bricks in this PR?

Copy link
Member

@weaverba137 weaverba137 left a comment

Choose a reason for hiding this comment

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

I don't know if you intend to include the fixes for large bricks in this PR, but at minimum you need to update the changes.rst file as well.

self.assertEqual(dec, 0.)

def test_brick_radec_array(self):
"""Test scalar to brick RA,Dec conversion.
Copy link
Member

Choose a reason for hiding this comment

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

Please change the __doc__ string. You're testing an array, not a scalar.

@dstndstn
Copy link
Contributor Author

dstndstn commented Sep 6, 2017 via email

@weaverba137
Copy link
Member

Fair enough. I'll merge as soon as the last checks pass.

@weaverba137 weaverba137 merged commit 09955d4 into master Sep 7, 2017
@weaverba137 weaverba137 deleted the brick_radec_bug branch September 7, 2017 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants