Skip to content

Commit

Permalink
add rid to FITS header
Browse files Browse the repository at this point in the history
  • Loading branch information
nicHoch committed Nov 14, 2023
1 parent b94f0f8 commit 95a543e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions stixcore/io/fits/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ def generate_filename(cls, product, *, version, date_range, status='', header=Tr
@classmethod
def generate_common_header(cls, filename, product, *, version=0):

user_req = ''
if 'request_id' in product.control.colnames:
rid_entry = np.atleast_1d(product.control['request_id'][0])
if len(rid_entry) > 1:
user_req = f'{rid_entry[1]:010d}-{rid_entry[0]:05d}'
else:
user_req = f"{rid_entry[0]:010d}"

tc_control = ''
if 'tc_packet_seq_control' in product.control.colnames and user_req != '':
tc_control = f'{product.control["tc_packet_seq_control"][0]:05d}'

headers = (
# Name, Value, Comment
('FILENAME', filename, 'FITS filename'),
Expand All @@ -131,7 +143,11 @@ def generate_common_header(cls, filename, product, *, version=0):
('STYPE', product.service_type, 'Service Type'),
('SSTYPE', product.service_subtype, 'Sub-service Type'),
('SSID', product.ssid if product.ssid is not None else '', 'Science Structure ID'),

('SCI_RID', user_req, 'Science data request ID'),
('SCI_TCC', tc_control, 'Science data request TC packet seq. control'),
)

return headers


Expand Down

0 comments on commit 95a543e

Please sign in to comment.