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

Tweak include/exclude args to be lists of ints as needed #184

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions proseco/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pickle
import inspect
import time
import collections
from copy import copy
from pathlib import Path

Expand Down Expand Up @@ -371,12 +372,24 @@ def __init__(self, data=None, **kwargs):
self._default_formats[name] = '.6f'

def set_attrs_from_kwargs(self, **kwargs):

# The include/exclude kwargs appear to need to be undefined or lists of ints
for name in ['include_ids_acq', 'include_halfws_acq', 'include_ids_guide',
'exclude_ids_acq', 'exclude_ids_guide']:
if name in kwargs:
if not isinstance(kwargs[name], collections.Iterable):
kwargs[name] = [int(kwargs[name])]
else:
kwargs[name] = [int(i) for i in kwargs[name]]


for name, val in kwargs.items():
if name in self.allowed_kwargs:
setattr(self, name, val)
else:
raise ValueError(f'unexpected keyword argument "{name}"')


Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.

# If an explicit obsid is not provided to all getting parameters via mica
# then all other params must be supplied.
all_pars = all(getattr(self, x) is not None for x in self.required_attrs)
Expand Down