From f66bd87ac675169ba31a9fb9f65095ea18d90893 Mon Sep 17 00:00:00 2001 From: miili Date: Tue, 12 Sep 2023 12:45:49 +0200 Subject: [PATCH] wip: finishing up fast-marching --- lassie/models/detection.py | 2 +- lassie/models/station.py | 4 ++-- lassie/search/base.py | 8 +++++--- lassie/tracers/cake.py | 3 ++- lassie/tracers/fast_marching/fast_marching.py | 8 ++++---- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lassie/models/detection.py b/lassie/models/detection.py index f7c87f4f..541d73cf 100644 --- a/lassie/models/detection.py +++ b/lassie/models/detection.py @@ -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, ) diff --git a/lassie/models/station.py b/lassie/models/station.py index 0bb0c523..781c4726 100644 --- a/lassie/models/station.py +++ b/lassie/models/station.py @@ -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) diff --git a/lassie/search/base.py b/lassie/search/base.py index 68029f54..a63a78e2 100644 --- a/lassie/search/base.py +++ b/lassie/search/base.py @@ -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 @@ -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, ) diff --git a/lassie/tracers/cake.py b/lassie/tracers/cake.py index 09924324..896e0bdb 100644 --- a/lassie/tracers/cake.py +++ b/lassie/tracers/cake.py @@ -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 = [] diff --git a/lassie/tracers/fast_marching/fast_marching.py b/lassie/tracers/fast_marching/fast_marching.py index a7ec0716..f02aaac4 100644 --- a/lassie/tracers/fast_marching/fast_marching.py +++ b/lassie/tracers/fast_marching/fast_marching.py @@ -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, @@ -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. @@ -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 = [ @@ -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: