Commit 11b366fd authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

tweaks

parent 788497ee
Pipeline #10162 failed with stage
in 0 seconds
......@@ -9,6 +9,7 @@ Modified-History:
2023-12-15, Bo Zhang, added verify_checksum and append_header, add module header
2023-12-16, Bo Zhang, fixed a bug in finding the first key when reformatting
2024-06-08, Bo Zhang, added delete_section
2025-08-05, Bo Zhang, added generate_meta
"""
import os
......@@ -16,14 +17,14 @@ import json
import bisect
import warnings
from copy import deepcopy
from typing import Optional
from typing import Optional, Any
from astropy.io import fits
REQUIRED_KEYS_IN_META = dict(
# 观测数据相关的ID参数
dataset="__instrument__",
dataset="__dataset__",
instrument="__instrument__",
obs_type="__obs_type__",
obs_group="__obs_group__",
......@@ -56,7 +57,7 @@ def generate_meta(**kwargs) -> fits.Header:
Parameters
----------
kwargs : dict
kwargs : Any
Meta data.
Returns
......
......@@ -13,7 +13,13 @@ import unittest
from astropy.io import fits
from csst_common.io import append_header, reformat_header, delete_section, get_proc_info
from csst_common.io import (
append_header,
reformat_header,
delete_section,
get_proc_info,
generate_meta,
)
class TestFitsHeaderOps(unittest.TestCase):
......@@ -122,3 +128,7 @@ class TestFitsHeaderOps(unittest.TestCase):
def test_get_proc_info(self):
proc_info = get_proc_info()
self.assertEquals(proc_info["BUILD"], "-")
def test_generate_meta(self):
h = generate_meta()
self.assertIsInstance(h, fits.Header)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment