[INSTRM-1463] Insert FITS headers into opdb Created: 18/Nov/21  Updated: 18/May/23

Status: Open
Project: Instrument control development
Component/s: ics_gen2Actor
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Normal
Reporter: cloomis Assignee: cloomis
Resolution: Unresolved Votes: 0
Labels: EngRun, SPS, opDB
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Story Points: 1

 Description   

INSTRM-1367 requested header card searches in obslog. That was implemented by adding opdb tables, along with an inserter function.

When we request PFSx file archiving, add the headers. Just PHDU for now.

Sample code was:

import opdb.obslog
import astropy.io.fits as pyfits
from opdb.models import pfs_visit

db = SessionClass()

pfs_visit_id = 66453
filestem = 'PFSA06645311'

hdul = pyfits.HDUList([
  pyfits.PrimaryHDU(header=pyfits.Header([
    ('PI', 3.14, "ratio of a circle's circumference to its diameter"),
  ])),
])

db.add_all(opdb.obslog.fits_headers_from_hdulist(hdul, pfs_visit_id, filestem):
db.commit()


 Comments   
Comment by cloomis [ 30/Mar/22 ]

Bump. Completely forgot about this.

Comment by Kiyoto Yabe [ 15/Apr/22 ]

Do you have time to work on this? I recently noticed that the header search is very useful not only for commissioning but also for our analysis of SuNSS data at IPMU.

Comment by hassan [ 06/Jan/23 ]

cloomisKiyoto Yabe is this something that we need to implement early this year? Say after the Feb 2023 run? Even before the Feb 2023 run might be useful.

Comment by Kiyoto Yabe [ 10/Jan/23 ]

JFYI, `obslog_fits_header` table has been updated manually by michitaro. The command to ingest using a script is something like this:

find /data/raw/ -name PFS*.fits | xargs -r ./.venv/bin/python -m opdb.obslog -d postgresql://dbuser@dbhost/dbname --no-echo register --commit-each
Generated at Sat Feb 10 16:35:45 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.