Skip to content

Commit

Permalink
renamed walkers to popsize
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibeauWouters committed Nov 27, 2023
1 parent 5e42892 commit 7cc4843
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/jimgw/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(
trigger_time: float = 0,
duration: float = 4,
post_trigger_duration: float = 2,
n_walkers: int = 100,
popsize: int = 100,
n_loops: int = 2000,
) -> None:
super().__init__(
Expand All @@ -157,7 +157,7 @@ def __init__(
self.freq_grid_low = freq_grid[:-1]

self.ref_params = self.maximize_likelihood(
bounds=bounds, prior=prior, set_nwalkers=n_walkers, n_loops=n_loops
bounds=bounds, prior=prior, popsize=popsize, n_loops=n_loops
)

self.ref_params["gmst"] = self.gmst
Expand Down Expand Up @@ -366,19 +366,19 @@ def maximize_likelihood(
self,
bounds: tuple[Array, Array],
prior: Prior,
set_nwalkers: int = 100,
popsize: int = 100,
n_loops: int = 2000,
):
bounds = jnp.array(bounds).T
set_nwalkers = set_nwalkers # TODO remove this?
popsize = popsize # TODO remove this?

y = lambda x: -self.evaluate_original(
prior.add_name(x, transform_name=True, transform_value=True), None
)
y = jax.jit(jax.vmap(y))

print("Starting the optimizer")
optimizer = EvolutionaryOptimizer(len(bounds), popsize=set_nwalkers, verbose=True)
optimizer = EvolutionaryOptimizer(len(bounds), popsize=popsize, verbose=True)
state = optimizer.optimize(y, bounds, n_loops=n_loops)
best_fit = optimizer.get_result()[0]
return prior.add_name(best_fit, transform_name=True, transform_value=True)

0 comments on commit 7cc4843

Please sign in to comment.