def run(self, return_images=False, return_grids=False): """Runs the interferometer 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) Interferometer.run(self) self.set_coords_only(False) # Simulate and image the visibilities. return Interferometer.run(self)
def to_interferometer(self): """Returns a new interferometer simulator from the current settings. Returns: oskar.Interferometer: A configured interferometer simulator. """ sim = Interferometer() sim.capsule = _apps_lib.settings_to_interferometer(self._capsule) return sim
def finalise(self): """Called automatically by the base class at the end of run().""" Interferometer.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=None, settings=None): """Creates the simulator, storing a handle to the imagers. Args: imagers (oskar.Imager list): List of OSKAR imagers to use. precision (Optional[str]): Either 'double' or 'single' to specify the numerical precision of the simulation. Default 'double'. settings (Optional[oskar.SettingsTree]): Optional settings to use to set up the simulator. """ Interferometer.__init__(self, precision, settings) self._imagers = imagers self._return_images = False self._return_grids = False
def set_coords_only(self, value): """Calls set_coords_only() on interferometer and imager objects.""" Interferometer.set_coords_only(self, value) for im in self._imagers: im.set_coords_only(value)