Skip to content
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

Added temporary noise fix to ham pendulum #81

Merged
merged 1 commit into from
Jun 6, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/deepbench/physics_object/hamiltonian_pendulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ def simulate_pendulum_dynamics(self, time, **kwargs):
dydt = np.stack(dydt).T
dqdt, dpdt = np.split(dydt, 2) # split the dydt into dqdt and dpdt

# add noise
noise_std = 0.1
q += (
np.random.randn(*q.shape) * noise_std
) # creates a random array of size q.shape and is scaled with noise_std then adds to q for noise
p += (
np.random.randn(*p.shape) * noise_std
) # creates a random array of size p.shape and is scaled with noise_std then adds to p for noise
return q, p, dqdt, dpdt, t_eval

def get_field(self, xmin=-1.2, xmax=1.2, ymin=-1.2, ymax=1.2, gridsize=20):
Expand Down