def __init__( self, mesh, camembert_radius=0.25, # as percentage of domain camembert_velocity=2.5, background_velocity=2.0, ): """ Constructor for a constant background model with horizontal reflectors. Parameters ---------- mesh : pysit mesh Computational mesh on which to construct the model camembert_radius : the radius of the camembert, float camembert_velocity : the velocity inside the camembert, float background_velocity : float """ GeneratedGalleryModel.__init__(self) self.camembert_radius = camembert_radius self.camembert_velocity = camembert_velocity self.background_velocity = background_velocity self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__( self, model_param_set=None, min_ppw_at_freq=(6, 10.0), # 6ppw at 10hz y_length=None, y_delta=None, z_delta=None, **kwargs): """ Constructor for a constant background model with horizontal reflectors. Parameters ---------- z_delta : float, optional Minimum mesh spacing in depth direction, see Notes. min_ppw_at_freq : tuple (int, float) Tuple with structure (min_ppw, peak_freq) to set the minimum points-per-wavelength at the given peak frequency. x_length : float Physical size in x direction x_delta : float Grid spacing in x direction y_length : float Physical size in y direction y_delta : float Grid spacing in y direction Notes ----- * If z_delta is not set, min_ppw_at_freq is used. z_delta overrides use of min_ppw_at_freq. * Domain will be covered exactly, so z_delta is the maximum delta, it might actually end up being smaller, as the delta is determined by the mesh class. """ GeneratedGalleryModel.__init__(self) self.thickness = model_param_set['z_depth'] self.min_z_delta = z_delta self.min_ppw_at_freq = min_ppw_at_freq self.x_length = model_param_set['x_length'] self.x_delta = model_param_set['x_delta'] self.y_length = y_length self.y_delta = y_delta self.vp_initial = model_param_set['vp_initial'] self.vp_true = model_param_set['vp_true'] self.alpha_initial = model_param_set['alpha_initial'] self.alpha_true = model_param_set['alpha_true'] # Set _domain and _mesh self.build_domain_and_mesh(**kwargs) # Set _initial_model and _true_model self.rebuild_models()
def __init__( self, mesh, reflector_position=[(0.35, 0.42), (0.65, 0.42)], # as percentage of domain size reflector_amplitude=[1.0, 1.0], reflector_width=[0.05, 0.05], background_velocity=1.0, C0_model=None, ): """ Constructor for a triangular reflectors Parameters ---------- mesh : pysit mesh Computational mesh on which to construct the model reflector_position : list Positions of the reflectors, in global coordinates. reflector_amplitude : list Scale of the reflectors reflector_radius : list Radius of the reflectors as FWHM of Gaussian background_velocity : float Notes ----- * custom C0_model() takes priority over background_velocity * assumes C0_model() is compliant with dimensions and scaling of the computational mesh. does not do error checking. """ GeneratedGalleryModel.__init__(self) self._mesh = mesh self._domain = mesh.domain self.reflector_position = reflector_position self.reflector_width = reflector_width self.reflector_amplitude = reflector_amplitude self.background_velocity = background_velocity if C0_model is None: C0 = self.background_velocity * np.ones(self._mesh.shape()) else: sh = self._mesh.shape(as_grid=True) grid = self._mesh.mesh_coords() # retrieve meshgrid if self.domain.dim == 1: raise NotImplementedError() C0 = self.C0_model(grid[0]) elif self.domain.dim == 2: C0 = self.C0_model(grid[0], grid[1]).reshape(sh) elif self.domain.dim == 3: raise NotImplementedError() C0 = self.C0_model(grid[0], grid[1], grid[2]).reshape(sh) dC = self._build_reflectors() self._initial_model = C0 self._true_model = C0 + dC
def __init__( self, mesh, reflector_depth=[0.45, 0.65], # as percentage of domain reflector_scaling=[1.0, 1.0], background_velocity=2.0, drop_threshold=1e-7, pulse_style='gaussian_derivative', pulse_config={}, ): """ Constructor for a constant background model with horizontal reflectors. Parameters ---------- mesh : pysit mesh Computational mesh on which to construct the model reflector_depth : list Depths of the reflectors, as a percentage of domain depth reflector_scaling : list Scale factors for reflectors background_velocity : float drop_threshold : float Cutoff value for evaluation of reflectors pulse_style : {'gaussian_derivative', 'gaussian_pulse'} Shape of the reflector pulse_config : dict Configuration of the pulses. Notes ----- The following options exist for the pulse styles: 'gaussian_pulse' : 'sigma_in_pixels' : width of the gaussial pulse """ GeneratedGalleryModel.__init__(self) self.reflector_depth = reflector_depth self.reflector_scaling = reflector_scaling self.background_velocity = background_velocity self.drop_threshold = drop_threshold self.pulse_style = pulse_style self.pulse_config = pulse_config self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__(self, mesh, reflector_depth=[0.45, 0.65], # as percentage of domain reflector_scaling=[1.0, 1.0], background_velocity=2.0, drop_threshold=1e-7, pulse_style='gaussian_derivative', pulse_config={}, ): """ Constructor for a constant background model with horizontal reflectors. Parameters ---------- mesh : pysit mesh Computational mesh on which to construct the model reflector_depth : list Depths of the reflectors, as a percentage of domain depth reflector_scaling : list Scale factors for reflectors background_velocity : float drop_threshold : float Cutoff value for evaluation of reflectors pulse_style : {'gaussian_derivative', 'gaussian_pulse'} Shape of the reflector pulse_config : dict Configuration of the pulses. Notes ----- The following options exist for the pulse styles: 'gaussian_pulse' : 'sigma_in_pixels' : width of the gaussial pulse """ GeneratedGalleryModel.__init__(self) self.reflector_depth = reflector_depth self.reflector_scaling = reflector_scaling self.background_velocity = background_velocity self.drop_threshold = drop_threshold self.pulse_style = pulse_style self.pulse_config = pulse_config self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__( self, mesh, reflector_position=[(0.35, 0.42), (0.65, 0.42)], # as percentage of domain size reflector_radius=[0.05, 0.05], reflector_amplitude=[1.0, 1.0], background_velocity=1.0, drop_threshold=1e-7, ): """ Constructor for a constant background model with point reflectors. Parameters ---------- mesh : pysit mesh Computational mesh on which to construct the model reflector_position : list Positions of the reflectors, as a percentage of domain size reflector_radius : list Radius of the reflectors as FWHM of Gaussian reflector_amplitude : list Scale of the reflectors background_velocity : float drop_threshold : float Cutoff value for evaluation of reflectors """ GeneratedGalleryModel.__init__(self) self.reflector_position = reflector_position self.reflector_radius = reflector_radius self.reflector_amplitude = reflector_amplitude self.background_velocity = background_velocity self.drop_threshold = drop_threshold self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__(self, n_pixels=(250, 150), submarine=None, air_velocity=0.1, water_velocity=1.0, rock_velocity=10.0, **kwargs): """ Constructor for the sonar model. Parameters ---------- n_pixels : tuple The size, in pixels, of the model submarine : none or PySIT Submarine Specifies presence of a submarine in the model. air_velocity : float Velocity in air. water_velocity : float Velocity in water. rock_velocity : float Velocity in rock. """ GeneratedGalleryModel.__init__(self) self.air_velocity = air_velocity self.water_velocity = water_velocity self.rock_velocity = rock_velocity if len(n_pixels) not in [2, 3]: raise ValueError( 'Submarine-sonar model only works for dimensions greater than 1.' ) if submarine is None: if len(n_pixels) == 2: submarine = default_submarine_2D else: # len(n_pixels) == 3 submarine = default_submarine_3D self.submarine = submarine config_list = list() # Configure X direction x_lbc = kwargs['x_lbc'] if ('x_lbc' in kwargs.keys()) else PML( 0.1, 100.0) x_rbc = kwargs['x_rbc'] if ('x_rbc' in kwargs.keys()) else PML( 0.1, 100.0) xmin, xmax = 0.0, 2.5 x_config = (xmin, xmax, x_lbc, x_rbc) config_list.append(x_config) if len(n_pixels) == 3: # If it is there, configure Y direction y_lbc = kwargs['y_lbc'] if ('y_lbc' in kwargs.keys()) else PML( 0.1, 100.0) y_rbc = kwargs['y_rbc'] if ('y_rbc' in kwargs.keys()) else PML( 0.1, 100.0) ymin, ymax = 0.0, 2.5 y_config = (ymin, ymax, y_lbc, y_rbc) config_list.append(y_config) # Configure Z direction z_lbc = kwargs['z_lbc'] if ('z_lbc' in kwargs.keys()) else PML( 0.1, 100.0) z_rbc = kwargs['z_rbc'] if ('z_rbc' in kwargs.keys()) else PML( 0.1, 100.0) zmin, zmax = 0.0, 1.5 z_config = (zmin, zmax, z_lbc, z_rbc) config_list.append(z_config) domain = RectangularDomain(*config_list) mesh_args = [domain] + list(n_pixels) mesh = CartesianMesh(*mesh_args) self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__( self, n_pixels=(250, 150), submarine=None, air_velocity=0.1, water_velocity=1.0, rock_velocity=10.0, **kwargs ): """ Constructor for the sonar model. Parameters ---------- n_pixels : tuple The size, in pixels, of the model submarine : none or PySIT Submarine Specifies presence of a submarine in the model. air_velocity : float Velocity in air. water_velocity : float Velocity in water. rock_velocity : float Velocity in rock. """ GeneratedGalleryModel.__init__(self) self.air_velocity = air_velocity self.water_velocity = water_velocity self.rock_velocity = rock_velocity if len(n_pixels) not in [2, 3]: raise ValueError("Submarine-sonar model only works for dimensions greater than 1.") if submarine is None: if len(n_pixels) == 2: submarine = default_submarine_2D else: # len(n_pixels) == 3 submarine = default_submarine_3D self.submarine = submarine config_list = list() # Configure X direction x_lbc = kwargs["x_lbc"] if ("x_lbc" in kwargs.keys()) else PML(0.1, 100.0) x_rbc = kwargs["x_rbc"] if ("x_rbc" in kwargs.keys()) else PML(0.1, 100.0) xmin, xmax = 0.0, 2.5 x_config = (xmin, xmax, x_lbc, x_rbc) config_list.append(x_config) if len(n_pixels) == 3: # If it is there, configure Y direction y_lbc = kwargs["y_lbc"] if ("y_lbc" in kwargs.keys()) else PML(0.1, 100.0) y_rbc = kwargs["y_rbc"] if ("y_rbc" in kwargs.keys()) else PML(0.1, 100.0) ymin, ymax = 0.0, 2.5 y_config = (ymin, ymax, y_lbc, y_rbc) config_list.append(y_config) # Configure Z direction z_lbc = kwargs["z_lbc"] if ("z_lbc" in kwargs.keys()) else PML(0.1, 100.0) z_rbc = kwargs["z_rbc"] if ("z_rbc" in kwargs.keys()) else PML(0.1, 100.0) zmin, zmax = 0.0, 1.5 z_config = (zmin, zmax, z_lbc, z_rbc) config_list.append(z_config) domain = RectangularDomain(*config_list) mesh_args = [domain] + list(n_pixels) mesh = CartesianMesh(*mesh_args) self._mesh = mesh self._domain = mesh.domain # Set _initial_model and _true_model self.rebuild_models()
def __init__(self, layers, z_delta=None, min_ppw_at_freq=(6,10.0), # 6ppw at 10hz x_length=None, x_delta=None, y_length=None, y_delta=None, initial_model_style='smooth', initial_config={'sigma':100.0, 'filtersize':100}, **kwargs): """ Constructor for a constant background model with horizontal reflectors. Parameters ---------- layers : list List of Layer objects z_delta : float, optional Minimum mesh spacing in depth direction, see Notes. min_ppw_at_freq : tuple (int, float) Tuple with structure (min_ppw, peak_freq) to set the minimum points-per-wavelength at the given peak frequency. x_length : float Physical size in x direction x_delta : float Grid spacing in x direction y_length : float Physical size in y direction y_delta : float Grid spacing in y direction initial_model_style : {'smooth', 'constant', 'gradient'} Setup for the initial model. initial_config : dict Configuration parameters for initial models. Notes ----- * If z_delta is not set, min_ppw_at_freq is used. z_delta overrides use of min_ppw_at_freq. * Domain will be covered exactly, so z_delta is the maximum delta, it might actually end up being smaller, as the delta is determined by the mesh class. """ GeneratedGalleryModel.__init__(self) self.layers = layers self.min_z_delta = z_delta self.min_ppw_at_freq = min_ppw_at_freq self.x_length = x_length self.x_delta = x_delta self.y_length = y_length self.y_delta = y_delta self.initial_model_style = initial_model_style self.initial_config = initial_config # Set _domain and _mesh self.build_domain_and_mesh(**kwargs) # Set _initial_model and _true_model self.rebuild_models()