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

IGRINS: Make a reusable function for classifying IGRINS input based on its filename #144

Open
gully opened this issue Jun 30, 2023 · 0 comments

Comments

@gully
Copy link
Member

gully commented Jun 30, 2023

We have a few instances of repeating the same pattern for classifying IGRINS data based on its filename alone. For example:

if ".spec_a0v.fits" in filepath: #Grab base file name for the uncertainity file
        path_base = filepath[:-14]
    elif ".spec_flattened.fits" in filepath:
        path_base = filepath[:-20]
    elif ".spec.fits" in filepath:
        path_base = filepath[:-10]

We should put this in to a modular function:

def classify_IGRINS_filename(filename):
    [...] # do logic testing
   return {'band':band, 'reduction_type':reduction_type, 'basename':basename, 'is_http':is_http, 'path_base':path_base, 'index':index}

This should streamline lots of methods that reapply the same logic, and should futureproof against future methods that need these qualifiers in order to process the data. For example, knowing if the file is online versus local changes the way we would search for the existence or not of ancillary files.

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

No branches or pull requests

1 participant