def grid(self, coordinates, shape, as_grid): assert (not as_grid) self._update_image_configuration(coordinates, shape) args = {} args["ANTENNA1"] = self._ms.getcol("ANTENNA1") args["ANTENNA2"] = self._ms.getcol("ANTENNA2") args["UVW"] = self._ms.getcol("UVW") args["TIME"] = self._ms.getcol("TIME") args["TIME_CENTROID"] = self._ms.getcol("TIME_CENTROID") args["FLAG_ROW"] = self._ms.getcol("FLAG_ROW") args["FLAG"] = self._ms.getcol("FLAG") args["IMAGING_WEIGHT_CUBE"] = numpy.ones(args["FLAG"].shape, dtype=numpy.float32) args["DATA"] = self._ms.getcol(self._data_column) # INI: Modified grid in casaimwrap to separate begin_grid, grid and end_grid '''casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False, args) result = casaimwrap.end_grid(self._context, False)''' casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False) casaimwrap.grid(self._context, \ args) result = casaimwrap.end_grid( self._context, False) # INI: why is this False? Insert proper options here self._response_available = True return (result["image"], result["weight"])
def grid(self, coordinates, shape, as_grid): assert(not as_grid) self._update_image_configuration(coordinates, shape) args = {} args["ANTENNA1"] = self._ms.getcol("ANTENNA1") args["ANTENNA2"] = self._ms.getcol("ANTENNA2") args["UVW"] = self._ms.getcol("UVW") args["TIME"] = self._ms.getcol("TIME") args["TIME_CENTROID"] = self._ms.getcol("TIME_CENTROID") args["FLAG_ROW"] = self._ms.getcol("FLAG_ROW") args["FLAG"] = self._ms.getcol("FLAG") args["IMAGING_WEIGHT_CUBE"] = numpy.ones(args["FLAG"].shape, dtype=numpy.float32) args["DATA"] = self._ms.getcol(self._data_column) # INI: Modified grid in casaimwrap to separate begin_grid, grid and end_grid '''casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False, args) result = casaimwrap.end_grid(self._context, False)''' casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False) casaimwrap.grid(self._context, \ args) result = casaimwrap.end_grid(self._context, False) # INI: why is this False? Insert proper options here self._response_available = True return (result["image"], result["weight"])
def grid_chunk(self, coordinates, shape, as_grid, chunksize): assert (not as_grid) self._update_image_configuration(coordinates, shape) casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False) # INI: looping through chunks of data nrows = self._ms.nrows() lastchunksize = nrows % chunksize if lastchunksize > 0: nchunks = nrows / chunksize + 1 else: nchunks = nrows / chunksize print 'nrows, chunksize, lastchunksize: ', nrows, chunksize, lastchunksize for chunk in numpy.arange(nchunks): start = chunk * chunksize if chunk == nchunks - 1 and lastchunksize > 0: nrow = lastchunksize else: nrow = chunksize args = {} args["ANTENNA1"] = self._ms.getcol("ANTENNA1", start, nrow) args["ANTENNA2"] = self._ms.getcol("ANTENNA2", start, nrow) args["UVW"] = self._ms.getcol("UVW", start, nrow) args["TIME"] = self._ms.getcol("TIME", start, nrow) args["TIME_CENTROID"] = self._ms.getcol("TIME_CENTROID", start, nrow) args["FLAG_ROW"] = self._ms.getcol("FLAG_ROW", start, nrow) args["FLAG"] = self._ms.getcol("FLAG", start, nrow) args["IMAGING_WEIGHT_CUBE"] = numpy.ones(args["FLAG"].shape, dtype=numpy.float32) args["DATA"] = self._ms.getcol(self._data_column, start, nrow) casaimwrap.grid(self._context, \ args) result = casaimwrap.end_grid( self._context, False) # INI: why is this False? Insert proper options here print "Result is ------------------: ", result self._response_available = True return (result["image"], result["weight"])
def grid_chunk(self, coordinates, shape, as_grid, chunksize): assert(not as_grid) self._update_image_configuration(coordinates, shape) casaimwrap.begin_grid(self._context, shape, coordinates.dict(), \ False) # INI: looping through chunks of data nrows = self._ms.nrows() lastchunksize = nrows % chunksize if lastchunksize > 0: nchunks = nrows / chunksize + 1 else: nchunks = nrows / chunksize print 'nrows, chunksize, lastchunksize: ', nrows, chunksize, lastchunksize for chunk in numpy.arange(nchunks): start = chunk * chunksize if chunk == nchunks-1 and lastchunksize > 0: nrow = lastchunksize else: nrow = chunksize args = {} args["ANTENNA1"] = self._ms.getcol("ANTENNA1",start,nrow) args["ANTENNA2"] = self._ms.getcol("ANTENNA2",start,nrow) args["UVW"] = self._ms.getcol("UVW",start,nrow) args["TIME"] = self._ms.getcol("TIME",start,nrow) args["TIME_CENTROID"] = self._ms.getcol("TIME_CENTROID",start,nrow) args["FLAG_ROW"] = self._ms.getcol("FLAG_ROW",start,nrow) args["FLAG"] = self._ms.getcol("FLAG",start,nrow) args["IMAGING_WEIGHT_CUBE"] = numpy.ones(args["FLAG"].shape, dtype=numpy.float32) args["DATA"] = self._ms.getcol(self._data_column,start,nrow) casaimwrap.grid(self._context, \ args) result = casaimwrap.end_grid(self._context, False) # INI: why is this False? Insert proper options here print "Result is ------------------: ", result self._response_available = True return (result["image"], result["weight"])