diff --git a/AUTHORS.rst b/AUTHORS.rst index b5dd6932..68302d9c 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -65,6 +65,7 @@ Alphabetical list of code contributors * Nathan Walker (@walkerna22) * Benjamin Weiner (@bjweiner) * Jiyong Youn (@hletrd) +* Michael Gully-Santiago (@gully) Additional contributors ----------------------- diff --git a/CHANGES.rst b/CHANGES.rst index e2351934..b9820636 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -130,6 +130,8 @@ Bug Fixes - Logging now preserves all of the arguments when the keyword argument names are not used. [#756] +- Workaround malformed header keyword names [#743] + 2.1.0 (2019-12-24) ------------------ diff --git a/ccdproc/image_collection.py b/ccdproc/image_collection.py index b6e17c0a..6f7a5d27 100644 --- a/ccdproc/image_collection.py +++ b/ccdproc/image_collection.py @@ -624,6 +624,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: diff --git a/ccdproc/log_meta.py b/ccdproc/log_meta.py index 41a4a633..963e4f4b 100644 --- a/ccdproc/log_meta.py +++ b/ccdproc/log_meta.py @@ -12,6 +12,7 @@ import ccdproc # Really only need Keyword from ccdproc + __all__ = [] _LOG_ARGUMENT = 'add_keyword'