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

io.py find_basis_template does not select most recent template file #575

Open
paulmartini opened this issue Jan 13, 2023 · 0 comments
Open
Assignees
Labels

Comments

@paulmartini
Copy link
Contributor

find_basis_template() is supposed to return the most recent template file in DESI_BASIS_TEMPLATES, yet returns the last element from a glob return value and this is in arbitrary order

    objfile_wild = os.path.join(indir, objtype.lower()+'_templates_*.fits')
    objfiles = glob(objfile_wild)

    if len(objfiles) > 0:
        return objfiles[-1]

Sorting the list produced by glob will fix it:

objfile_wild = os.path.join(indir, objtype.lower()+'_templates_*.fits')
objfiles = glob(objfile_wild)
objfiles.sort(key=os.path.getmtime)

Will submit a PR shortly with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant