fits.append() does not support documented fits.open() kwargs
See original GitHub issueAccording to the append()
documentation, it supports the kwargs
that are supported in the open()
function:
http://docs.astropy.org/en/stable/io/fits/api/files.html#astropy.io.fits.append
However, I tried to use the scale_back
kwarg
value, but got this error:
TypeError: writeto() got an unexpected keyword argument 'scale_back'
To reproduce:
import tempfile
import numpy as np
from astropy.io import fits
def github_issue():
_, file_path = tempfile.mkstemp(prefix='test_file_', suffix='.fits')
with open(file_path, 'ab+') as append_test_file_handle:
fits.append(filename=append_test_file_handle, data=np.empty((4,4)), overwrite=False, output_verify='silentfix', checksum=False, scale_back=True)
github_issue()
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
File Handling and Convenience Functions — Astropy v5.1.1
Factory function to open a FITS file and return an HDUList object. ... Open mode, 'readonly', 'update', 'append', 'denywrite', or 'ostream'. Default is...
Read more >FITS append/update is broken in Python 3.x #7854 - GitHub
When appending to a FITS file using the astropy.io.fits.append() method, there is an error in Python 3.x.
Read more >File Handling and Convenience Functions - Read the Docs
Factory function to open a FITS file and return an HDUList object. ... If the file was opened in update or append mode,...
Read more >File Handling and Convenience Functions — Astropy v1.0.4
Factory function to open a FITS file and return an HDUList object. ... If the file was opened in update or append mode,...
Read more >15_PyFITS - | notebook.community
Originally you used PyFITS to work with FITS files in Python, this was a wrapper around ... Also differs from list.append() in that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking at this with fresh eyes, I think that there are several things to do, because the inner function that is used is not always the same:
if the file does not exist,
writeto
is used, and kwargs are passed here. The only option that can be used here isoutput_verify
. We can keep it like this and document this properly.if the file exists, and filename is a string,
fits.open
is used. Here we need to pass kwargs.if the file exists, and filename is a file object, there is no additional argument to pass. We could maybe check that kwargs is empty and raise a warning if it is not empty ?
Hello. My test case above still fails with version 3.1 (hash: 743055cada122d6da8704ad28452806690679ef5). This issue is not holding me up anymore as I’ve worked around it for now, but the bug persists.
Thanks!