Loading src/yapsut/montecarlo_fitting.py +28 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ class EnsembleFitting_Base : self._initial_values=this # @property def npar(self) : return self._npar # @property def param_names(self) : return self._param_names # Loading @@ -27,6 +31,7 @@ class EnsembleFitting_Base : @Model.setter def Model(self,Model,param_names) : self._param_names=param_names self._npar=len(param_names) self._Model=this # @property Loading Loading @@ -73,6 +78,7 @@ class EnsembleFitting_Base : self._success=False self._fit=None self._fitting_kargs={} self._npar=0 # @property def fitting_kargs(self) : Loading Loading @@ -145,13 +151,32 @@ class EnsembleFitting_Base : return out # @property def montecarlo_ensemble_averages(self) : """returns the ensemble averaged values from the montecarlo simulation""" def montecarlo_ensemble_averages(self,useMedian=True) : """returns the ensemble averaged values from the montecarlo simulation :keywords: useMedian == True (default) uses np.median() to extract the column average, otherwise uses np.mean() """ try : if useMedian == True : return np.array([np.median(k) for k in self._mc.T]) else : return np.array([np.mean(k) for k in self._mc.T]) except : return np.ones(len(self._param_names))+np.nan # @property def montecarlo_ensemble_std(self,useMedian=True) : """returns the ensemble covariance matrix from the montecarlo simulation""" out = self._mc.std(axis=0) return out # @property def montecarlo_ensemble_covariance(self) : """returns the ensemble covariance matrix from the montecarlo simulation""" out = np.cov(self._mc.T) return out # def montecarlo_cdf(self) : """returns a dictionary with the cdf for the montecarlo simulations. CDF are instatiations of .stats/CumulativeOfData so they are interpolating functions Loading Loading
src/yapsut/montecarlo_fitting.py +28 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,10 @@ class EnsembleFitting_Base : self._initial_values=this # @property def npar(self) : return self._npar # @property def param_names(self) : return self._param_names # Loading @@ -27,6 +31,7 @@ class EnsembleFitting_Base : @Model.setter def Model(self,Model,param_names) : self._param_names=param_names self._npar=len(param_names) self._Model=this # @property Loading Loading @@ -73,6 +78,7 @@ class EnsembleFitting_Base : self._success=False self._fit=None self._fitting_kargs={} self._npar=0 # @property def fitting_kargs(self) : Loading Loading @@ -145,13 +151,32 @@ class EnsembleFitting_Base : return out # @property def montecarlo_ensemble_averages(self) : """returns the ensemble averaged values from the montecarlo simulation""" def montecarlo_ensemble_averages(self,useMedian=True) : """returns the ensemble averaged values from the montecarlo simulation :keywords: useMedian == True (default) uses np.median() to extract the column average, otherwise uses np.mean() """ try : if useMedian == True : return np.array([np.median(k) for k in self._mc.T]) else : return np.array([np.mean(k) for k in self._mc.T]) except : return np.ones(len(self._param_names))+np.nan # @property def montecarlo_ensemble_std(self,useMedian=True) : """returns the ensemble covariance matrix from the montecarlo simulation""" out = self._mc.std(axis=0) return out # @property def montecarlo_ensemble_covariance(self) : """returns the ensemble covariance matrix from the montecarlo simulation""" out = np.cov(self._mc.T) return out # def montecarlo_cdf(self) : """returns a dictionary with the cdf for the montecarlo simulations. CDF are instatiations of .stats/CumulativeOfData so they are interpolating functions Loading