Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

updating integer header key to double does not work #49

Closed
juliantaylor opened this issue Jan 23, 2014 · 2 comments
Closed

updating integer header key to double does not work #49

juliantaylor opened this issue Jan 23, 2014 · 2 comments

Comments

@juliantaylor
Copy link

updating a header key that is integer to double format fails wit pyfits 3.2 and current git head:

import pyfits
print pyfits.__version__
f = pyfits.PrimaryHDU()
f.header['TEST'] = 1
h = pyfits.HDUList()
h.append(f)
h.writeto('test.fits', clobber=True)
del h
del f

f = pyfits.open('test.fits', mode='update')
print type(f[0].header['test'])
print 'assign a float'
f[0].header['test'] = 1.0
print 'new type', type(f[0].header['test'])

output:

3.2.dev
Overwriting existing file 'test.fits'.
<type 'int'>
assign a float
new type <type 'int'>

the type remains integer even though I want a float. A work around is to set it to e.g. 1.0000001 which will then trigger the conversion.

@embray
Copy link
Collaborator

embray commented Jan 23, 2014

So basically you want it to show up in the header as 1.0 instead of just 1. That's fairly similar to an issue I recently fixed where True and 1 were treated as identical as well as False/0--clearly wrong. I agree, this should be fixed.

embray added a commit that referenced this issue Jan 27, 2014
git-svn-id: http://svn6.assembla.com/svn/pyfits/trunk@2505 ed100bfc-0583-0410-97f2-c26b58777a21
@embray
Copy link
Collaborator

embray commented Jan 27, 2014

Should be fixed.

@embray embray closed this as completed Jan 27, 2014
embray added a commit that referenced this issue Jan 30, 2014
Conflicts:

	CHANGES.txt

git-svn-id: http://svn6.assembla.com/svn/pyfits/branches/3.1-stable@2504 ed100bfc-0583-0410-97f2-c26b58777a21
embray added a commit that referenced this issue Jan 30, 2014
Conflicts:

	CHANGES.txt

git-svn-id: http://svn6.assembla.com/svn/pyfits/branches/3.1-stable@2514 ed100bfc-0583-0410-97f2-c26b58777a21
embray added a commit that referenced this issue Jan 30, 2014
git-svn-id: http://svn6.assembla.com/svn/pyfits/branches/3.2-stable@2503 ed100bfc-0583-0410-97f2-c26b58777a21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants