Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miili committed Nov 5, 2023
1 parent 38c4163 commit 4062411
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
7 changes: 6 additions & 1 deletion lassie/images/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,16 @@ def apply_exponent(self, exponent: float) -> None:
image.apply_exponent(exponent)

def set_stations(self, stations: Stations) -> None:
"""Set the images stations."""
"""Set the images stations.
Args:
stations (Stations): Stations to set.
"""
for image in self:
image.set_stations(stations)

def cumulative_weight(self) -> float:
"""Get the cumulative weight of all images."""
return sum(image.weight for image in self)

def snuffle(self) -> None:
Expand Down
8 changes: 0 additions & 8 deletions lassie/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,5 @@ async def search(
)

detections.append(detection)
# detection.plot()

# plot_octree_movie(octree, semblance, file=Path("/tmp/test.mp4"))
if parent.plot_octree_surface:
octree.map_semblance(semblance.maximum_node_semblance())
parent._plot_octree_surface(
octree, time=self.start_time, detections=detections
)

return detections, semblance.get_trace()
20 changes: 13 additions & 7 deletions lassie/tracers/fast_marching/velocity_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,27 @@ class VelocityModel3D(BaseModel):

def model_post_init(self, __context: Any) -> None:
grid_spacing = self.grid_spacing
neast = int(round(self.east_size / grid_spacing)) + 1
nnorth = int(round(self.north_size / grid_spacing)) + 1
ndepth = int(round(self.depth_size / grid_spacing)) + 1

self._east_coords = np.arange(
self._east_coords = np.linspace(
self.east_bounds[0],
self.east_bounds[1],
grid_spacing,
neast,
endpoint=True,
)
self._north_coords = np.arange(
self._north_coords = np.linspace(
self.north_bounds[0],
self.north_bounds[1],
grid_spacing,
nnorth,
endpoint=True,
)
self._depth_coords = np.arange(
self._depth_coords = np.linspace(
self.depth_bounds[0],
self.depth_bounds[1],
grid_spacing,
ndepth,
endpoint=True,
)

self._velocity_model = np.zeros(
Expand Down Expand Up @@ -399,7 +405,7 @@ def north_bounds(self) -> tuple[float, float]:
@property
def depth_bounds(self) -> tuple[float, float]:
"""Relative to center location."""
return 0.0, self.delta_z * self.nz
return 0.0, self.delta_z * (self.nz - 1)

@property
def center(self) -> Location:
Expand Down

0 comments on commit 4062411

Please sign in to comment.