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

AttributeError: 'LinCombV' object has no attribute 'ncoefs' #121

Open
xushanthu-2014 opened this issue Aug 24, 2023 · 1 comment
Open

AttributeError: 'LinCombV' object has no attribute 'ncoefs' #121

xushanthu-2014 opened this issue Aug 24, 2023 · 1 comment

Comments

@xushanthu-2014
Copy link

I installed rt1 under conda environment of python 3.10 using the command pip install rt1[full].
Then I tried the example https://github.com/TUW-GEO/rt1/blob/master/doc/examples/example_lin_comb.ipynb. But when I was running

res = pd.DataFrame(dict(zip(('tot','surf','vol','inter'), R.calc())), index=inc)

I got the error like:

runcell(6, '/Users/xushan/research/TUD/test_jackknife/rt1/toy_example.py')
Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 309, in _get_fnevals
    return self.__fnevals

AttributeError: 'RT1' object has no attribute '_RT1__fnevals'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 275, in _get_fn
    return self.__fn

AttributeError: 'RT1' object has no attribute '_RT1__fn'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/xushan/research/TUD/test_jackknife/rt1/toy_example.py", line 71, in <module>
    res = pd.DataFrame(dict(zip(('tot','surf','vol','inter'), R.calc())), index=inc)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 690, in calc
    Iint = self.interaction()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 1228, in interaction
    Fint1 = self._calc_Fint_1()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 1268, in _calc_Fint_1
    fn = np.broadcast_arrays(*self._fnevals(args))

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 311, in _get_fnevals
    self._set_fnevals(self._fnevals_input)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 340, in _set_fnevals
    self.fn,

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 277, in _get_fn
    self._set_fn(self.fn_input)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 292, in _set_fn
    expr_int = self._calc_interaction_expansion()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 545, in _calc_interaction_expansion
    volexp = self.V.legexpansion(

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/volume.py", line 325, in legexpansion
    assert self.ncoefs > 0

AttributeError: 'LinCombV' object has no attribute 'ncoefs'

So what happened? Could you please help me to solve this issue? Thanks!

@xushanthu-2014
Copy link
Author

xushanthu-2014 commented Sep 2, 2023

I checked the source code, it seems that you need to do Vcomb = V._Vcombiner() if you want to run a linear combination of volume phase functions, for example, HG functions. Unfortunately, this is not the case in the related demo codes (https://github.com/TUW-GEO/rt1/blob/master/doc/examples/example_lin_comb.ipynb).

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