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

process_linelist_batch does not read in param_dic or **kwargs #17

Open
aowen-uwmad opened this issue Aug 2, 2020 · 0 comments
Open
Labels

Comments

@aowen-uwmad
Copy link
Contributor

aowen-uwmad commented Aug 2, 2020

H. Smith, UW - Madison, found the issue that .process_linelist_batch() does not read in user options for passing to the .process_linelist() function.
(the following line numbers are based on the assignment.py file located in /pyspectools/spectra)

param_dict

I think the issue lies in the preprocessing at the start of the function, lines 2433 - 2438:

   if param_dict == yml_path:
       raise ValueError("Please provide arguments to param_dict or yml_path.")
   if yml_path:
       param_dict = routines.read_yaml(yml_path)
       yml_path = Path(yml_path)
       root = yml_path.parents[0]

These are the only two checks of the input. The first check is fine, however if yml_path: reuses the param_dict keyword name and thus overwrites any keywords that the user provides in param_dict in the initial function call. Suggest renaming this variable.

**kwargs

Additional **kwargs are currently not passed to the .process_linelist() function. Currently only the default subdict items generated by the param_dict = routines.read_yaml(yml_path) are being passed in lines 2455, 2457, which appears to affect only the linelist object:

   for name, subdict in param_dict.items():
           ...
           linelist_obj = func(name=name, **subdict)
           ...
           self.process_linelist(name=linelist_obj.name, linelist=linelist_obj)

Suggested fix

The attached code block assumes param_dict > **kwargs and they are .process_linelist() options, and that routines.read_yaml(yml_path) affects only the LineList object.

process_linelist_batch-modified.txt

@laserkelvin laserkelvin added the bug label Aug 6, 2020
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

2 participants