Example #1
0
    def run(self):
        """
        Run the algorithm, which computes and returns the grid in C_CONTIGUOUS order partitioned by ranks.
        """
        from nbodykit import measurestats

        if self.comm.rank == 0:
            self.logger.info("importing done")
            self.logger.info("Resolution Nmesh : %d" % self.paintNmesh)
            self.logger.info("paintbrush : %s" % self.painter.paintbrush)

        # setup the particle mesh object, taking BoxSize from the painters
        pmpaint = ParticleMesh(BoxSize=self.datasource.BoxSize, Nmesh=[self.paintNmesh] * 3, dtype="f4", comm=self.comm)
        pm = ParticleMesh(BoxSize=self.datasource.BoxSize, Nmesh=[self.Nmesh] * 3, dtype="f4", comm=self.comm)

        real, stats = self.painter.paint(pmpaint, self.datasource)

        if self.writeFourier:
            result = ComplexField(pm)
        else:
            result = RealField(pm)
        real.resample(result)

        # reuses the memory
        result.sort(out=result)
        result = result.ravel()

        # return all the necessary results
        return result, stats
Example #2
0
    def run(self):
        """
        Run the algorithm, which computes and returns the grid in C_CONTIGUOUS order partitioned by ranks.
        """
        from nbodykit import measurestats

        if self.comm.rank == 0:
            self.logger.info('importing done')
            self.logger.info('Resolution Nmesh : %d' % self.paintNmesh)
            self.logger.info('paintbrush : %s' % self.painter.paintbrush)

        # setup the particle mesh object, taking BoxSize from the painters
        pmpaint = ParticleMesh(BoxSize=self.datasource.BoxSize, Nmesh=[self.paintNmesh] * 3, dtype='f4', comm=self.comm)
        pm = ParticleMesh(BoxSize=self.datasource.BoxSize, Nmesh=[self.Nmesh] * 3, dtype='f4', comm=self.comm)

        real, stats = self.painter.paint(pmpaint, self.datasource)

        if self.writeFourier:
            result = ComplexField(pm)
        else:
            result = RealField(pm)
        real.resample(result)

        # reuses the memory
        result.sort(out=result)
        result = result.ravel()

        # return all the necessary results
        return result, stats