def run(self, return_images=False, return_grids=False): """Runs the simulator and imagers. Args: return_images (boolean): If true, return images. return_grids (boolean): If true, return grids. """ # Save flags for use in finalise(). self._return_images = return_images self._return_grids = return_grids # Iterate imagers to find any with uniform weighting or W-projection. need_coords_first = False for im in self._imagers: if im.weighting == 'Uniform' or im.algorithm == 'W-projection': need_coords_first = True # Simulate coordinates first, if required. if need_coords_first: self.set_coords_only(True) Simulator.run(self) self.set_coords_only(False) # Simulate and image the visibilities. return Simulator.run(self)
def finalise(self): """Called automatically by the base class at the end of run().""" Simulator.finalise(self) if not self.coords_only: imager_output_data = [] for im in self._imagers: imager_output_data.append(im.finalise( return_images=self._return_images, return_grids=self._return_grids)) return imager_output_data
def __init__(self, imagers, precision='double'): """Creates the simulator, storing a handle to the imagers. Args: imagers (oskar.Imager list): List of OSKAR imagers to use. precision (str): Either 'double' or 'single' to specify the numerical precision of the simulation. """ Simulator.__init__(self, precision) self._imagers = imagers self._return_images = False self._return_grids = False
def set_coords_only(self, value): """Calls set_coords_only() on simulator and imager objects.""" Simulator.set_coords_only(self, value) for im in self._imagers: im.set_coords_only(value)