Beispiel #1
0
    def fill(self, arr, vle_min=-1.0, vle_max=1.0):
        """Fills numpy array with random numbers.

        Parameters:
            arr: numpy array.
            vle_min: minimum value in random distribution.
            vle_max: maximum value in random distribution.
        """
        arr = ravel(arr)
        arr[:] = (my_random.rand(arr.size) * (vle_max - vle_min) + vle_min)[:]
Beispiel #2
0
    def fill(self, arr, vle_min=-1.0, vle_max=1.0):
        """Fills numpy array with random numbers.

        Parameters:
            arr: numpy array.
            vle_min: minimum value in random distribution.
            vle_max: maximum value in random distribution.
        """
        arr = ravel(arr)
        arr[:] = (my_random.rand(arr.size) * (vle_max - vle_min) +
                  vle_min)[:]
Beispiel #3
0
    def fill_normal_real(self, arr, mean, stddev, clip_to_sigma=5.0):
        """
        #Fills real-valued numpy array with random normal distribution.

        #Parameters:
        #    arr: numpy array.
        #    mean:
        #    stddev:
        #    min_val, max_val (optional): clipping values of output data.
        """
        arr = ravel(arr)
        arr[:] = my_random.normal(loc=mean, scale=stddev, size=arr.size)[:]

        numpy.clip(arr, mean - clip_to_sigma * stddev,
                   mean + clip_to_sigma * stddev, out=arr)
Beispiel #4
0
    def fill_normal_real(self, arr, mean, stddev, clip_to_sigma=5.0):
        """
        #Fills real-valued numpy array with random normal distribution.

        #Parameters:
        #    arr: numpy array.
        #    mean:
        #    stddev:
        #    min_val, max_val (optional): clipping values of output data.
        """
        arr = ravel(arr)
        arr[:] = my_random.normal(loc=mean, scale=stddev, size=arr.size)[:]

        numpy.clip(arr,
                   mean - clip_to_sigma * stddev,
                   mean + clip_to_sigma * stddev,
                   out=arr)
Beispiel #5
0
 def plain(self):
     return ravel(self.mem)
Beispiel #6
0
 def plain(self):
     return ravel(self.mem)