-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated piecewise linear T schedule #353
Conversation
for more information, see https://pre-commit.ci
closes #353 |
def __init__(self, T0: int, temperatures: list[float], durations: list[int]): | ||
self.T0 = T0 | ||
self.values = jnp.array(values) | ||
self.temperatures = jnp.array(temperatures) | ||
steps = np.cumsum(durations) | ||
self.steps = jnp.array(steps) | ||
|
||
def __call__(self, step) -> float: | ||
T = jnp.interp(step, self.steps, self.values, left=self.T0, right=self.values[-1]) | ||
T = jnp.interp( | ||
step, self.steps, self.temperatures, left=self.T0, right=self.temperatures[-1] | ||
) | ||
return T * units.kB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the test does actually fail rn but should be fixed with the other PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what I was thinking here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
changed the
steps
parameter toduration
, which is the number of time steps between temperatures.