From 043962573da14b31b693b5a4e3e5900958a0476f Mon Sep 17 00:00:00 2001 From: Omari Paul Date: Fri, 2 Jun 2023 11:29:48 -0500 Subject: [PATCH] Added temporary noise fix to ham pendulum --- src/deepbench/physics_object/hamiltonian_pendulum.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/deepbench/physics_object/hamiltonian_pendulum.py b/src/deepbench/physics_object/hamiltonian_pendulum.py index 8ff3f6d..6de71fb 100644 --- a/src/deepbench/physics_object/hamiltonian_pendulum.py +++ b/src/deepbench/physics_object/hamiltonian_pendulum.py @@ -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):