TUW-GEO/rt1

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

Opened this issue · 1 comments

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!

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).