Skip to content

Commit f16ac87

Browse files
committed
update comments
1 parent 599b3bd commit f16ac87

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

py/dynesty/sampling.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ class InnerSampler:
2626
"""
2727
Base class for all inner samplers.
2828
This class is not meant to be used directly.
29-
3029
The basic interface of the class is to provide sampling that can be distributed over workers.
3130
The key methods are `prepare_sampler`, `sample` and `tune`.
3231
The `prepare_sampler` method constructs the list of SamplerArguments objects
3332
The `sample` method is called by the workers to sample a new point. Importantly
3433
the `sample` method is a static method and does not have access to the class instance.
35-
The `tune` method is called by the parent process to adjust things, such as
36-
scale of the proposal distribution.
34+
The `tune` method is called by the parent process to adjust things, such as scale of the proposal distribution.
3735
The `tune` method is not a static method and has access to the class instance.
3836
"""
3937

@@ -54,6 +52,7 @@ def __init__(self, **kwargs):
5452
reflective : array
5553
Array of boolean values indicating which dimensions are
5654
reflective.
55+
5756
"""
5857
self.scale = 1
5958
self.kwargs = dict()
@@ -69,7 +68,8 @@ def prepare_sampler(self,
6968
loglikelihood=None,
7069
nested_sampler=None):
7170
"""
72-
Prepare the list arguments for sampling.
71+
Prepare the list of arguments for sampling.
72+
7373
Parameters
7474
----------
7575
loglstar : float
@@ -113,10 +113,12 @@ def prepare_sampler(self,
113113
def sample(cls, args):
114114
"""
115115
Sample a new live point.
116+
116117
Parameters
117118
----------
118119
args : `SamplerArgument`
119120
The arguments needed for sampling.
121+
120122
Returns
121123
-------
122124
u : `~numpy.ndarray` with shape (ndim,)
@@ -134,12 +136,24 @@ def sample(cls, args):
134136

135137
def tune(sample_info, update=False):
136138
"""
137-
Accumulate sampling info
139+
140+
Accumulate sampling info and optionally update the proposal scale and
141+
other tuning parameters.
142+
143+
Parameters
144+
----------
145+
sample_info : dict
146+
Dictionary containing the sampling information.
147+
update : bool
148+
Whether to update the proposal scale or not (default: False).
138149
"""
139150
pass
140151

141152

142153
class UniformBoundSampler(InnerSampler):
154+
"""
155+
Uniformly sample within a bounding proposal distribution.
156+
"""
143157

144158
def __init__(self, **kwargs):
145159
super().__init__(**kwargs)
@@ -152,6 +166,13 @@ def prepare_sampler(self,
152166
prior_transform=None,
153167
loglikelihood=None,
154168
nested_sampler=None):
169+
"""
170+
Prepare the list of arguments for sampling.
171+
172+
This is is overriding the base class method and providing the bound itself
173+
to the sampler through kwargs.
174+
175+
"""
155176
self.kwargs['bound'] = nested_sampler.bound
156177
self.kwargs['ndim'] = nested_sampler.ndim
157178
self.kwargs['n_cluster'] = nested_sampler.ncdim

0 commit comments

Comments
 (0)