Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A workaround for unfixable header keys in ImageFileCollection #743

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Alphabetical list of contributors
* Nathan Walker (@walkerna22)
* Benjamin Weiner (@bjweiner)
* Jiyong Youn (@hletrd)
* Michael Gully-Santiago (@gully)

(If you have contributed to the ccdproc project and your name is missing,
please send an email to the coordinators, or
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Bug Fixes
- ``test_image_collection.py`` in the test suite no longer produces
permanent files on disk and cleans up after itself. [#738]

- Workaround malformed header keyword names [#743]

2.1.0 (2019-12-24)
------------------

Expand Down
10 changes: 10 additions & 0 deletions ccdproc/image_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,16 @@ def _fits_summary(self, header_keywords):
file_path, e)
continue

## Bugfix: Unfixable header keywords sometimes yield duplicate
# entries (probably arises the `_dict_from_fits_header` above)
# For now just check if there are more values than files and
# if so, fill with None for now.
if summary_dict is not None:
for key in summary_dict.keys():
if len(summary_dict[key]) > len(summary_dict['file']):
logger.warning('malformed header keyword %s cannot be understood.',key)
summary_dict[key] = [None]*len(summary_dict['file'])

summary_table = Table(summary_dict, masked=True)

for column in summary_table.colnames:
Expand Down
3 changes: 3 additions & 0 deletions ccdproc/log_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from astropy import units as u
from astropy.io import fits

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
mwcraig marked this conversation as resolved.
Show resolved Hide resolved

import ccdproc # really only need Keyword from ccdproc

__all__ = []
Expand Down