Skip to content

Loose identity test of a HCOMPRESSed image - #4659

Merged
pllim merged 1 commit into
astropy:masterfrom
olebole:fix_test_comp_image_hcompress_image_stack
Feb 8, 2017
Merged

pllim merged 1 commit into
astropy:masterfrom
olebole:fix_test_comp_image_hcompress_image_stack

Conversation

@olebole

@olebole olebole commented Mar 2, 2016

Copy link
Copy Markdown
Member

HCOMPRESSed images are allowed to deviate from the original by about 1/quantize_level of the RMS in each tile. This patch changes the absolute identity test to a comparison with an accuracy up to the
mentioned level.
This fixes #4647, if the cause I assume is correct. Someone with insight in HCOMPRESS_1 and cfitsio should check this carefully, however so that no real problem is going to be hidden here.

@astrofrog

Copy link
Copy Markdown
Member

@embray - would you mind taking a quick look at this?

@astrofrog

Copy link
Copy Markdown
Member

@olebole - please add a changelog entry - if it's an issue that existed for astropy 1.0.x too, then please add it in the latest 1.0.x release, otherwise in the latest 1.1.x release.

@olebole
olebole force-pushed the fix_test_comp_image_hcompress_image_stack branch 2 times, most recently from 62fdf22 to 3518cae Compare May 18, 2016 13:24
@olebole

olebole commented May 19, 2016

Copy link
Copy Markdown
Member Author

@astrofrog I added a changelog entry -- however in the master branch, since I had difficulties to rebase this. If required, I can do it again, but I would need some advise (maybe by gitter).

@embray embray added the Affects-dev PRs and issues that do not impact an existing Astropy release label May 24, 2016
@embray

embray commented May 24, 2016

Copy link
Copy Markdown
Member

We don't need a changelog entry if it just affects a test. +1 to the change otherwise.


with fits.open(self.temp('test.fits')) as hdul:
assert (hdul['SCI'].data == cube).all()
assert np.abs(hdul['SCI'].data - cube).max() < 1./15.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe also specifically mention in a comment what you wrote in the issue concerning 1 / quantize_level. Otherwise this looks a bit mysterious.

@olebole
olebole force-pushed the fix_test_comp_image_hcompress_image_stack branch from 3518cae to 39b8390 Compare May 24, 2016 13:53
assert (hdul['SCI'].data == cube).all()
# HCOMPRESSed images are allowed to deviate from the original by
# about 1/quantize_level of the RMS in each tile.
assert np.abs(hdul['SCI'].data - cube).max() < 1./15.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@olebole - I'm not too familiar with this, but isn't the quantize level 16 not 15, and does this assume the RMS is 1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

1/16 was a bit too low, so that I assume there is an off-by-one somewhere in the docs or in my understanding.

@mhvk

mhvk commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

@olebole - this looks ready to go in, except there is a pep8 error:

astropy/io/fits/tests/test_image.py:1014:62: W291 trailing whitespace

Could you fix this? (I just tried editing the file on-line, but don't seem to have push access for this PR)

@bsipocz

bsipocz commented Feb 8, 2017

Copy link
Copy Markdown
Member

@mhvk - labels need to be revised (I assume this is affects-release now), and needs a milestone.

@mhvk mhvk removed the Affects-dev PRs and issues that do not impact an existing Astropy release label Feb 8, 2017
@mhvk mhvk added this to the v1.0.12 milestone Feb 8, 2017
HCOMPRESSed images are allowed to deviate from the original by
about 1/quantize_level of the RMS in each tile. This patch changes
the absolute identity test to a comparison with an accuracy up to the
mentioned level.
This fixes astropy#4647, if the cause I assume is correct. Someone with insight in
HCOMPRESS should check this carefully, however.
@olebole
olebole force-pushed the fix_test_comp_image_hcompress_image_stack branch from af7c10a to f476436 Compare February 8, 2017 07:51
@olebole

olebole commented Feb 8, 2017

Copy link
Copy Markdown
Member Author

@mhvk I fixed this now. Thanks for the hint.

@pllim

pllim commented Feb 8, 2017

Copy link
Copy Markdown
Member

CircleCI failed -- Is it related?

@bsipocz

bsipocz commented Feb 8, 2017

Copy link
Copy Markdown
Member

@pllim - CircleCI failure looks unrelated, and I'm not yet sure it's a real failure or just a temporary fluke.

@pllim

pllim commented Feb 8, 2017

Copy link
Copy Markdown
Member

So looks like multiple people have reviewed and we got a 👍 from Erik B, so merging. Thanks!

@pllim
pllim merged commit cf0e047 into astropy:master Feb 8, 2017
@olebole
olebole deleted the fix_test_comp_image_hcompress_image_stack branch February 8, 2017 15:45
bsipocz pushed a commit that referenced this pull request Feb 14, 2017
…mage_stack

Loose identity test of a HCOMPRESSed image
@bsipocz

bsipocz commented Feb 14, 2017

Copy link
Copy Markdown
Member

backported to 1.0.x in 530451c

bsipocz pushed a commit that referenced this pull request Feb 14, 2017
…mage_stack

Loose identity test of a HCOMPRESSed image
bsipocz pushed a commit to bsipocz/astropy that referenced this pull request Mar 5, 2017
…press_image_stack

Loose identity test of a HCOMPRESSed image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_comp_image_hcompress_image_stack with cfitsio 3.380

6 participants