Skip to content

Commit

Permalink
wip: finishing up fast-marching
Browse files Browse the repository at this point in the history
  • Loading branch information
miili committed Sep 12, 2023
1 parent cd33e2a commit f66bd87
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lassie/models/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def as_pyrocko_event(self) -> Event:
north_shift=self.north_shift,
depth=self.depth,
elevation=self.elevation,
magnitude=self.magnitude,
magnitude=self.magnitude or self.semblance,
magnitude_type=self.magnitude_type,
)

Expand Down
4 changes: 2 additions & 2 deletions lassie/models/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def weed_from_squirrel_waveforms(self, squirrel: Squirrel) -> None:
n_removed_stations = 0
for sta in self.stations.copy():
if sta.pretty_nsl not in available_squirrel_nsls:
logger.info(
"removing station %s: waveforms not available in squirrel",
logger.warning(
"removing station %s: no waveforms available in squirrel",
sta.pretty_nsl,
)
self.stations.remove(sta)
Expand Down
8 changes: 5 additions & 3 deletions lassie/search/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def init_search(self) -> None:
timedelta(seconds=np.nanmax(traveltimes)),
)
logger.info(
"shift ranges: %s / %s - %s", phase, *self.travel_time_ranges[phase]
"time shift ranges: %s / %s - %s",
phase,
*self.travel_time_ranges[phase],
)

# TODO: minimum shift is calculated on the coarse octree grid, which is
Expand Down Expand Up @@ -463,11 +465,11 @@ async def search(

detections.append(detection)
logger.info(
"%s new detection %s: %.5fE, %.5fN, %.1f m, semblance %.3f",
"%s new detection %s: %.5fE, %.5fN, depth %.1f m, semblance %.3f",
Symbols.Target,
detection.time,
*detection.effective_lat_lon,
detection.effective_depth,
detection.depth,
detection.semblance,
)

Expand Down
3 changes: 2 additions & 1 deletion lassie/tracers/cake.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def _interpolate_travel_times(
n_nodes = len(coordinates)
with Progress() as progress:
status = progress.add_task(
f"interpolating station traveltimes for {n_nodes} nodes",
f"interpolating {self.timing.definition} travel times "
f"for {n_nodes} nodes",
total=len(coordinates),
)
traveltimes = []
Expand Down
8 changes: 4 additions & 4 deletions lassie/tracers/fast_marching/fast_marching.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def interpolate_travel_time(
) -> float:
interpolator = self.get_traveltime_interpolator()
offset = location.offset_to(self.center)
return interpolator([offset], method=method)[0]
return interpolator([offset], method=method).astype(float, copy=False)[0]

def interpolate_nodes(
self,
Expand All @@ -190,7 +190,7 @@ def interpolate_nodes(
interpolator = self.get_traveltime_interpolator()

coordinates = [node.as_location().offset_to(self.center) for node in nodes]
return interpolator(coordinates, method=method)
return interpolator(coordinates, method=method).astype(float, copy=False)

def save(self, path: Path) -> Path:
"""Save travel times to a zip file.
Expand Down Expand Up @@ -300,7 +300,7 @@ async def prepare(
offset = station.offset_to(velocity_model.center)
stations.blacklist_station(
station,
reason=f"outside the fast-marching velocity model, offset {offset}",
reason=f"outside fast-marching velocity model, offset {offset}",
)

nodes_covered = [
Expand Down Expand Up @@ -456,7 +456,7 @@ def fill_lut(self, nodes: Sequence[Node]) -> None:

with Progress() as progress:
status = progress.add_task(
f"interpolating station traveltimes for {n_nodes} nodes",
f"interpolating {self.phase} traveltimes for {n_nodes} nodes",
total=self._cached_stations.n_stations,
)
for station in self._cached_stations:
Expand Down

0 comments on commit f66bd87

Please sign in to comment.