Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
phiTdelta = N[0, 1]
deltaTdelta = N[1, 1]
# Find the zeros
phiTphiZeros = roots(phiTphi, s, multiple=True)
deltaTphiZeros = roots(deltaTphi, s, multiple=True)
phiTdeltaZeros = roots(phiTdelta, s, multiple=True)
deltaTdeltaZeros = roots(deltaTdelta, s, multiple=True)
# Load a bicycle with some parameters and calculate the canonical matrices.
pathToData = '/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data'
bicycle = bp.Bicycle('Rigidcl', pathToData=pathToData, forceRawCalc=True)
bicycle.add_rider('Charlie')
#bicycle = bp.Bicycle('Benchmark', pathToData=pathToData)
Mn, C1n, K0n, K2n = bicycle.canonical()
Mn = un.unumpy.nominal_values(Mn)
C1n = un.unumpy.nominal_values(C1n)
K0n = un.unumpy.nominal_values(K0n)
K2n = un.unumpy.nominal_values(K2n)
# Create a dictionary to substitute numerical values.
# These are the benchmark bicycle parameters.
#num = {M[0, 0] : 80.81722,
#M[0, 1] : 2.31941332208709,
#M[1, 0] : 2.31941332208709,
#M[1, 1] : 0.29784188199686,
#K0[0, 0] : -80.95,
#K0[0, 1] : -2.59951685249872,
#K0[1, 0] : -2.59951685249872,
#K0[1, 1] : -0.80329488458618,
#K2[0, 1] : 76.59734589573222,
def array_u(*args):
"""
Wrapper for legacy code. Obsolete: do not use. Use
unumpy.uarray instead.
"""
import warnings
warnings.warn("uncertainties.array_u is obsolete."
" Use uncertainties.unumpy.uarray instead.",
DeprecationWarning,
stacklevel=2)
import uncertainties.unumpy
return uncertainties.unumpy.uarray(*args)
which I can only assume is due to the new way ascii handles tables.
I created this method to use as a replacement for unumpy.uarray that handles
the tables created with astropy.io.ascii.
Usage is the same as uncertainties.unumpy.uarray.
:type x,errx: arrays created with astropy.io.ascii.
:returns: uncertainties array.
"""
import uncertainties.unumpy as unumpy
x=numpy.array(x)
errx=numpy.array(errx)
return unumpy.uarray(x,errx)
----------
jay : ndarray, shape(n,)
An array of at least three moments of inertia. (n >= 3)
beta : ndarray, shape(n,)
An array of orientation angles corresponding to the moments of inertia
in jay.
Returns
-------
eye : ndarray, shape(3,)
Ixx, Ixz, Izz
'''
sb = unumpy.sin(beta)
cb = unumpy.cos(beta)
betaMat = unumpy.matrix(np.vstack((cb**2, -2 * sb * cb, sb**2)).T)
eye = np.squeeze(np.asarray(np.dot(betaMat.I, jay)))
return eye
np.array([-umath.sin(par['lam']),
0.,
-umath.cos(par['lam'])])
pointsOnLine = np.array([pointOnAxis1, pointOnAxis2]).T
# this is the distance from the assembly com to the steer axis
distance = point_to_line_distance(cAss, pointsOnLine)
print "handlebar cg distance", distance
# now calculate the inertia about the steer axis of the rotated frame
iAss = parallel_axis(iAssRot, mAss, np.array([distance, 0., 0.]))
else:
iAss = iAssRot
if nominal:
return unumpy.nominal_values(iAss)
else:
return iAss
If you have a flywheel defined, body D, it will completely be
ignored in these results. These results are strictly for the Whipple
bicycle model.
"""
par = self.parameters['Benchmark']
M, C1, K0, K2 = bicycle.benchmark_par_to_canonical(par)
if nominal is True:
return (unumpy.nominal_values(M),
unumpy.nominal_values(C1),
unumpy.nominal_values(K0),
unumpy.nominal_values(K2))
elif nominal is False:
return M, C1, K0, K2
else:
raise ValueError('nominal must be True or False')