Commit 42a0c86a authored by Michele Maris's avatar Michele Maris
Browse files

u

parent ecf91fb6
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -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
    #
@@ -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
@@ -73,6 +78,7 @@ class EnsembleFitting_Base :
        self._success=False
        self._fit=None
        self._fitting_kargs={}
        self._npar=0
    #
    @property
    def fitting_kargs(self) :
@@ -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 :
            return np.array([np.median(k) for k in self._mc.T])
           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