Skip to content

Commit

Permalink
Fix log_prob calculation in Sphere class
Browse files Browse the repository at this point in the history
  • Loading branch information
kazewong committed Jan 18, 2024
1 parent 0ee1c76 commit 3cf1f41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/jimgw/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,13 @@ def sample(
return self.add_name(jnp.stack([theta, phi, mag], axis=1).T)

def log_prob(self, x: dict[str, Float]) -> Float:
return jnp.log(x[self.naming[2]] ** 2 * jnp.sin(x[self.naming[0]]))
mag = x[self.naming[2]]
output = jnp.where(
(mag > 1) | (mag < 0),
jnp.zeros_like(0) - jnp.inf,
jnp.log(mag**2 * jnp.sin(x[self.naming[0]])),
)
return output


@jaxtyped
Expand Down

0 comments on commit 3cf1f41

Please sign in to comment.