Exemplo n.º 1
0
    def mc_sample(self, nruns):
        """Monte carlo sampled parameter values
        Return a defined set (nruns values) of Monte Carlo sampled parameter
        values from the parameter distribution.

        Parameters
        ----------
        nruns : int
            Number of Monte Carlo samples to take

        Returns
        --------
        mcsample : array
            Numpy array with the specified number of Monte Carlo samples

        """
        if self.pardistribution == 'randomUniform':
            return randomUniform(left=self.min, right=self.max,
                                 rnsize=nruns)
        #        if self.pardistribution == 'discreteUniform':
        #            return randomUniform(left = self.min, right = self.max,
        #                                 rnsize = nruns)
        elif self.pardistribution == 'randomTriangular':
            return randomTriangular(left = self.min, mode = self.mode,
                                    right = self.max, rnsize = nruns)
        elif self.pardistribution == 'randomTrapezoidal':
            return randomTrapezoidal(left = self.min, mode1 = self.mode1,
                                     mode2 = self.mode2, right = self.max,
                                     rnsize = nruns)
        elif self.pardistribution == 'randomNormal':
            return randomNormal(mu = self.mu, sigma = self.sigma,
                                rnsize = nruns)
        elif self.pardistribution == 'randomLogNormal':
            return randomLogNormal(mu = self.mu, sigma = self.sigma,
                                   rnsize = nruns)
Exemplo n.º 2
0
 def avalue(self):
     """return single sampled value
     Return a single Monte Carlo sampled parameter
     value from the parameter distribution.
     """
     if self.pardistribution == 'randomUniform':
         return randomUniform(left=self.min, right=self.max,
                              rnsize=1)[0]
     elif self.pardistribution == 'randomTriangular':
         return randomTriangular(left=self.min, mode=self.mode,
                                 right=self.max, rnsize=1)[0]
     elif self.pardistribution == 'randomTrapezoidal':
         return randomTrapezoidal(left=self.min, mode1=self.mode1,
                                  mode2=self.mode2, right=self.max,
                                  rnsize=1)[0]
     elif self.pardistribution == 'randomNormal':
         return randomNormal(mu=self.mu, sigma=self.sigma,
                             rnsize=1)[0]
     elif self.pardistribution == 'randomLogNormal':
         return randomLogNormal(mu=self.mu, sigma=self.sigma,
                                rnsize=1)[0]
Exemplo n.º 3
0
 def avalue(self):
     """return single sampled value
     Return a single Monte Carlo sampled parameter
     value from the parameter distribution.
     """
     if self.pardistribution == 'randomUniform':
         return randomUniform(left=self.min, right=self.max, rnsize=1)[0]
     elif self.pardistribution == 'randomTriangular':
         return randomTriangular(left=self.min,
                                 mode=self.mode,
                                 right=self.max,
                                 rnsize=1)[0]
     elif self.pardistribution == 'randomTrapezoidal':
         return randomTrapezoidal(left=self.min,
                                  mode1=self.mode1,
                                  mode2=self.mode2,
                                  right=self.max,
                                  rnsize=1)[0]
     elif self.pardistribution == 'randomNormal':
         return randomNormal(mu=self.mu, sigma=self.sigma, rnsize=1)[0]
     elif self.pardistribution == 'randomLogNormal':
         return randomLogNormal(mu=self.mu, sigma=self.sigma, rnsize=1)[0]
Exemplo n.º 4
0
    def mc_sample(self, nruns):
        """Monte carlo sampled parameter values
        Return a defined set (nruns values) of Monte Carlo sampled parameter
        values from the parameter distribution.

        Parameters
        ----------
        nruns : int
            Number of Monte Carlo samples to take

        Returns
        --------
        mcsample : array
            Numpy array with the specified number of Monte Carlo samples

        """
        if self.pardistribution == 'randomUniform':
            return randomUniform(left=self.min, right=self.max, rnsize=nruns)
        #        if self.pardistribution == 'discreteUniform':
        #            return randomUniform(left = self.min, right = self.max,
        #                                 rnsize = nruns)
        elif self.pardistribution == 'randomTriangular':
            return randomTriangular(left=self.min,
                                    mode=self.mode,
                                    right=self.max,
                                    rnsize=nruns)
        elif self.pardistribution == 'randomTrapezoidal':
            return randomTrapezoidal(left=self.min,
                                     mode1=self.mode1,
                                     mode2=self.mode2,
                                     right=self.max,
                                     rnsize=nruns)
        elif self.pardistribution == 'randomNormal':
            return randomNormal(mu=self.mu, sigma=self.sigma, rnsize=nruns)
        elif self.pardistribution == 'randomLogNormal':
            return randomLogNormal(mu=self.mu, sigma=self.sigma, rnsize=nruns)