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

ValueError in descriptive.py/moment #80

Open
mk-mccann opened this issue Jul 13, 2022 · 1 comment
Open

ValueError in descriptive.py/moment #80

mk-mccann opened this issue Jul 13, 2022 · 1 comment

Comments

@mk-mccann
Copy link

mk-mccann commented Jul 13, 2022

When running the moment function, I get a ValueError: Function moment does not have variable ci. Giving a confidence interval doesn't change the output.

The issue seems to be related to the bootstrapping wrapper; full error is below:

~\AppData\Local\Temp/ipykernel_26892/2463399625.py in <module>
      1 data = 2*np.pi*np.random.rand(10)
----> 2 mp = circ.moment(data)

~\Miniconda3\envs\prey_capture\lib\site-packages\decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

~\Miniconda3\envs\prey_capture\lib\site-packages\pycircstat-0.0.2-py3.8.egg\pycircstat\descriptive.py in wrapper(f, *args, **kwargs)
     64         def wrapper(f, *args, **kwargs):
     65             args = list(args)
---> 66             ci = self._get_var(f, 'ci', None, args, kwargs, remove=True)
     67             bootstrap_iter = self._get_var(f, 'bootstrap_iter', None,
     68                                            args, kwargs, remove=True)

~\Miniconda3\envs\prey_capture\lib\site-packages\pycircstat-0.0.2-py3.8.egg\pycircstat\descriptive.py in _get_var(self, f, what, default, args, kwargs, remove)
     40             what_idx = varnames.index(what)
     41         else:
---> 42             raise ValueError('Function %s does not have variable %s.' %
     43                              (f.__name__, what))
     44 

ValueError: Function moment does not have variable ci.
@mk-mccann
Copy link
Author

After a bit of digging, this seems to be related to getting function argument names in Python 3 (in the bootstrap class - descriptive.py, line 18). The method func.__code__.co_varnames is depreciated in Python 3.

I found a solution here using the inspect library: inspect.getfullargspec(func).args yields a list of input arguments.

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