Ejemplo n.º 1
0
    def processGrid(self):
        """Process imageset of (Qx, Qy, Qz, I) into grid

        This function, process the set of (Qx, Qy, Qz, I) values and grid the data."""
        print("---- Total data is %f MBytes\n" % (self.totSet.nbytes / 1024.0**2))

        if self.totSet is None:
            raise Exception("No set of (Qx, Qy, Qz, I). Cannot process grid.")

        # prepare min, max,... from defaults if not set
        if self.Qmin is None:
            self.Qmin = np.array([ self.totSet[:,0].min(), self.totSet[:,1].min(), self.totSet[:,2].min() ])
        if self.Qmax is None:
            self.Qmax = np.array([ self.totSet[:,0].max(), self.totSet[:,1].max(), self.totSet[:,2].max() ])
        if self.dQN is None:
            self.dQN = [100, 100, 100]

        # 3D grid of the data set
        print("**** Gridding Data.")
        t1 = time.time()
        gridData, gridOccu, gridStdErr, gridOut = ctrans.grid3d(self.totSet, self.Qmin, self.Qmax, self.dQN, norm = 1)
        t2 = time.time()
        print("---- DONE (Processed in %f seconds)" % (t2 - t1))
        emptNb = (gridOccu == 0).sum()
        if gridOut != 0:
            print("---- Warning : There are %.2e points outside the grid (%.2e bins in the grid)" % (gridOut, gridData.size))
        if emptNb:
            print("---- Warning : There are %.2e values zero in the grid" % emptNb)

       # store intensity, occupation and no. of outside data points of the grid
        self.gridData   = gridData
        self.gridOccu   = gridOccu
        self.gridOut    = gridOut
        self.gridStdErr = gridStdErr
Ejemplo n.º 2
0
    def processGrid(self):
        """Process imageset of (Qx, Qy, Qz, I) into grid

        This function, process the set of (Qx, Qy, Qz, I) values and grid the data."""
        print("---- Total data is %f MBytes\n" %
              (self.totSet.nbytes / 1024.0**2))

        if self.totSet is None:
            raise Exception("No set of (Qx, Qy, Qz, I). Cannot process grid.")

        # prepare min, max,... from defaults if not set
        if self.Qmin is None:
            self.Qmin = np.array([
                self.totSet[:, 0].min(), self.totSet[:, 1].min(),
                self.totSet[:, 2].min()
            ])
        if self.Qmax is None:
            self.Qmax = np.array([
                self.totSet[:, 0].max(), self.totSet[:, 1].max(),
                self.totSet[:, 2].max()
            ])
        if self.dQN is None:
            self.dQN = [100, 100, 100]

        # 3D grid of the data set
        print("**** Gridding Data.")
        t1 = time.time()
        gridData, gridOccu, gridStdErr, gridOut = ctrans.grid3d(self.totSet,
                                                                self.Qmin,
                                                                self.Qmax,
                                                                self.dQN,
                                                                norm=1)
        t2 = time.time()
        print("---- DONE (Processed in %f seconds)" % (t2 - t1))
        emptNb = (gridOccu == 0).sum()
        if gridOut != 0:
            print(
                "---- Warning : There are %.2e points outside the grid (%.2e bins in the grid)"
                % (gridOut, gridData.size))
        if emptNb:
            print("---- Warning : There are %.2e values zero in the grid" %
                  emptNb)

    # store intensity, occupation and no. of outside data points of the grid
        self.gridData = gridData
        self.gridOccu = gridOccu
        self.gridOut = gridOut
        self.gridStdErr = gridStdErr
Ejemplo n.º 3
0
def griddata(data, size):

    gridData, gridOccu, gridOut = ctrans.grid3d(data,
                                                array([-1.0, -1.0, -1.0]),
                                                array([1.0, 1.0, 1.0]),
                                                array([size, size, size]), norm = 1)
    print "gridout = ", gridOut,
    print "gridOccu sum = ", gridOccu.sum(),
    boxsize = size / 8
    midp = size / 2
    box = gridData[midp-boxsize:midp+boxsize+1,
                   midp-boxsize:midp+boxsize+1,
                   midp-boxsize:midp+boxsize+1]
    boxOccu = gridOccu[midp-boxsize:midp+boxsize+1,
                       midp-boxsize:midp+boxsize+1,
                       midp-boxsize:midp+boxsize+1]
    print (boxOccu == 0).sum(), 
    print gridData.sum(), box.sum() / (size**3),
    print boxOccu.size / (boxOccu != 0).sum(),
Ejemplo n.º 4
0
def griddata(data, size):

    gridData, gridOccu, gridOut = ctrans.grid3d(data,
                                                array([-1.0, -1.0, -1.0]),
                                                array([1.0, 1.0, 1.0]),
                                                array([size, size, size]),
                                                norm=1)
    print "gridout = ", gridOut,
    print "gridOccu sum = ", gridOccu.sum(),
    boxsize = size / 8
    midp = size / 2
    box = gridData[midp - boxsize:midp + boxsize + 1,
                   midp - boxsize:midp + boxsize + 1,
                   midp - boxsize:midp + boxsize + 1]
    boxOccu = gridOccu[midp - boxsize:midp + boxsize + 1,
                       midp - boxsize:midp + boxsize + 1,
                       midp - boxsize:midp + boxsize + 1]
    print(boxOccu == 0).sum(),
    print gridData.sum(), box.sum() / (size**3),
    print boxOccu.size / (boxOccu != 0).sum(),