Skip to content

Commit

Permalink
Modified GP match code to allow users to specify the merging frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolsilva committed Nov 12, 2024
1 parent 3b71644 commit 2f1f3f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
25 changes: 15 additions & 10 deletions bbp/comps/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 7 additions & 4 deletions bbp/comps/match_cfg.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2f1f3f0

Please sign in to comment.