Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/bioemu/sde_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ def __init__(self, s: float = 0.008):

def beta(self, t) -> torch.Tensor:
# Derived from _marginal_mean_coeff using equation (29) in Song et al.
return torch.tan((t + self.s) / (1 + self.s) * np.pi / 2) * np.pi / (1 + self.s)
t_clamp = torch.clamp(t, max=1.0 - 1e-6) # clips t to avoid tan(π/2) singularity at t=1.0
return torch.tan((t_clamp + self.s) / (1 + self.s) * np.pi / 2) * np.pi / (1 + self.s)

def _marginal_mean_coeff(self, t: torch.Tensor) -> torch.Tensor:
mean_coeff = torch.cos((t + self.s) / (1 + self.s) * np.pi / 2) / self.c
Expand Down