Compare commits
No commits in common. "master" and "master" have entirely different histories.
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-present Hubert Siejkowski <h.siejkowski.cyfronet.pl>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL
|
||||
__version__ = "0.6.4"
|
||||
__version__ = "0.6.3"
|
||||
|
@ -73,25 +73,16 @@ class ModelRunner:
|
||||
fpath = self.output_dir / f"{stream_path.stem}_annotations.mseed"
|
||||
ann.write(fpath, format="MSEED")
|
||||
|
||||
def validate_stream(self, stream):
|
||||
model = self.model
|
||||
@staticmethod
|
||||
def validate_stream(stream):
|
||||
groups = defaultdict(list)
|
||||
samples = defaultdict(list)
|
||||
for trace in stream:
|
||||
groups[trace.stats.station].append(trace.stats.channel[-1])
|
||||
samples[trace.stats.station].append(
|
||||
float(trace.stats.npts / trace.stats.sampling_rate)
|
||||
)
|
||||
|
||||
number_of_channels = list(map(len, groups.values()))
|
||||
lenght_of_traces = list(map(max , samples.values()))
|
||||
|
||||
if max(number_of_channels) < model.in_channels:
|
||||
exit_error("Not enough channels in the stream.")
|
||||
|
||||
minimal_trace_length = model.in_samples / model.sampling_rate
|
||||
if max(lenght_of_traces) < minimal_trace_length:
|
||||
exit_error(f"All traces are shorter than required {int(minimal_trace_length):d} seconds")
|
||||
if max(number_of_channels) < 3:
|
||||
exit_error("Not enough traces in the stream")
|
||||
|
||||
def find_picks(self, stream_file_name, save_annotations=True):
|
||||
stream_path = pathlib.Path(stream_file_name)
|
||||
|
Loading…
Reference in New Issue
Block a user