debug HMC shortcut

This commit is contained in:
Zhenwen Dai 2014-08-07 14:28:46 +01:00
parent e0a7884270
commit c3bb7b28a1
2 changed files with 57 additions and 31 deletions

View file

@ -888,6 +888,25 @@ class Parameterizable(OptimizationHandlable):
self._param_array_ = np.empty(self.size, dtype=np.float64)
return self._param_array_
@property
def unfixed_param_array(self):
"""
Array representing the parameters of this class.
There is only one copy of all parameters in memory, two during optimization.
!WARNING!: setting the parameter array MUST always be done in memory:
m.param_array[:] = m_copy.param_array
"""
if self.__dict__.get('_param_array_', None) is None:
self._param_array_ = np.empty(self.size, dtype=np.float64)
if self.constraints[__fixed__].size !=0:
fixes = np.ones(self.size).astype(bool)
fixes[self.constraints[__fixed__]] = FIXED
return self._param_array_[fixes]
else:
return self._param_array_
@param_array.setter
def param_array(self, arr):
self._param_array_ = arr