Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow User to toggle off rejection criteria #17

Open
bch0w opened this issue Oct 19, 2022 · 0 comments
Open

Allow User to toggle off rejection criteria #17

bch0w opened this issue Oct 19, 2022 · 0 comments

Comments

@bch0w
Copy link
Member

bch0w commented Oct 19, 2022

Currently all window rejection criteria are evaluated in WindowSelector.select_windows(). This is good for a default cause but some criteria may be unwanted in specific research cases.

For example: rejecting on travel times may not be desired if the event and station metadata or the 1D model used to predict travel times are not accurate enough, leading to erroneous rejections.

Config file or select_windows() function should have a toggle for each rejection criteria incase advanced users want to turn things on or off.

def select_windows(self):
"""
Launch the window selection.
"""
# Fill self.ttimes.
if self.event and self.station:
self.calculate_ttimes()
self.calculate_preliminiaries()
# Perform all window selection steps.
self.initial_window_selection()
# Reject windows based on traveltime if event and station
# information is given. This will also fill self.ttimes.
if self.event and self.station:
self.reject_on_traveltimes()
else:
msg = "No rejection based on traveltime possible. Event and/or " \
"station information is not available."
logger.warning(msg)
warnings.warn(msg, PyflexWarning)
self.determine_signal_and_noise_indices()
if self.config.check_global_data_quality:
# Global data quality may preclude window selection
if not self.check_data_quality():
return []
self.reject_windows_based_on_minimum_length()
self.reject_on_minima_water_level()
self.reject_on_prominence_of_central_peak()
self.reject_on_phase_separation()
self.curtail_length_of_windows()
self.remove_duplicates()
# Call once again as curtailing might change the length of some
# windows. Very cheap so can easily be called more than once.
self.reject_windows_based_on_minimum_length()
self.reject_based_on_signal_to_noise_ratio()
self.reject_based_on_data_fit_criteria()
if self.config.resolution_strategy == "interval_scheduling":
self.schedule_weighted_intervals()
elif self.config.resolution_strategy == "merge":
self.merge_windows()
else:
raise NotImplementedError
if self.ttimes:
self.attach_phase_arrivals_to_windows()
return self.windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant