Geometry
- class stride.problem.geometry.TransducerLocation(id, transducer=None, coordinates=None, orientation=None, name=None, **kwargs)[source]
Bases:
GriddedSaved
This determines the spatial location of a specific transducer device within the geometry.
The location is determined by a numerical ID (>= 0), a transducer and the coordinates of the location within the space grid. In some cases, the orientation of the transducer might also be needed.
- Parameters:
id (int) – Numerical ID of the location (>=0).
name (str) – Optional name for the transducer location.
transducer (Transducer) – Transducer device to which this location refers.
coordinates (ndarray) – Coordinates of the transducer in the space grid.
orientation (ndarray, optional) – Orientation of the transducer with respect to its location.
- sub_problem(shot, sub_problem)[source]
Create a subset object for a certain shot.
A SubProblem contains everything that is needed to fully determine how to run a particular shot. This method takes care of creating a TransducerLocation object that links to that new SubProblem.
- Parameters:
shot (Shot) – Shot for which the SubProblem is being generated.
sub_problem (SubProblem) – Container for the sub-problem being generated.
- Returns:
Newly created TransducerLocation instance.
- Return type:
- class stride.problem.geometry.Geometry(name='geometry', problem=None, **kwargs)[source]
Bases:
ProblemBase
The Geometry represents a series of transducer locations that exist within the confines of the grid.
Transducer locations are identified through a numerical ID, which is >= 0.
Transducer locations can be added at a certain location through
Geometry.add(id, transducer, coordinates, [orientation])
and can be accessed throughGeometry.get(location_id)
.The Geometry also provides utilities for loading and dumping these transducers and for plotting them.
- Parameters:
name (str) – Alternative name to give to the medium.
problem (Problem) – Problem to which the Geometry belongs.
transducers (Transducers) – Transducers object to which the Geometry refers.
grid (Grid or any of Space or Time) – Grid on which the Geometry is defined
- add(id, transducer, coordinates, orientation=None)[source]
Add a new transducer location to the Geometry.
- Parameters:
id (int) – ID of the instantiation of the transducer in the geometry.
transducer (Transducer) – Transducer to be added to the Geometry.
coordinates (array) – Coordinates of the transducer in the grid.
orientation (array, optional) – Orientation vector of the transducer.
- add_location(item)[source]
Add an existing location to the Geometry.
- Parameters:
item (TransducerLocation) – Transducer location instance to be added to the Geometry.
- property coordinates
Get the coordinates of all locations packed in an array format.
Coordinates are defined as a 2 or 3-dimensional array with shape (n_transducers, n_dimensions).
- default(geometry_type, *args, **kwargs)[source]
Fill the container with the default configuration.
In this case, that means using one of the default geometry functions in
stride.utils.geometries
and using the same transducer for all of them.- Parameters:
geometry_type (str) – Type of geometry to use.
- get(id)[source]
Get a transducer location from the Geometry with a known id.
- Parameters:
id (int) – Identifier of the transducer.
- Returns:
Found TransducerLocation.
- Return type:
- get_slice(start=None, end=None, step=None)[source]
Get a slice of the indices of the locations using
slice(start, stop, step)
.- Parameters:
start (int, optional) – Start of the slice, defaults to the first id.
end (int, optional) – End of the slice, defaults to the last id.
step (int, optional) – Steps in between transducers, defaults to 1.
- Returns:
Found transducer locations in the slice.
- Return type:
list
- property location_ids
Get all location IDs in the Geometry as a list.
- property locations
Get all locations in the Geometry as a list.
- property num_locations
Get number of locations in the Geometry.
- plot(**kwargs)[source]
Plot the locations of the transducers as scattered points.
- Parameters:
kwargs – Arguments for plotting.
- Returns:
Axes on which the plotting is done.
- Return type:
axes
- sub_problem(shot, sub_problem)[source]
Create a subset object for a certain shot.
A SubProblem contains everything that is needed to fully determine how to run a particular shot. This method takes care of selecting the portions of the Geometry that are needed for a given shot.
- Parameters:
shot (Shot) – Shot for which the SubProblem is being generated.
sub_problem (SubProblem) – Container for the sub-problem being generated.
- Returns:
Newly created Geometry instance.
- Return type:
- property transducers