Skip to content

Commit

Permalink
models.geodetic: move get_pyrocko_events to source composite
Browse files Browse the repository at this point in the history
  • Loading branch information
hvasbath committed Mar 14, 2024
1 parent c90d43a commit 043a208
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions beat/models/geodetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,25 @@ def get_formula(self, input_rvs, fixed_rvs, hyperparams, problem_config):
llk = Deterministic(self._like_name, logpts)
return llk.sum()

def get_pyrocko_events(self, point=None):
"""
Transform sources to pyrocko events.
Returns
-------
events : list
of :class:`pyrocko.model.Event`
"""

if point is not None:
self.point2sources(point)

target = self.targets[0]
store = self.engine.get_store(target.store_id)
return [
source.pyrocko_event(store=store, target=target) for source in self.sources
]


class GeodeticGeometryComposite(GeodeticSourceComposite):
def __init__(self, gc, project_dir, sources, mapping, events, hypers=False):
Expand All @@ -690,25 +709,6 @@ def __getstate__(self):
self.engine.close_cashed_stores()
return self.__dict__.copy()

def get_pyrocko_events(self, point=None):
"""
Transform sources to pyrocko events.
Returns
-------
events : list
of :class:`pyrocko.model.Event`
"""

if point is not None:
self.point2sources(point)

target = self.targets[0]
store = self.engine.get_store(target.store_id)
return [
source.pyrocko_event(store=store, target=target) for source in self.sources
]

def get_synthetics(self, point):
"""
Get synthetics for given point in solution space.
Expand Down

0 comments on commit 043a208

Please sign in to comment.