Skip to content

Fits header normalize keywords - #5321

Merged
pllim merged 5 commits into
astropy:masterfrom
crawfordsm:fits_header_normalize_keywords
Dec 2, 2016
Merged

pllim merged 5 commits into
astropy:masterfrom
crawfordsm:fits_header_normalize_keywords

Conversation

@crawfordsm

Copy link
Copy Markdown
Member

Update how a number of tasks work in fits.io.hdu.header such that they are more consistent in how it treats HIERARCH keywords including how they are inserted and removed. For more details see #5313.

Closes #5313

@pllim

pllim commented Sep 9, 2016

Copy link
Copy Markdown
Member

I think this needs a change log entry under "bug fix". Marking it for 1.2.2 but feel free to change if incorrect.

Comment thread astropy/io/fits/tests/test_header.py Outdated
del header['abcdefghij']
header.insert(2, ('abcdefghij', 10))
del header[2]
assert header.keys()[2]=='abcdefg'.upper()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's the reason why the tests failed. In python3 the keys() return a generator. You could cast it to a list:

assert list(header.keys())[2]=='abcdefg'.upper()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another possibility used in other tests is assert header.cards[2].keyword == 'abcdefg'.upper().
It avoids to generate the list of keys.

@astrofrog

Copy link
Copy Markdown
Member

@crawfordsm - could you rebase this?

@astrofrog

Copy link
Copy Markdown
Member

@crawfordsm - actually do you mind if I try and rebase and force push to this branch? I want to see if the 'allow edits from maintainers' option from GitHub now allows me to rebase branches for other people.

@MSeifert04

Copy link
Copy Markdown
Contributor

So, noone is doing the rebase? 😄

@crawfordsm

Copy link
Copy Markdown
Member Author

Sorry, I only saw this now. I'll try to do the rebase this evening.

@crawfordsm

Copy link
Copy Markdown
Member Author

Or if @astrofrog wants to rebase that, it is fine with me. Sorry, I missed the messages on this.

@astrofrog

Copy link
Copy Markdown
Member

@crawfordsm - feel free to go ahead with rebasing :)

@MSeifert04

Copy link
Copy Markdown
Contributor

still needs the rebase 😄

@crawfordsm
crawfordsm force-pushed the fits_header_normalize_keywords branch from 5236541 to 401286f Compare December 1, 2016 13:33
@crawfordsm

Copy link
Copy Markdown
Member Author

Okay, rebased

Comment thread CHANGES.rst
@@ -370,6 +370,8 @@ Bug Fixes
always read as float64. [#5362]

- Fixed memoryleak when using the compression module. [#5399, #5464]

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.

Need a space between entries?

@MSeifert04

Copy link
Copy Markdown
Contributor

Any reason for the tests to run? I think they are triggered by the non-standard commit. Btw: that commit looks weird. 😄

@crawfordsm

Copy link
Copy Markdown
Member Author

No I didn't mean for the tests to run due to a typo. Otherwise, it is just adding a space

@pllim

pllim commented Dec 2, 2016 •

Copy link
Copy Markdown
Member

Since it is approved, merging.

@pllim
pllim merged commit a0862d9 into astropy:master Dec 2, 2016
eteq pushed a commit that referenced this pull request Dec 21, 2016
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.

5 participants