Skip to content

Commit

Permalink
user can specify bounds for least squares initial model in AgeModel
Browse files Browse the repository at this point in the history
  • Loading branch information
sarttiso committed Oct 25, 2024
1 parent 3f84d25 commit 595da57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/stratage/stratage.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,15 @@ class AgeModel:
vars_list (list): List of variables in the pymc.model.
"""

def __init__(self, units, geochron, sed_rates_prior, hiatuses_prior):
def __init__(self, units, geochron, sed_rates_prior, hiatuses_prior, ls_kwargs=None):
"""Initializes age model object for Bayesian inference of sedimentation rates and hiatuses.
Args:
units (numpy.ndarray): nx2 array of unit bottom and top heights for n units.
geochron (geochron.Geochron): Geochron object containing geochron constraints.
sed_rates_prior (function): Prior distribution for sedimentation rates. Must be valid as dist argument to pymc.CustomDist(dist=dist). Signature is sed_rate_prior(size=size).
hiatuses_prior (function): Prior distribution for hiatuses. Must be valid as dist argument to pymc.CustomDist(dist=dist). Signature is hiatus_prior(size=size).
ls_kwargs (dict, optional): Keyword arguments for model_ls. Defaults to None.
"""
# assign attributes
self.units = units
Expand All @@ -489,7 +490,7 @@ def __init__(self, units, geochron, sed_rates_prior, hiatuses_prior):
# trim the section to the top and bottom of the geochron constraints
self.units_trim = trim_units(self.units, self.geochron.h)
# create least squares model as initial guess
self.sed_rates_ls, self.hiatuses_ls = model_ls(self.units, self.geochron)
self.sed_rates_ls, self.hiatuses_ls = model_ls(self.units, self.geochron, **ls_kwargs)
# create time increment log-like function
loglike_op = loglike_gen(self.geochron, self.units_trim)
# create time increment random-like function
Expand Down

0 comments on commit 595da57

Please sign in to comment.