Skip to content

Commit

Permalink
add asdict optional keywork to load_templates_from_header
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Jul 2, 2024
1 parent 5341f54 commit 66a93c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions py/redrock/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,20 @@ def header2templatefiles(hdr, template_dir=None):
return filenames


def load_templates_from_header(hdr, template_dir=None):
def load_templates_from_header(hdr, template_dir=None, asdict=False):
"""Return templates matching header keywords
Args:
hdr: dict-like with keys TEMNAMnn+TEMVERnn and/or TEMFILnn
Options:
template_dir (str): full path to redrock-templates directory
asdict (bool): return dict keyed by (spectype, subtype) instead of list
Returns list of Template objects
"""
template_filenames = header2templatefiles(hdr, template_dir=template_dir)
return load_templates(template_filenames)
return load_templates(template_filenames, asdict=asdict)

def load_templates(template_path=None, zscan_galaxy=None, zscan_star=None, zscan_qso=None,
asdict=False):
Expand Down

0 comments on commit 66a93c7

Please sign in to comment.