예제 #1
0
 def setUp(self):
     self.weights = np.array(range(100), np.float)
     seed = np.random.randint(1)
     np.random.seed(seed)
     self.i1 = weighted_pick(self.weights)
     np.random.seed(seed)
     self.i2 = wp.weighted_pick_cython(self.weights)
예제 #2
0
파일: _SA_sampler.py 프로젝트: js850/sens
    def sample_minimum(self, Emax):
        """return a minimum sampled uniformly with weight according to phase space volume
        
        Parameters
        ----------
        Emax : float
            the maximum energy for the phase space volume calculation
        """
        # calculate the harmonic phase space volume of each minima and store it in list `weights`
        minima2, weights = self.compute_weights(Emax)

        # select a minimum uniformly given `weights`
        index = weighted_pick_cython(weights)
        m = minima2[index]
        return m
예제 #3
0
파일: _SA_sampler.py 프로젝트: js850/sens
    def sample_minimum(self, Emax):
        """return a minimum sampled uniformly with weight according to phase space volume
        
        Parameters
        ----------
        Emax : float
            the maximum energy for the phase space volume calculation
        """
        # calculate the harmonic phase space volume of each minima and store it in list `weights`
        minima2, weights = self.compute_weights(Emax)

        # select a minimum uniformly given `weights`
        index = weighted_pick_cython(weights)
        m = minima2[index]
        return m