MCPcopy Index your code
hub / github.com/rlabbe/filterpy / to_array

Method to_array

filterpy/common/helpers.py:165–185  ·  view source on GitHub ↗

Convert all saved attributes from a list to np.array. This may or may not work - every saved attribute must have the same shape for every instance. i.e., if `K` changes shape due to `z` changing shape then the call will raise an exception. This can also hap

(self)

Source from the content-addressed store, hash-verified

163 return list(self._DL.keys())
164
165 def to_array(self):
166 """
167 Convert all saved attributes from a list to np.array.
168
169 This may or may not work - every saved attribute must have the
170 same shape for every instance. i.e., if `K` changes shape due to `z`
171 changing shape then the call will raise an exception.
172
173 This can also happen if the default initialization in __init__ gives
174 the variable a different shape then it becomes after a predict/update
175 cycle.
176 """
177 for key in self.keys:
178 try:
179 self.__dict__[key] = np.array(self._DL[key])
180 except:
181 # get back to lists so we are in a valid state
182 self.__dict__.update(self._DL)
183
184 raise ValueError(
185 "could not convert {} into np.array".format(key))
186
187 def flatten(self):
188 """

Callers 13

test_linear_rtsFunction · 0.95
_test_log_likelihoodFunction · 0.95
test_noisy_1dFunction · 0.95
test_immFunction · 0.95
test_1dFunction · 0.95
test_ekfFunction · 0.95
test_1d_const_velFunction · 0.95
test_noisy_1dFunction · 0.95
test_MMAE2Function · 0.95
test_saver_UKFFunction · 0.95
test_saver_kfFunction · 0.95
test_saver_ekfFunction · 0.95

Calls 1

updateMethod · 0.45

Tested by 13

test_linear_rtsFunction · 0.76
_test_log_likelihoodFunction · 0.76
test_noisy_1dFunction · 0.76
test_immFunction · 0.76
test_1dFunction · 0.76
test_ekfFunction · 0.76
test_1d_const_velFunction · 0.76
test_noisy_1dFunction · 0.76
test_MMAE2Function · 0.76
test_saver_UKFFunction · 0.76
test_saver_kfFunction · 0.76
test_saver_ekfFunction · 0.76