From 2f1f3f08006c236283200898d7a13d255c51a16a Mon Sep 17 00:00:00 2001 From: Fabio Silva Date: Tue, 12 Nov 2024 10:00:31 -0800 Subject: [PATCH] Modified GP match code to allow users to specify the merging frequency --- bbp/comps/match.py | 25 +++++++++++++++---------- bbp/comps/match_cfg.py | 11 +++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/bbp/comps/match.py b/bbp/comps/match.py index a22d448f..a4682695 100755 --- a/bbp/comps/match.py +++ b/bbp/comps/match.py @@ -2,7 +2,7 @@ """ BSD 3-Clause License -Copyright (c) 2023, University of Southern California +Copyright (c) 2024, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -87,11 +87,25 @@ def run(self): dirs = [a_tmpdir] bband_utils.mkdirs(dirs, print_cmd=False) + # Get pointer to the velocity model object + vel_obj = velocity_models.get_velocity_model_by_name(self.vmodel_name) + if vel_obj is None: + raise bband_utils.ParameterError("Cannot find velocity model: %s" % + (self.vmodel_name)) + + # Check for velocity model-specific parameters + vmodel_params = vel_obj.get_codebase_params('gp') + # Start with defaults self.phase = config.PHASE self.hf_fhi = config.HF_FHI self.lf_flo = config.LF_FLO + # Check if we have a different merging frequency + if 'MATCH_MERGING_FREQUENCY' in vmodel_params: + self.hf_fhi = float(vmodel_params['MATCH_MERGING_FREQUENCY']) + self.lf_flo = float(vmodel_params['MATCH_MERGING_FREQUENCY']) + # Set match method if config.MATCH_METHOD == 1: self.phase = 1 @@ -109,15 +123,6 @@ def run(self): slo = StationList(a_statfile) site_list = slo.get_station_list() - # Get pointer to the velocity model object - vel_obj = velocity_models.get_velocity_model_by_name(self.vmodel_name) - if vel_obj is None: - raise bband_utils.ParameterError("Cannot find velocity model: %s" % - (self.vmodel_name)) - - # Check for velocity model-specific parameters - vmodel_params = vel_obj.get_codebase_params('gp') - # Figure out what DT we should use when resampling # Figure out the LF DT value diff --git a/bbp/comps/match_cfg.py b/bbp/comps/match_cfg.py index f1ee9453..ee32db9c 100755 --- a/bbp/comps/match_cfg.py +++ b/bbp/comps/match_cfg.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2024, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -45,13 +45,16 @@ class MatchCfg(object): Define the configuration parameters for the Match program """ def __init__(self): - self.HF_FHI = 1.0 + # Default merging frequency set + self.DEFAULT_MERGING_FREQUENCY = 1.0 + + self.HF_FHI = self.DEFAULT_MERGING_FREQUENCY self.HF_FLO = "1.0e+15" self.HF_ORD = 4 self.HF_TSTART = 0.0 self.LF_FHI = 0.0 - self.LF_FLO = 1.0 + self.LF_FLO = self.DEFAULT_MERGING_FREQUENCY self.LF_ORD = 4 self.LF_TSTART = 0.0