Skip to content

Commit

Permalink
Merge pull request #183 from stsci-hack/hlet_name_hash
Browse files Browse the repository at this point in the history
Convert WCSNAME to hash for HLET filename
  • Loading branch information
stsci-hack committed Oct 13, 2021
2 parents 0da96cb + be41b4a commit 6290dff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 6290dff

Please sign in to comment.