Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert WCSNAME to hash for HLET filename #183

Merged
merged 3 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1.7.1 (Unreleased)
------------------
- Filenames for new headerlet files based on updated/new
IDCTABs now based on hash of WCSNAME instead of WCSNAME itself. [#183]


1.7.0 (2021-08-10)
------------------
Expand Down
7 changes: 5 additions & 2 deletions stwcs/updatewcs/astrometry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import os
import sys
import atexit
import hashlib

import requests
from io import BytesIO
Expand Down Expand Up @@ -473,7 +474,8 @@ def apply_new_apriori(self, obsname):
hlet_names = [obsname[('hdrlet', e)].header['wcsname'] for e in hlet_extns]

if wname not in hlet_names:
hdrname = "{}_{}".format(filename.replace('.fits', ''), wname)
wname_hash = hashlib.sha1(wname.encode()).hexdigest()[:6]
hdrname = "{}_{}".format(filename.replace('.fits', ''), wname_hash)
# Create full filename for headerlet:
hfilename = "{}_hlet.fits".format(hdrname)
logger.info("Archiving pipeline-default WCS {} to {}".format(wname, filename))
Expand Down Expand Up @@ -506,7 +508,8 @@ def apply_new_apriori(self, obsname):
wname = 'IDC_{}'.format(idcroot)
# Compute and add new solution if it is not already an alternate WCS
# Save this new WCS as a headerlet extension and separate headerlet file
hdrname = "{}_{}".format(filename.replace('.fits', ''), wname)
wname_hash = hashlib.sha1(wname.encode()).hexdigest()[:6]
hdrname = "{}_{}".format(filename.replace('.fits', ''), wname_hash)
# Create full filename for headerlet:
hfilename = "{}_hlet.fits".format(hdrname)

Expand Down