bayesloop icon indicating copy to clipboard operation
bayesloop copied to clipboard

'dict_keys' object has no attribute 'index' error when following 'Anomalous diffusion' example in docs

Open dmbrady01 opened this issue 7 years ago • 3 comments

Hello, I'm using python 3.6.5 and I get the following error when trying to run through the Anomalous diffusion example:

.../bayesloop/transitionModels.py in computeForwardPrior(self, posterior, t)
    100             ndarray: Prior parameter distribution for subsequent time step
    101         """
--> 102         axisToTransform = self.study.observationModel.parameterNames.index(self.selectedParameter)
    103         normedSigma = self.hyperParameterValues[0]/self.latticeConstant[axisToTransform]
    104 

AttributeError: 'dict_keys' object has no attribute 'index'

The line of code in the example: L = bl.om.SymPy(normal, {'D': bl.oint(0, 15, 5000)})

Should be changed to: L = bl.om.SymPy(normal, 'D', bl.oint(0, 15, 5000))

Unless you want to deal with version issues for indexing dict_keys.

dmbrady01 avatar Sep 13 '18 10:09 dmbrady01

You're right, the dictionary was part of an older syntax for SymPy models. Thanks for pointing it out. Fixed in the lastest docs (e364aa8).

christophmark avatar Sep 18 '18 07:09 christophmark

Hi, In this version of the docs, the issue is still present in the tutorial: http://docs.bayesloop.com/en/latest/examples/anomalousdiffusion.html

BenediktK avatar May 13 '23 17:05 BenediktK

Hi @BenediktK, thanks for pointing this out! The docs haven't been updated in a long time, will try to do the update soon!

christophmark avatar May 16 '23 07:05 christophmark