Skip to content

Commit

Permalink
flake8 analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
beckynevin committed Feb 14, 2024
1 parent 9911d13 commit 57d3181
Showing 1 changed file with 55 additions and 22 deletions.
77 changes: 55 additions & 22 deletions src/scripts/analysis.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
import numpy as np

# how should the error propagate?

# how should the error propagate?
# its all partial derivatives
def calc_error_prop(true_L, true_theta, true_a, dthing, time, wrt = 'theta_0'):
if wrt == 'theta_0':
dx_dthing = true_L * np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time)) * \
np.cos(np.sqrt(true_a / true_L) * time) * dthing
if wrt == 'L':
dx_dthing = (0.5 * true_theta * time * np.sqrt(true_a / true_L) * np.sin(time * np.sqrt(true_a / true_L)) * \
np.cos(true_theta * np.cos(time * np.sqrt(true_a / true_L))) + \
np.sin(true_theta * np.cos(time * np.sqrt(true_a / true_L)))) * dthing
if wrt == 'a_g':
dx_dthing = (- 0.5 * np.sqrt(true_L / true_a) * true_theta * time * \
np.sin(np.sqrt(true_a / true_L) * time) * \
np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))) * dthing
if wrt == 'all':
dx_dthing = true_L * np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time)) * \
np.cos(np.sqrt(true_a / true_L) * time) * dthing[1] + \
(0.5 * true_theta * time * np.sqrt(true_a / true_L) * np.sin(time * np.sqrt(true_a / true_L)) * \
np.cos(true_theta * np.cos(time * np.sqrt(true_a / true_L))) + \
np.sin(true_theta * np.cos(time * np.sqrt(true_a / true_L)))) * dthing[0] + \
(- 0.5 * np.sqrt(true_L / true_a) * true_theta * time * \
np.sin(np.sqrt(true_a / true_L) * time) * \
np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))) * dthing[2]
def calc_error_prop(true_L, true_theta, true_a, dthing, time, wrt="theta_0"):
if wrt == "theta_0":
dx_dthing = (
true_L
* np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))
* np.cos(np.sqrt(true_a / true_L) * time)
* dthing
)
if wrt == "L":
dx_dthing = (
0.5
* true_theta
* time
* np.sqrt(true_a / true_L)
* np.sin(time * np.sqrt(true_a / true_L))
* np.cos(true_theta * np.cos(time * np.sqrt(true_a / true_L)))
+ np.sin(true_theta * np.cos(time * np.sqrt(true_a / true_L)))
) * dthing
if wrt == "a_g":
dx_dthing = (
-0.5
* np.sqrt(true_L / true_a)
* true_theta
* time
* np.sin(np.sqrt(true_a / true_L) * time)
* np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))
) * dthing
if wrt == "all":
dx_dthing = (
true_L
* np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))
* np.cos(np.sqrt(true_a / true_L) * time)
* dthing[1]
+ (
0.5
* true_theta
* time
* np.sqrt(true_a / true_L)
* np.sin(time * np.sqrt(true_a / true_L))
* np.cos(true_theta * np.cos(time * np.sqrt(true_a / true_L)))
+ np.sin(true_theta * np.cos(time * np.sqrt(true_a / true_L)))
)
* dthing[0]
+ (
-0.5
* np.sqrt(true_L / true_a)
* true_theta
* time
* np.sin(np.sqrt(true_a / true_L) * time)
* np.cos(true_theta * np.cos(np.sqrt(true_a / true_L) * time))
)
* dthing[2]
)
return abs(dx_dthing)

0 comments on commit 57d3181

Please sign in to comment.