Beispiel #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)
Beispiel #2
0
    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
Beispiel #3
0
    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