Skip to content

Commit

Permalink
clean up run_nested signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-j committed Aug 26, 2024
1 parent 8609875 commit 355c256
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions prospect/fitting/nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@

from .fitting import lnprobfn

try:
import dynesty
from dynesty.utils import *
except(ImportError):
pass


__all__ = ["run_nested", "run_dynesty_sampler"]


def run_nested(model,
lnprobfn=lnprobfn,
fitter="dynesty",
**kwargs):

def run_nested(observations, model, sps, lnprobfn=lnprobfn, fitter="dynesty",
pool=None, nested_target_n_effective=10000, **kwargs):
"""We give a model -- parameter discription and prior transform -- and a
likelihood function. We get back samples, weights, and likelihood values.
"""

go = time.time()

Expand Down Expand Up @@ -94,6 +93,7 @@ def run_nested(observations, model, sps, lnprobfn=lnprobfn, fitter="dynesty",
return (points, log_w, log_like)


from dynesty.dynamicsampler import stopping_function, weight_function
def run_dynesty_sampler(lnprobfn, prior_transform, ndim,
verbose=True,
# sampler kwargs
Expand All @@ -120,9 +120,8 @@ def run_dynesty_sampler(lnprobfn, prior_transform, ndim,
# overall kwargs
nested_maxcall=None,
nested_maxiter=None,
nested_first_update={},
stop_function=None,
wt_function=None,
stop_function=stopping_function,
wt_function=weight_function,
nested_weight_kwargs={'pfrac': 1.0},
nested_stop_kwargs={},
nested_save_bounds=False,
Expand All @@ -131,7 +130,6 @@ def run_dynesty_sampler(lnprobfn, prior_transform, ndim,

from dynesty import DynamicNestedSampler


# instantiate sampler
dsampler = DynamicNestedSampler(lnprobfn, prior_transform, ndim,
bound=nested_bound,
Expand Down

0 comments on commit 355c256

Please sign in to comment.