Skip to content

Fix HDU detection in convenience methods (via _makehdu) - #8666

Merged
saimn merged 3 commits into
astropy:masterfrom
saimn:fits-fix-newhdu
May 24, 2019
Merged

saimn merged 3 commits into
astropy:masterfrom
saimn:fits-fix-newhdu

Conversation

@saimn

@saimn saimn commented May 6, 2019 •

Copy link
Copy Markdown
Contributor

Fix #8660: In 6800eec (EDIT: xref #8502) I removed _BaseHDU.__new__ because when reading from a FITS file this HDU detection was done twice. Instead of reverting this commit I'm adding a new classmethod which can be used to explicitly call the class detection, which allows to avoid the duplicated detection when reading from a file.

@MSeifert04 - do you see any drawback with this approach ?

@saimn saimn added this to the v3.2 milestone May 6, 2019
@saimn
saimn requested a review from MSeifert04 May 6, 2019 19:51
@pllim

pllim commented May 6, 2019

Copy link
Copy Markdown
Member

cc @mcara

@MSeifert04

Copy link
Copy Markdown
Contributor

Puh, these are those kind of consequences that make io.fits so "interesting" 😕

I don't have the time atm to do a proper in-depth review. However if it fixes the reported problem and the test suite doesn't complain it seems like a clear improvement.

@saimn

saimn commented May 10, 2019

Copy link
Copy Markdown
Contributor Author

I could also revert the change to _BaseHDU.__new__, but given that no test was failing because of this, I think it's a good point to avoid the double detection from the header, and introduce this classmethod for specific cases like this one. Hopefully not having the detection in _BaseHDU.__new__ should not have other unintended consequences 🤞

@pllim pllim added Affects-dev PRs and issues that do not impact an existing Astropy release Bug labels May 10, 2019
@pllim

pllim commented May 10, 2019

Copy link
Copy Markdown
Member

@jaytmiller , can you please confirm that works for you?

@pllim

pllim commented May 11, 2019

Copy link
Copy Markdown
Member

Well, that's weird. There is a html-docs error that I don't see on latest master. Maybe rebasing would help?

/home/circleci/project/docs/whatsnew/3.2.rst:98:Inline literal start-string without end-string.

@bsipocz

bsipocz commented May 11, 2019

Copy link
Copy Markdown
Member

I believe that failure got fixed by #8669

@astrofrog

Copy link
Copy Markdown
Member

@saimn - can you rebase? Thanks!

@saimn
saimn force-pushed the fits-fix-newhdu branch from 7723561 to d665d91 Compare May 18, 2019 22:20
@codecov

codecov Bot commented May 18, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #8666 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8666      +/-   ##
==========================================
+ Coverage   86.95%   86.95%   +<.01%     
==========================================
  Files         399      399              
  Lines       59410    59413       +3     
  Branches     1100     1100              
==========================================
+ Hits        51658    51662       +4     
+ Misses       7111     7110       -1     
  Partials      641      641
Impacted Files Coverage Δ
astropy/io/fits/convenience.py 85.76% <100%> (ø) ⬆️
astropy/io/fits/hdu/base.py 90.36% <100%> (+0.04%) ⬆️
astropy/io/fits/hdu/image.py 96.25% <0%> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81a7939...92d2293. Read the comment docs.

@saimn

saimn commented May 18, 2019

Copy link
Copy Markdown
Contributor Author

@astrofrog - Done.

@saimn

saimn commented May 23, 2019

Copy link
Copy Markdown
Contributor Author

Anyone to review/approve? 🙏

@pllim pllim left a comment

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.

No response from Todd, but since he uses astropy dev in his workflow, we'll just go ahead and merge and I am sure he'll find out soon enough. #yolo

@pllim pllim added the zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now. label May 24, 2019
@jaytmiller

Copy link
Copy Markdown

Sorry, I looked this over and was relatively convinced it should work based on the regression test case.

@pllim

pllim commented May 24, 2019

Copy link
Copy Markdown
Member

Doc build is still failing after rebase and its log indicates that it went over the max 10 minutes limit.

...
reading sources... [ 95%] timeseries/times
reading sources... [ 95%] uncertainty/index
Too long with no output (exceeded 10m0s)

Does this PR somehow make the doc build too long? @astrofrog or @Cadair , how do we increase the limit on CircleCI?

@saimn

saimn commented May 24, 2019

Copy link
Copy Markdown
Contributor Author

This PR should not increase the build time, and the error looks similar to the ones with the recent mpl issue. I can try a new rebase to be sure?

@pllim

pllim commented May 24, 2019 •

Copy link
Copy Markdown
Member

I can try a new rebase to be sure?

Feel free to try again. Thanks! (I was playing with the CircleCI buttons and accidentally restarted everything... ops.)

@saimn
saimn force-pushed the fits-fix-newhdu branch from d665d91 to 92d2293 Compare May 24, 2019 20:36
@saimn

saimn commented May 24, 2019

Copy link
Copy Markdown
Contributor Author

All builds pass! Merging since it was approved :)

@saimn
saimn merged commit e556020 into astropy:master May 24, 2019
@saimn
saimn deleted the fits-fix-newhdu branch May 24, 2019 22:12
bsipocz pushed a commit that referenced this pull request May 27, 2019
Fix HDU detection in convenience methods (via _makehdu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release Bug io.fits no-changelog-entry-needed zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Primary HDU checksum data must be np.array?

6 participants