def __init__(self, dataset, xy_mask, uv_mask=None): self.dataset = dataset self.xy_mask = xy_mask self.grid_3d = Grid3D(grid_2d=al.Grid.uniform( shape_2d=xy_mask.shape_2d, pixel_scales=xy_mask.pixel_scales, sub_size=xy_mask.sub_size), n_channels=xy_mask.n_channels) self.uv_wavelengths = dataset.uv_wavelengths self.visibilities = dataset.visibilities if uv_mask is None: self.uv_mask = np.full(shape=self.visibilities.shape, fill_value=False) else: self.uv_mask = uv_mask self.uv_mask_real_and_imag_averaged = np.full( shape=self.uv_mask.shape[:-1], fill_value=False) self.noise_map = dataset.noise_map self.noise_map_real_and_imag_averaged = np.average(a=self.noise_map, axis=-1) self.z_step_kms = dataset.z_step_kms
def __init__(self, dataset, xy_mask, uv_mask=None): self.dataset = dataset self.xy_mask = xy_mask # NOTE: rename to real_space_mask # NOTE: This should change and instead be initialized from mask if xy_mask.pixel_scales is not None: self.grid_3d = Grid3D( grid_2d=aa.structures.grids.MaskedGrid.from_mask( mask=xy_mask.mask_2d ), n_channels=xy_mask.n_channels ) self.uv_wavelengths = dataset.uv_wavelengths self.visibilities = dataset.visibilities self.noise_map = dataset.noise_map if uv_mask is None: self.uv_mask = np.full( shape=self.visibilities.shape, fill_value=False ) else: self.uv_mask = uv_mask # TODO: Turn this into a function self.uv_mask_real_and_imag_averaged = np.full( shape=self.uv_mask.shape[:-1], fill_value=False ) for i in range(self.uv_mask.shape[0]): for j in range(self.uv_mask.shape[1]): if self.uv_mask[i, j, 0] == self.uv_mask[i, j, 1] == True: self.uv_mask_real_and_imag_averaged[i, j] = True self.noise_map_real_and_imag_averaged = np.average( a=self.noise_map, axis=-1 ) self.z_step_kms = dataset.z_step_kms
def __init__(self, dataset, mask): self.dataset = dataset # TODO: Check that dataset has attribute data. # TODO: Check that mask and dataset.data have the same shape. self.mask = mask #if mask.pixel_scales is not None: self.grid_3d = Grid3D(grid_2d=al.Grid.uniform( shape_2d=mask.shape_2d, pixel_scales=mask.pixel_scales, sub_size=mask.sub_size), n_channels=mask.n_channels) self.data = dataset.data self.noise_map = dataset.noise_map self.z_step_kms = dataset.z_step_kms
def __init__(self, dataset, xy_mask, uv_mask=None, region=None): self.dataset = dataset self.xy_mask = xy_mask # NOTE: This should change and instead be initialized from mask if xy_mask.pixel_scales is not None: self.grid_3d = Grid3D( grid_2d=aa.structures.grids.MaskedGrid.from_mask( mask=xy_mask.mask_2d ), n_channels=xy_mask.n_channels ) self.uv_wavelengths = dataset.uv_wavelengths self.visibilities = dataset.visibilities if uv_mask is None: self.uv_mask = np.full( shape=self.visibilities.shape, fill_value=False ) else: self.uv_mask = uv_mask # NOTE: We cant have real and imag being different, either both are True of both are False. # TODO: If both real and imag are True then this is True, but if one is False use that for the averaging. self.uv_mask_real_and_imag_averaged = np.full( shape=self.uv_mask.shape[:-1], fill_value=False ) self.noise_map = dataset.noise_map self.noise_map_real_and_imag_averaged = np.average( a=self.noise_map, axis=-1 ) self.z_step_kms = dataset.z_step_kms
def __init__(self, dataset, xy_mask, uv_mask=None): self.dataset = dataset self.xy_mask = xy_mask self.grid_3d = Grid3D(grid_2d=al.Grid.uniform( shape_2d=xy_mask.shape_2d, pixel_scales=xy_mask.pixel_scales, sub_size=xy_mask.sub_size), n_channels=xy_mask.n_channels) self.uv_wavelengths = dataset.uv_wavelengths self.visibilities = dataset.visibilities self.noise_map = dataset.noise_map if uv_mask is None: self.uv_mask = np.full(shape=self.visibilities.shape, fill_value=False) else: if uv_mask.shape == self.visibilities.shape: self.uv_mask = uv_mask else: raise ValueError( "The shape of the uv_mask does not match the shape of the visibilities" ) self.uv_mask_real_and_imag_averaged = np.full( shape=self.uv_mask.shape[:-1], fill_value=False) for i in range(self.uv_mask.shape[0]): for j in range(self.uv_mask.shape[1]): if self.uv_mask[i, j, 0] == self.uv_mask[i, j, 1] == True: self.uv_mask_real_and_imag_averaged[i, j] = True self.noise_map_real_and_imag_averaged = np.average(a=self.noise_map, axis=-1) self.z_step_kms = dataset.z_step_kms
raise ValueError("...") return mask.astype(bool) if __name__ == "__main__": transformer_class = al.TransformerFINUFFT grid_3d = Grid3D( grid_2d=al.Grid.uniform( shape_2d=( n_pixels, n_pixels ), pixel_scales=( pixel_scale, pixel_scale ), sub_size=1 ), n_channels=n_channels ) # xy_mask = Mask3D.unmasked( # shape_3d=grid_3d.shape_3d, # pixel_scales=grid_3d.pixel_scales, # sub_size=grid_3d.sub_size, # ) xy_mask = Mask3D.manual( mask_2d=al.Mask.circular( shape_2d=grid_3d.shape_2d,