|
24 | 24 |
|
25 | 25 | from qseek.cache_lru import CACHES |
26 | 26 | from qseek.corrections.corrections import StationCorrectionType, corrections_from_path |
27 | | -from qseek.distance_weights import DistanceWeights |
28 | 27 | from qseek.features import FeatureExtractorType |
29 | 28 | from qseek.images.images import ImageFunctions, WaveformImages |
30 | 29 | from qseek.magnitudes import EventMagnitudeCalculatorType |
|
38 | 37 | from qseek.pre_processing.module import Downsample, PreProcessing |
39 | 38 | from qseek.reduce import DelaySumReduce |
40 | 39 | from qseek.signals import Signal |
| 40 | +from qseek.station_weights import StationWeights |
41 | 41 | from qseek.stats import RuntimeStats, Stats |
42 | 42 | from qseek.tracers.tracers import RayTracer, RayTracers |
43 | 43 | from qseek.utils import ( |
44 | 44 | BackgroundTasks, |
45 | 45 | CpuCount, |
46 | 46 | PhaseDescription, |
| 47 | + _get_cpu_count, |
47 | 48 | datetime_now, |
48 | | - get_cpu_count, |
49 | 49 | get_total_memory, |
50 | 50 | human_readable_bytes, |
51 | 51 | time_to_path, |
@@ -265,10 +265,11 @@ class Search(BaseModel): |
265 | 265 | ), |
266 | 266 | description="List of ray tracers for travel time calculation.", |
267 | 267 | ) |
268 | | - distance_weights: DistanceWeights | None = Field( |
269 | | - default_factory=DistanceWeights, |
| 268 | + station_weights: StationWeights | None = Field( |
| 269 | + default_factory=StationWeights, |
270 | 270 | validation_alias=AliasChoices("spatial_weights", "distance_weights"), |
271 | | - description="Spatial weights for distance weighting.", |
| 271 | + description="Station weighting based on station density and " |
| 272 | + "source-station distance.", |
272 | 273 | ) |
273 | 274 | station_corrections: StationCorrectionType | None = Field( |
274 | 275 | default=None, |
@@ -357,7 +358,7 @@ class Search(BaseModel): |
357 | 358 | _rundir: Path = PrivateAttr() |
358 | 359 |
|
359 | 360 | _compute_semaphore: asyncio.Semaphore = PrivateAttr( |
360 | | - asyncio.Semaphore(max(1, get_cpu_count() - 4)) |
| 361 | + asyncio.Semaphore(max(1, _get_cpu_count() - 4)) |
361 | 362 | ) |
362 | 363 |
|
363 | 364 | # Signals |
@@ -493,8 +494,8 @@ async def prepare(self) -> None: |
493 | 494 | await self.pre_processing.prepare() |
494 | 495 | await self.image_functions.prepare() |
495 | 496 |
|
496 | | - if self.distance_weights: |
497 | | - self.distance_weights.prepare(self.stations, self.octree) |
| 497 | + if self.station_weights: |
| 498 | + self.station_weights.prepare(self.stations, self.octree) |
498 | 499 |
|
499 | 500 | if self.station_corrections: |
500 | 501 | await self.station_corrections.prepare( |
@@ -552,7 +553,7 @@ async def start(self, force_rundir: bool = False) -> None: |
552 | 553 | ray_tracers=self.ray_tracers, |
553 | 554 | window_padding=window_padding, |
554 | 555 | station_corrections=self.station_corrections, |
555 | | - distance_weights=self.distance_weights, |
| 556 | + distance_weights=self.station_weights, |
556 | 557 | detection_threshold=self.detection_threshold, |
557 | 558 | pick_confidence_threshold=self.pick_confidence_threshold, |
558 | 559 | node_interpolation=self.node_interpolation, |
@@ -698,7 +699,7 @@ def __init__( |
698 | 699 | ray_tracers: RayTracers, |
699 | 700 | window_padding: timedelta, |
700 | 701 | station_corrections: StationCorrectionType | None = None, |
701 | | - distance_weights: DistanceWeights | None = None, |
| 702 | + distance_weights: StationWeights | None = None, |
702 | 703 | detection_threshold: float | Literal["MAD"] = "MAD", |
703 | 704 | detection_blinding: timedelta = timedelta(seconds=1.0), |
704 | 705 | pick_confidence_threshold: float = 0.3, |
|
0 commit comments