From aa18ce37f5f384275e4be80c316d1cda2d22ec80 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Sat, 16 Dec 2023 22:38:08 +0800 Subject: [PATCH] fix a bug in finding the first key --- csst_common/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csst_common/io.py b/csst_common/io.py index 79c6296..edb2369 100644 --- a/csst_common/io.py +++ b/csst_common/io.py @@ -97,7 +97,7 @@ def reformat_header(h: fits.Header, strip=True, comment=None): h_copy.remove("HISTORY", ignore_missing=True, remove_all=True) # add new comment assert len(h.cards) > 0 - first_key = list(h.keys())[0] + first_key = list(h_copy.keys())[0] h_copy.add_comment("=" * 72, before=first_key) h_copy.add_comment(comment, before=first_key) h_copy.add_comment("=" * 72, before=first_key) -- GitLab